OFPEC Forum

Editors Depot - Mission Editing and Scripting => ArmA - Editing/Scripting Multiplayer => Topic started by: sharkattack on 02 Mar 2008, 17:29:37

Title: problem with trigger activations
Post by: sharkattack on 02 Mar 2008, 17:29:37
hi
been playing with hoz s dofollowunit script .. an excellent script which does away with ai having to join the player group ..

im stuck trying to figure out how to call the script on the person who activates the trigger..
how could i get the name of the player so i could change the way the script is called
at the min i have it  fired  with this command
dummy = [hostage,leader_1] execVM DoFollowUnit.sqf

problem is if leader_6 finds the hostage id like him to follow leader_6

many thanx in advancve   :)
great script ...

Title: Re: problem with trigger activations
Post by: Spooner on 02 Mar 2008, 17:32:32
How about trying to get the hostage to follow the leader of whoever triggers the trigger?
Code: [Select]
dummy = [hostage, leader (thisList select 0)] execVM "DoFollowUnit.sqf";
Title: Re: problem with trigger activations
Post by: sharkattack on 03 Mar 2008, 15:50:11
thanks mate
 :good:
Title: Re: problem with trigger activations
Post by: sharkattack on 04 Mar 2008, 11:12:27
A new problem with triggers

how could i set up a trigger which is fired by any group memeber (team1)
coming within a certain distance from an objective .
i can do it with a single named unit

condition
soldier1  distance objective  < 5

how could i fire the trigger  if any member of team 1 is less than 5 meters from objective

thanks   :)
Title: Re: problem with trigger activations
Post by: Spooner on 04 Mar 2008, 11:24:28
Well, I'm assuming the objective moves, otherwise a normal area trigger would make more sense. Assuming team1 has been set to the group we are talking about (e.g. by "team1 = group this" in init line):
Code: (condition: Any living member of team1 is within range) [Select]
({ (alive _x) and ((_x distance objective) < 5) } count (units team1)) > 0

If the objective is stationary, the simple way is to synchronise the group with an area trigger so that only that group will cause the trigger to activate.
Title: Re: problem with trigger activations
Post by: sharkattack on 04 Mar 2008, 11:45:10
the objective is stationary in this case.

i group the trigger to team one
and set activation to any group memeber present
 
how do i include the distance from objective  to the condition of the trigger

edit
====

got it mate .. i put the above code in the grouped trigger and it works a treat ... many thanx




Title: Re: problem with trigger activations
Post by: Spooner on 04 Mar 2008, 11:50:39
But you don't need to use the distance, since the trigger area implies a distance. Either that or I'm misunderstanding what you need.
Title: Re: problem with trigger activations
Post by: sharkattack on 04 Mar 2008, 11:54:33
the objective is an ammo crate inside a building .. getting it to fire is a bit unreliable using the trigger size .. sometimes the objective is ticked before the player can even see the crate ..

the above code seems to be a bit more accurate  :)
Title: Re: problem with trigger activations
Post by: Spooner on 04 Mar 2008, 12:00:47
Well, the code I gave above should be fine then.
Title: Re: problem with trigger activations
Post by: sharkattack on 06 Mar 2008, 13:17:01
it is mate ... works a treat

many thanx
Title: Re: problem with trigger activations
Post by: Nixer6 on 06 Mar 2008, 15:44:55
Thanks here too Spooner.

That little snippet helped me solve a little headache I was dealing with.  :good: