Home   Help Search Login Register  

Author Topic: who killed who???  (Read 1257 times)

0 Members and 1 Guest are viewing this topic.

Offline Trash Can Man

  • Members
  • *
  • We are no longer the knights who say "Ni!"
who killed who???
« 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

Offline johnnyboy

  • OFPEC Patron
  • ****
  • Matan los Pantalones!!!
Re: who killed who???
« Reply #1 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
« Last Edit: 04 Jun 2007, 00:18:47 by johnnyboy »
El Cojon: "Do you like to Tango?"
You: "Only in Bagango."
Download Last Tango in Bagango and discover how El Cojon earned his name...

Offline Trash Can Man

  • Members
  • *
  • We are no longer the knights who say "Ni!"
Re: who killed who???
« Reply #2 on: 04 Jun 2007, 05:06:11 »
  ???  ???  ??? Well, I understand everything that goes in the init field, but you lost me after that!


TCM

Offline bedges

  • Administrator
  • *****
    • OFPEC The Editing Center
Re: who killed who???
« Reply #3 on: 04 Jun 2007, 09:30:25 »
alternatively learn even more about event handlers on our very own site - explains it a bit better.

Offline LCD

  • Former Staff
  • ****
    • Everon Cartel
Re: who killed who???
« Reply #4 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

"guess being the community has downsides .." - cheetah
Help Perfecting Da Next Best Thing - O-Team Beta