jpinard 10 Posted July 12, 2010 What I'd like the mission to do is: If Blufor kills 5 or more Civilians they lose the game. I can't quite seem to get the syntax right. This is what I have: Activation: Blufor - once Condition: !alive civilian count => 5 On Act: Hint "With so many civilans killed, the populace rises up against you and HQ is forced to pull you out. You have lost the mission." Share this post Link to post Share on other sites
kylania 568 Posted July 12, 2010 Put them in a group and count the units in the group. In the group leader's Init: cupcakes = group this; In a trigger's Condition: count units cupcakes < 6 Change 6 to be whatever low number you wanted to be. Share this post Link to post Share on other sites
fatty86 10 Posted July 12, 2010 One way to do this would be to use event handlers to increase a variable everytime a civilian is killed. For example, put this in the init field of each civilian: this addeventhandler ["killed",{civ_casaulties = civ_casaulties + 1}]; Then, have a trigger to check when civ_casualties is equal to your allowed limit. I have used this method successfully in MP dedicated settings, though I use it to spawn insurgent reinforcement groups rather than end the mission. Share this post Link to post Share on other sites
kylania 568 Posted July 12, 2010 fatty's method is really what you wanted, but is more effort and has a distinct lack of cupcakes in his example, thereby making pandas sad. :) Share this post Link to post Share on other sites
jpinard 10 Posted July 12, 2010 I was hoping to use the ALICE module, so if any of the randomly spawned civilians were killed it would go towards that death count. Is that not possible? Thanks for the ideas! Share this post Link to post Share on other sites
f2k sel 164 Posted July 12, 2010 You may have another problem, explosions may not register to a unit or side but I'm not certain about that. Share this post Link to post Share on other sites
fatty86 10 Posted July 12, 2010 Yes, it is possible. Check out how to set ALICE to add code to each spawned civilian's init field: http://community.bistudio.com/wiki/Ambient_Civilians#Optional_parameters This thread might help: http://forums.bistudio.com/showthread.php?t=74433 Also, cupcakes. Share this post Link to post Share on other sites
jpinard 10 Posted July 13, 2010 Yes, it is possible. Check out how to set ALICE to add code to each spawned civilian's init field: http://community.bistudio.com/wiki/Ambient_Civilians#Optional_parametersAlso, cupcakes. That looks like it should work. Now my only question is how should the trigger look to reflect that? Trigger * Activiation: Game logic? * Condition: ? * On Activiation? Share this post Link to post Share on other sites
fatty86 10 Posted July 13, 2010 Activation can be anything. Use blufor - once for simplicity's sake. Condition should be something like... civ_casualties == x ...where x is the number of dead civilians that triggers the end game. On activation, put whatever you want to happen when too many civilians are killed. Above, you have... Hint "With so many civilans killed, the populace rises up against you and HQ is forced to pull you out. You have lost the mission." ...so that's a good start. Look up the endMission command for a way to force the mission to end. ---------- Post added at 10:54 AM ---------- Previous post was at 10:53 AM ---------- Also, you may need to declare civ_casualties as "0" in your init.sqf. just put... civ_casualties = 0; I hope I am getting the syntax right here, I do not have access to my ArmA game at the moment. Share this post Link to post Share on other sites
NorthStar 10 Posted July 14, 2010 You may also need to execute publicVariable "civ_casualties" if it is to work properly in MP. Otherwise each client will have their own copy of the variable and the values could get out of sync. Share this post Link to post Share on other sites
TRexian 0 Posted July 14, 2010 @jpinard- I'm very interested if you can get something like this working. I've tried various things to no avail. (Likely due to poor scriptology skills.) :) My last resort (which I have not yet tried) is to have all the spawned civilians entered in a global public variable (lets call it "cupcakes"), and attache a killed EH to them. The killed EH would simply check cupcakes and set the index of that civilian to "killed" or the side that killed the civ or something like that (not simply removed). Then, have a monitor script that checked cupcakes, and if it found more than a certain number killed, by a certain side, then activate whatever other script. A simple counting mechanism didn't work for me. I think it has something to do with different EH "namespace" or something. Share this post Link to post Share on other sites
NorthStar 10 Posted July 14, 2010 (edited) Seems like you could also take the reverse approach and do something like: {alive _x} count cupcakes <= 15 as a trigger condition for END, where the original number of civilians is 20. This approach assumes that you have a fixed number of civilians. Edited July 14, 2010 by NorthStar Share this post Link to post Share on other sites
TRexian 0 Posted July 14, 2010 Yeah, one potential issue with working with ALICE is that the population will be somewhat dynamic. AI might wander off and be removed - and perhaps seen as "dead" by the game - or the player might move off and all the civs removed. Also, I believe dead units of any side are considered civilian by the game, so just counting dead "civilians" could lead to unexpected results, too. :) Share this post Link to post Share on other sites
AZCoder 921 Posted July 14, 2010 Unexpected results, like burnt cupcakes? :O Share this post Link to post Share on other sites
BadgerDK 10 Posted January 30, 2011 I'd love to know if you found a working method. Or at least a killer recipe for cupcakes. Share this post Link to post Share on other sites
shuko 59 Posted January 30, 2011 Search is often your friend. showthread.php?t=109166 Share this post Link to post Share on other sites
BadgerDK 10 Posted January 30, 2011 Yep, I use it all the time and tried your method but it fails when I try to integrate it with the Insurgency mission. Share this post Link to post Share on other sites
shuko 59 Posted January 30, 2011 It's made for civilians, but the same method can be used for anything you like, just change to who the EH is added. Share this post Link to post Share on other sites
BadgerDK 10 Posted January 30, 2011 (edited) Ah, sure thing. I'm new at the scripting so I'm not able to debug yet. I added ALICE civvies and I am able to kill them too, I just don't see a counter or get an end mission when x civs killed. On the other hand when bullets hit civ vehicles they magically disappear so something might be off in a big way. EDIT: did manage to make your script work from empty mission in the editor. Thanks for your hard work, mate :) Edited January 30, 2011 by BadgerDK Share this post Link to post Share on other sites
Tom1 10 Posted January 31, 2011 (edited) TOM_DeadEnemyCount = 0; TOM_DeadEnemyLimit = 5; TOM_fnc_deadEnemies = { hintsilent format ["Civilians dead: %1",_this]; if (_this >= TOM_DeadEnemyLimit) then { //end mission or do whatever here}; }; if isserver then { { if (side _x == Civilian) then { _x addEventHandler ["killed", { TOM_DeadEnemyCount = TOM_DeadEnemyCount +1; publicvariable "TOM_DeadEnemyCount"; if !isdedicated then { TOM_DeadEnemyCount call TOM_fnc_deadEnemies; }; }]; }; } foreach allunits; }; if !isdedicated then { "TOM_DeadEnemyCount" addpublicvariableeventhandler { (_this select 1) call TOM_fnc_deadEnemies }; }; Edited January 31, 2011 by Tom1 Share this post Link to post Share on other sites