joske 10 Posted September 22, 2009 as the title says i want to use the killing of a unit of a certain side as a condition for the activation of a trigger, i have already searched in my editing guide and de-pbo'd some deatmatch missions but i havent yet found anything so im turning here for help. Share this post Link to post Share on other sites
seba1976 98 Posted September 23, 2009 as the title says i want to use the killing of a unit of a certain side as a condition for the activation of a trigger, i have already searched in my editing guide and de-pbo'd some deatmatch missions but i havent yet found anything so im turning here for help. Set the condition to "!alive unitname" and you're done. Share this post Link to post Share on other sites
joske 10 Posted September 23, 2009 yes i know how to do that but for that you need to fill in the unitname what i need is a way to activate a script when you kill a random person from a certain side Share this post Link to post Share on other sites
seba1976 98 Posted September 23, 2009 yes i know how to do that but for that you need to fill in the unitname what i need is a way to activate a script when you kill a random person from a certain side I see. Could you describe a little more what you intend to do? What effect do you want to simulate with the script, etc. Share this post Link to post Share on other sites
Mike84 1 Posted September 23, 2009 (edited) At mission start count all the units on a specific side, and when the number decreases (someone died) you trigger your trigger. This is an excerpt from my mission monitor: { if (alive _x && !isNull _x) then { switch (side _x) do { case west: { WArray = WArray + [_x] }; case east: { EArray = EArray + [_x] }; case resistance: { RArray = RArray + [_x] }; case civilian: { CArray = CArray + [_x] }; default { }; }; }; } forEach allUnits; From here on you save the initial count of a particular array in a variable (CArrayCount = count CArray), and every 5 seconds or so you run this piece of code above again, and get the count again, but this time save it in a different variable (CArrayCountUpd = count CArray). All that is left now is to check CArrayCount and CArrayCountUpd for differences. Edited September 23, 2009 by Mike84 Share this post Link to post Share on other sites
seba1976 98 Posted September 23, 2009 I never did it myself, but maybe it would be more efficient to add an event handler type 'killed' to all units at mission start. The code for the event handler should be conditional to the first unit killed, of course. Share this post Link to post Share on other sites
joske 10 Posted September 23, 2009 @seba1976: yeah i just thought of it that i might have explained it a bit wrong, i want this script this script to accomplish that when somebody from one side kills a guy from another side then a marker is put on top of somebody of the other side keeps following him (the marker part i have already figured out thanks to help i received here), i also will try to use the script for some kind of sacrifice humans (ai) for weapons but i havent really figured out yet how im gonna do that. (im trying to make a sort of pvp mission over which i am influenced by tribal warfare, so that you dont start thinking wrong things about me) @Mike84: thanks again for the script i havent tried it out but it sounds logic to count the guys on all sides, but as i am quite new to scripting it is probably gonna take a bit of time to decipher this code but i can only learn new stuff from it so im still positive about it. Share this post Link to post Share on other sites
Mike84 1 Posted September 23, 2009 I never did it myself, but maybe it would be more efficient to add an event handler type 'killed' to all units at mission start. The code for the event handler should be conditional to the first unit killed, of course. Killed EH's are a great idea, but the drawback of using them is that the unit has to be local for the EH to fire. You can of course work around this, but it takes a lot of extra coding. Share this post Link to post Share on other sites
seba1976 98 Posted September 23, 2009 @seba1976: yeah i just thought of it that i might have explained it a bit wrong, i want this script this script to accomplish that when somebody from one side kills a guy from another side then a marker is put on top of somebody of the other side keeps following him If the marker should follow the killer then you'll have to go with the event handler solution, but, being it a MP mission (with respawn I assume), thing's are gonna get... complicated for you :). As Mike said. Share this post Link to post Share on other sites
joske 10 Posted September 23, 2009 yeah i now think that i better go with eventhandlers for now and as i doubt that i will release/finish this project(it is more a learning project) but who knows it might become something fun to play. well thanks for all the help Share this post Link to post Share on other sites
seba1976 98 Posted September 23, 2009 yeah i now think that i better go with eventhandlers for now and as i doubt that i will release/finish this project(it is more a learning project) but who knows it might become something fun to play.well thanks for all the help Ok, no problem. I forgot to tell you, remember to take a look at Extended Event Handler and make your system compatible, or you will broke most of the AI enhancement mods out there, if you use any, that is. Share this post Link to post Share on other sites