OFPEC Forum

Editors Depot - Mission Editing and Scripting => OFP - Editing/Scripting General => Topic started by: greg147 on 27 Mar 2005, 18:06:28

Title: Getting close to a pre-placed object
Post by: greg147 on 27 Mar 2005, 18:06:28
Hi all,

I'm trying to make a script that adds an action when you get close to an object pre-placed on the map (like a house). I know how to add the action, but its the other bit i'm stuck on.  ???

In the comref, it says this:

Code: [Select]
Command :
Distance
 
Description :
Used to find the distance between 2 units/objects.
 
Syntax :
Name1 Distance Name2

Name1 is the name of a unit or object.
Name2 is the name of a second unit or object
 
Returns :
Distance in meters between Name1 and Name2.
 
Example:
?(MyGuy Distance MyLeader > 300):MyLeader SideChat "Get over here!"
 

But that doesn't say what to do if you want Name1 to be the player, and Name2 to be one of the pre-placed objects.

I tried:

?(Guy1 Distance Object 25344 > 50):Guy1 sidechat "bah"

But it didn't work.
Was I on the right lines, or is it something completely different?  :P

Thanks.
Title: Re:Getting close to a pre-placed object
Post by: macguba on 27 Mar 2005, 18:08:43
Add the Action to the object.   It will appear in the player's Action menu automatically when he gets close enough.

Distance is a funny command:  it works only with certain things.   (For example, not markers.)  Make it work with two loons before trying it on preplaced objects.
Title: Re:Getting close to a pre-placed object
Post by: greg147 on 27 Mar 2005, 19:36:52
Thanks. I am such a dumbass. I completely forgot that you just put the trigger on the object with a small radius to make it work.  ::)


Anyway, on the same script, I have another question.  ;)

What is the name of the sound 'Explosion Large'?
So, in my script I have 'playsound xxxxxxxx', and it will make the explosion sound you can activate normally by triggers.

Thanks  ;)