tophe 69 Posted July 10, 2008 How do I go about to put all units within a trigger in a list? I have put a trigger like this: Activation: BLUFOR - present Condition: this ON Act: unitArray = thislist Is that right? Share this post Link to post Share on other sites
tophe 69 Posted July 10, 2008 Ok.. so I read about it some more, nd it seems I'm in the right track... My next task is to set another trigger to check if all units of the list, set by the previous trigger, is present. Like this: Activation: BLUFOR - present Condition: this && unitArray == thisList How do I do that? The above example does not work. Share this post Link to post Share on other sites
kronzky 5 Posted July 10, 2008 Read up on the Wiki article on list, and that might answer your question. If you are assigning the "thislist" from a trigger to a variable via your method (mylist = thislist) that means "mylist" will only contain a pointer to the trigger list (i.e. you're not really copying the list content into your variable, but merely referencing it), which means as the trigger list is updated, so is your variable. So - unless you have two triggers overlapping, testing for presence in one trigger, plus presence in the second trigger list, will never return true. You probably want to copy the content of the first trigger list, so that is stays static, no matter what else happens to the trigger itself in the meantime. The syntax for that is mylist =+ thislist. Share this post Link to post Share on other sites
tophe 69 Posted July 10, 2008 Ah! Thank you! Now I understand why my lists behaved so weird! But how do I set a second trigger to activate when all units in the mylist are in that one? I tried: Condition: mylist == thisList That didn't work. Share this post Link to post Share on other sites
kronzky 5 Posted July 13, 2008 You can't actually compare arrays with the "==" operator, that's why that method doesn't work. And even if it did, it would probably also take into consideration the order of the list, and that would most likely never be the same. Let's assume our first list was copied into "listone" (e.g. <span style='color:blue'>listone =+ thislist</span>). Then we'd have to check for each unit in that list, whether it is also present in the list of the 2nd trigger: <span style='color:blue'>unittest=true; {if !(_x in listone) then {unittest=false}}forEach thislist; unittest</span> The thing is though, that this condition would be true right at the start of the mission (where both trigger areas are empty), so you'd have to add some more conditions, to eliminate that situation: <span style='color:blue'>unittest=((count listone!=0) && (count thislist==count listone)); {if !(_x in listone) then {unittest=false}}forEach thislist; unittest</span> Another tricky thing might be that the first trigger will never actually contain all units that are in there. If it's just a regular presence trigger, it will only fire once, when then first appropriate unit enters. But not again, when the rest of the team follows. So you will probably need a counter condition in that trigger as well (e.g. <span style='color:blue'>if (count thislist)==number_of_units_required</span>). Since all this is getting pretty complicated, I've posted a demo mission here... Share this post Link to post Share on other sites
tophe 69 Posted July 13, 2008 Wow Kronzky! Thank you so much for taking the time to help me out. This seems to be exactly the sollution I need. I'm thinking though, that maybe I could just put the first trigger at the first point where the units start and have it set off when someone is in it. Maybe with a delay of 2 seconds to make sure that all units are spawned in at the beginning of the mission. I figured that maybe I could go for an even easier solution, that probably would work if there is only the players on the west side. I put all units in a list, and then check the second trigger how many people from the west side that is in it. If the amount equals to the amount of units in my list it should go off. And by the way. Your code is pure poetry. Share this post Link to post Share on other sites
Rommel 2 Posted July 13, 2008 Quote[/b] ]...ns "mylist" will only contain a pointer to the trigger list (i.e. you're not really copying the list content into your variable, but merely referencing it), which means as the trigger list is updated, so is your variable... Useful info... explains some previous mishaps of mine. Share this post Link to post Share on other sites