Home   Help Search Login Register  

Author Topic: Civilian Death counting trigger.  (Read 3097 times)

0 Members and 1 Guest are viewing this topic.

Offline Grimfist

  • Members
  • *
    • Armaholic
Civilian Death counting trigger.
« on: 19 Feb 2009, 17:04:55 »
Hi,

i would like to have a trigger (it will cover all of map), or a script that detects how many civilians have died/being killed.

it is for a co-op mission so if 15 civvies die then it forces END #2.

here is what i already have: http://www.armaholic.com/forums.php?m=posts&p=46411&n=last#bottom

Ty in advance,
Grim.

Offline Trexian

  • Members
  • *
Re: Civilian Death counting trigger.
« Reply #1 on: 19 Feb 2009, 17:15:35 »
Perhaps add a "killed" eventhandler to each civilian, then for the code part, increment a global variable by 1?
Sic semper tyrannosauro.

Offline Grimfist

  • Members
  • *
    • Armaholic
Re: Civilian Death counting trigger.
« Reply #2 on: 19 Feb 2009, 17:24:32 »
I am sorry but i do not understand, i am not good with scripts.

Offline Wolfrug

  • Addons Depot
  • Former Staff
  • ****
  • Official OFPEC Old Timer
Re: Civilian Death counting trigger.
« Reply #3 on: 19 Feb 2009, 17:47:29 »
Multiplayer issue :)

What Trexian is saying is that you should attach an eventHandler to each civilian, and then count up a global variable (which you need to make global in scope by some magic command that I don't know since I don't live in MP land). For instance, in each civilian's init field write:

Code: [Select]
this addeventhandler ["killed", {GRIM_CivKilled = GRIM_CivKilled + 1; publicVariable "GRIM_CivKilled"}];
in the Init.sqf or someplace else you've then created the global variable GRIM_CivKilled by putting

Code: [Select]
GRIM_CivKilled = 0;
in it. Then, in the END#2 trigger, you've simply got the Condition:
Code: [Select]
GRIM_CivKilled > 14
(more than 14 civilians killed).

Should do it :)

Wolfrug out.
"When 900 years YOU reach, look as good you will not!"

Offline Trexian

  • Members
  • *
Re: Civilian Death counting trigger.
« Reply #4 on: 19 Feb 2009, 17:52:30 »
Whew!

Lucky for you, somebody more experienced showed up. :D

Also, have you grabbed this new guide?

(right-click, save as) ;)
ftp://ftp.armedassault.info/armad/docs/Armed-Assault_Editing-Guide_Deluxe_Edition_by_Mr-Murray_EN.7z

It has some great information.

The eventhandler is triggered when that civ is killed.  When that happens, it will increment the dead civilian counter.

Your trigger can repeatedly then check if the dead civs > 15 then end2.

Again, I'm still very much n00bish at this, but it seems like it might work.

Oh, and I have no idea about MP either....
Sic semper tyrannosauro.

Offline Grimfist

  • Members
  • *
    • Armaholic
Re: Civilian Death counting trigger.
« Reply #5 on: 19 Feb 2009, 18:03:21 »
hmm ty both of u, but where can i find this magic command thing.

i am going to try it now.

WOW - it works ty very much.
« Last Edit: 19 Feb 2009, 18:15:22 by Grimfist »

Offline Sparticus76

  • Members
  • *
Re: Civilian Death counting trigger.
« Reply #6 on: 20 Feb 2009, 07:43:49 »
I know you have the solution, but another option is to create trigger1 covering the map, activated by civilians present, once, Type : none,
Condition :
Code: [Select]
thisOnActivation :
Code: [Select]
numofcivs = count thislist
Then create trigger2 covering the whole map, activated by civilians present, once, Type : End #1,
Condition :
Code: [Select]
count thislist == numofcivs - 15
The first trigger counts the number of civilians at the start and creates a variable called "numofcivs" that equals the initial amount of civilans on the map.

The second trigger..triggers when count of its list (the whole map of civilians) is equal to the "numofcivs" variable minus 15, meaning that 15 civilians have been killed. Although they could have died from anything, not only your guys shooting them.


Offline Wolfrug

  • Addons Depot
  • Former Staff
  • ****
  • Official OFPEC Old Timer
Re: Civilian Death counting trigger.
« Reply #7 on: 20 Feb 2009, 10:29:03 »
Problem is empty vehicles are also counted among civilians, so a civilian-counting trigger would, I think, also include all the abandoned (not destroyed) vehicles scattered around the map...

I might be mistaken however!

Wolfrug out.
"When 900 years YOU reach, look as good you will not!"

Offline Sparticus76

  • Members
  • *
Re: Civilian Death counting trigger.
« Reply #8 on: 20 Feb 2009, 11:12:22 »
I just tried it out and you are 100% correct there Wolfrug. Empty vehicles are counted as civilians.

Offline Worldeater

  • Former Staff
  • ****
  • Suum cuique
Re: Civilian Death counting trigger.
« Reply #9 on: 20 Feb 2009, 11:49:28 »
Another problem might be dead soldiers. IIRC they turn to civilians as well.
try { return true; } finally { return false; }

Offline Sparticus76

  • Members
  • *
Re: Civilian Death counting trigger.
« Reply #10 on: 21 Feb 2009, 00:50:38 »
I tested it with dead soldiers while I was testing the empty vehicle theory, but dead soldiers didn't effect the civilian count for some reason. Although if you use an "killed" event handler, and check the sides from the output of that event handler when you kill a guy, the killed guy is side civ...so I dunno why it's not counting dead dudes.