OFPEC Forum

Editors Depot - Mission Editing and Scripting => OFP - Editing/Scripting General => Topic started by: Celeriac on 20 Aug 2004, 23:07:08

Title: execing thru trigger by anyone but only him
Post by: Celeriac on 20 Aug 2004, 23:07:08
Ey people.  ;)

I guess the topic reveals the most of my problem, which is as follows:
I want a trigger to be activated by anyone in a game that comes into its radius, and then making the man exec a script, but only him, not anyone else at that time. But I donÂ't know a way how to write it in OFP language. player exec "script.sqs" makes all players in a map to exec the script.

Any guidance, please?
Title: Re:execing thru trigger by anyone but only him
Post by: Raptorsaurus on 20 Aug 2004, 23:16:48
Make sure the trigger activation is only once (not repeatedly), then in the on activation field put:

thislist exec "script.sqs"

Then in your script make the first lines this:

_unitarray = _this

_unit = _unitarray select 0


.....rest of script is done by _unit


The reason for the _unitarray is because thislist is always an array even if it is only one unit.  The _unit = _unitarray select 0 converts that array into a singe unit, or the first unit if somehow more than one unit enters the trigger at the exact same time.

Hope this helps you.

Title: Re:execing thru trigger by anyone but only him
Post by: Celeriac on 21 Aug 2004, 00:16:05
I will beta test asap.  :)
Title: Re:execing thru trigger by anyone but only him
Post by: Celeriac on 22 Aug 2004, 14:57:02
It works! Thank you mate!  ;D

Now I can finish my deathmatch. (http://www.ofpec.com/yabbse/YaBBImages/smilies/cool2.gif)