satexas69 0 Posted March 18, 2007 I have a mission where I have a lot of civilians. I've taken the time and named each one (man1, man2, man3...) Instead of ending the mission if any one of them just dies (because AI screws up and kills them from time to time) - I'd like to do a trigger where: IF - !alive man1 && !alive man2 && !man3..... > 5 IE, of all the men (like 30 of them), if more than 5 !alives come back, set off trigger... Syntax? Thanks in advance.. Share this post Link to post Share on other sites
OddballWDI 0 Posted March 18, 2007 I added something like this to a mission I'm writing. I'm not sure if this is the best way to do it, but it does work. 1 - I set a variable equal to zero in a units init field. This will be your counter of how many dead civilians there are. So set a variable like "COUNTER=0" in an init field. 2 - Make a trigger for each civ you have with a condition of "not Alive man1" and an activation field of "COUNTER=COUNTER+1". Do this for each unit and just change the "not Alive man#". Same activation field. I had 5 units I needed this for. You have 30, so I don't know exactly how practical this is, and I don't know if having a lot of triggers always checking if a unit is alive is going to be eating up to much CPU time. 3 - Make a final trigger with a condition of "COUNTER>5" and then whatever activation you want, or the end/lose thing. There may be a better way to do it, but this works for me. I did basicly the same thing with a mission where you have to rescue some prisioners, and I allow only 2 of them to die (same reason, AI sometimes kills a prisioner). Share this post Link to post Share on other sites
NeZz_DK 1 Posted March 18, 2007 I would make to triggers first one that creates a list of all the civilians on start of the mission on only this once and assign the list to a variable something like this activation: true; on Activation: civMen = thislist second trigger has an activation that looks like this activation: {!alive _x;}count civMen >= 5 I haven't tried it out but i should work. :-) Share this post Link to post Share on other sites
satexas69 0 Posted March 18, 2007 activation: true;on Activation: civMen = thislist second trigger has an activation that looks like this activation: {!alive _x;}count civMen >= 5 Nice idea and try.. and it's exactly what I"m after - but it doesn't work. I put down 10 civilians on an isolated spot, named each one of them (probably not necessary) and then put in the two triggers.. but the second trigger never fires off no matter how many I kill Share this post Link to post Share on other sites
NeZz_DK 1 Posted March 19, 2007 did you set it to repeatable? I will see if I can get it to work and put up a sample if I can :-) Share this post Link to post Share on other sites
NeZz_DK 1 Posted March 19, 2007 ok I found the error you have to do this in the first trigger and remember activation by civilian once <table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">civlist = [];{civlist = [_x] + civlist}forEach thislist; and second trigger needs to be repeatable. I made a small example of it can be found HERE Share this post Link to post Share on other sites
pebcak 0 Posted March 24, 2007 Would this work in MP? Share this post Link to post Share on other sites
NeZz_DK 1 Posted March 25, 2007 I should work if it dosent then add a gamelogic named server and make the trigger say Init: (local server) AND this Share this post Link to post Share on other sites