OFPEC Forum

Editors Depot - Mission Editing and Scripting => OFP - Editing/Scripting General => Topic started by: marcus3 on 15 Dec 2005, 18:47:12

Title: Who did it?
Post by: marcus3 on 15 Dec 2005, 18:47:12
i need a some code the check if the player killed a certan unit...more of a script that u would put in the init line..so u dont have to name everysingle unit :)
so help would be helpfull :D
thanks
Title: Re:Who did it?
Post by: 456820 on 15 Dec 2005, 18:51:22
like this with a Killed EH

put this in the init line of the soldier you want to check who died
Code: [Select]
this AddEventHandler ["fired",{_this exec "check.sqs"}]
create check.sqs
and put this in it

Code: [Select]
_this select 0 : _deadguy
_this select 1 : _who

? _who == player : exit

#rest of script from below here

i beleive thats how it would be done
Check out the Event Handler tutorial here (http://www.ofpec.com/editors/browse.php?browseon=&browsewhat=-1&catselected=-1_-1&catagory=-1&subcategory=-1_-1&numreturn=25&displayformat=0&ofpv=1&searchwhat=1&searchlevel=0&searchwhat=1&searchopts=&searchstring=event)

Read that tut it also gives many cool things to add to missions

hope any of this helps
Title: Re:Who did it?
Post by: macguba on 15 Dec 2005, 19:03:48
Give the loon an eventhandler "killed".     If he is killed the script launched by the EH checks whether his killer was the player and enacts consequences accordingly.
Title: Re:Who did it?
Post by: marcus3 on 15 Dec 2005, 19:21:55
Nvm i miss'd typ'd :)
thanks guys
#solve
Title: Re:Who did it?
Post by: macguba on 15 Dec 2005, 19:27:14
It does work, you've just done something silly.    ;D  You're giving the game an object (like a unit) when its expecting an array.    We really need more detail before we can help you, but its the kind situation where, in extracting that information, you'll probably find the mistake yourself anyway.


Edit:  See!  ;D