OFPEC Forum

Editors Depot - Mission Editing and Scripting => OFP - Editing/Scripting General => Topic started by: ONoSixIsDown on 14 Nov 2005, 21:26:14

Title: unit joins player once found
Post by: ONoSixIsDown on 14 Nov 2005, 21:26:14
im curently making a mission where the player is tasked with rounding up lost units.  

what i want to happen is make the unit joint the player's group when the player gets within a certain distance relative to the unit.

is there a way for this to happen using the "on activation"
field of a trigger? or do i need to have the trigger run a script.

something tells me there is a simpler way but i cant figure it out....

thanks a bunch

[edited]: i want to be able to do this with out using
way-points so i can have the lost soldier's position be random
Title: Re:unit joins player once found
Post by: Baddo on 14 Nov 2005, 21:36:29
To Condition field of trigger:

Code: [Select]
player distance lostGuy < 50
To On Activation field of the same trigger:

Code: [Select]
[lostGuy] join player
where lostGuy is the name you gave to the unit which must join the player's group when the player finds him.

Adjust the number 50 to whatever distance in meters you need.

Remember that you can have up to 12 members in your group. So make sure you have 'space' for all lost soldiers you want to join to your group.
Title: Re:unit joins player once found
Post by: ONoSixIsDown on 14 Nov 2005, 21:38:47
great! thanks a bunch! thats alot simpler than i thought it would be ;D
Title: Re:unit joins player once found
Post by: marcus3 on 14 Nov 2005, 21:38:56
ugh i was typing this!
Make a trigger, put in the on Codtion field.
Player distance (lost guys name) < 3

that means when the player is less then 3 meters from the lost guy the trigger will "pop", now in the ONoactiveon field put
[(lost guys name)] join player

make sure you put the guys name with [] on both sides. now to make this a little more real you might put after the join thing.
(lost guys name) sidechat "I am sure glad to see you sir!"
etc.
hope this helps.  :)
Title: Re:unit joins player once found
Post by: ONoSixIsDown on 14 Nov 2005, 21:50:40
thanks for the extra insight, Big Boss.. however, i tried putting in the side chat.  I got an error message.  could you please explain what is needed for a sidechat message to go off?

the error i got was that 1 elements were expected and 2 were provided....
Title: Re:unit joins player once found
Post by: Garcia on 14 Nov 2005, 22:14:42
Code: [Select]
[lostGuy] join player; lostguy sidechat "I am sure glad to see you sir!"
that should work, if you put it in the on activation field...
Title: Re:unit joins player once found
Post by: ONoSixIsDown on 14 Nov 2005, 22:19:24
it does, thanks all