OFPEC Forum

Editors Depot - Mission Editing and Scripting => ArmA - Editing/Scripting General => Topic started by: Trash Can Man on 03 Jun 2007, 20:51:45

Title: who killed who???
Post by: Trash Can Man on 03 Jun 2007, 20:51:45
I am makinga mission that involves terrorist activity. What I want to do is come up with some way to differentiate between the terrorist killing civilians or Blufors killing them. If the Blufor kills a civilian, then the mission ends in failure. Vice Versa if the terrorist kills a civilian, the mission continues. Can this be done first of all. If so, how?!?!?!  ???

TCM
Title: Re: who killed who???
Post by: johnnyboy on 04 Jun 2007, 00:15:17
You need to put killed eventhandlers on the civilians.  The killed evenHandler returns the victim and the killer.  For a group of civilians, put this code in the group leader's init field:

Code: [Select]
{_x addEventHandler ["killed",{_this exec "civKill.sqs"}]} foreach units group this;
civKill.sqs would be your script where you would put the code to see who killed the civilian.  The first two lines of your civKill.sqs should be:

Code: [Select]
_victim = _this select 0;
_killer = _this select 1;

Now the script knows who the victim was and who the killer was.  You can now add code to test if the _killer is Blufor and end the mission.

Learn more about eventhandlers on the BIKI: 

http://community.bistudio.com/wiki/addEventHandler
Title: Re: who killed who???
Post by: Trash Can Man on 04 Jun 2007, 05:06:11
  ???  ???  ??? Well, I understand everything that goes in the init field, but you lost me after that!


TCM
Title: Re: who killed who???
Post by: bedges on 04 Jun 2007, 09:30:25
alternatively learn even more about event handlers (http://www.ofpec.com/ed_depot/admin_list2.php?type=tu&cat=sc) on our very own site - explains it a bit better.
Title: Re: who killed who???
Post by: LCD on 04 Jun 2007, 18:36:17
4 every civi put dis line in da init line

Code: [Select]
this addEventHandler ["killed",{_this exec "civKill.sqs"}]
now u got a script civkill.sqs

Code: [Select]
_killer = _this select 1;

? side _killer == west : blokill = true

exit

now use da blokill in da condition line 4 nything u wanna happen wen west ppl kill civies

also dont forget 2 rite
Code: [Select]
blokill = false in da players init line or somin like dat

LCD OUT