Jump to content
Sign in to follow this  
uiox

Problem with command "distance"

Recommended Posts

With 1.75 I have problem with the command distance

With this

_Dist = unit1 distance unit2

'_Dist = unit1 I#Idistance unit2': Error unknown operator distance

Share this post


Link to post
Share on other sites

I heard of a similar problem; that guy has used distance as a variable, and then he tried to use it as a function and since resistance there is an automatic variable/function detection to keep old missions playable that use variable names that are reserved for Resi functions.

Perhaps you did in your code somewhere by accident

distance = 50

or

?distance = 50: blabla

And therefore used distance as a variable!

Share this post


Link to post
Share on other sites

Again this is more a ME question smile.gif

Moving to ME.

Share this post


Link to post
Share on other sites

Thanks BigPoppa, I'm sure you're right, because if it's OFP bug...

Share this post


Link to post
Share on other sites

</span><table border="0" align="center" width="95%" cellpadding="3" cellspacing="1"><tr><td>Quote (bigpoppa @ Oct. 08 2002,11:59)</td></tr><tr><td id="QUOTE">I heard of a similar problem; that guy has used distance as a variable, and then he tried to use it as a function and since resistance there is an automatic variable/function detection to keep old missions playable that use variable names that are reserved for Resi functions.

Perhaps you did in your code somewhere by accident

distance = 50

or

?distance = 50: blabla

And therefore used distance as a variable!<span id='postcolor'>

dozingoff.gif

Share this post


Link to post
Share on other sites

biggrin.gif

It's not English Gameer77, it's EnglishOFP...

So, le Français que je suis, has understand and solve his problem.

wink.gif

Share this post


Link to post
Share on other sites

</span><table border="0" align="center" width="95%" cellpadding="3" cellspacing="1"><tr><td>Quote (uiox @ Oct. 09 2002,09:29)</td></tr><tr><td id="QUOTE">biggrin.gif

It's not English Gameer77, it's EnglishOFP...

So, le Français que je suis, has understand and solve his problem.

wink.gif<span id='postcolor'>

I think that Gameer knows about the distance-problem tounge.gif

Share this post


Link to post
Share on other sites

Also be aware that (from my experiments) the distance command rounds off numbers owing to float resolution. Not good for accurate absolute height determination.

My way of getting absolute height of an object goes a little like this:

Make a trigger - let's call it mytrigger.

Use a getPos on the object in question and store the values as _x, _y and _z. Then:

mytrigger setPos [_x, _y, 0]

_height = _z - (getPos mytrigger select 2)

Suma - I'd say adding a function for absolute height would be number one on my list of fantasy functions.

Edit: I should probably make clear that this method (which I believe is original) is superior because:

1) It also allows you to extract the height of the ground below the object directly = -(getPos mytrigger select 2)

2) It solves the resolution problem.

Prospero

Share this post


Link to post
Share on other sites

It is probably also worth pointing out that this method can be extended to setting an object into the world at an absolute height.

Let us say that you wish to set the object (which we will call myobject) into the OFP world at an east/west value of _x and a north/south value of _y, and with an absolute height of _z.

You must first find the height of the ground at that particular location (in terms of _x and _y). So you do this:

mytrigger setPos [_x, _y, 0]

_heightofground = -(getPos mytrigger select 2)

You then do the following:

myobject setPos [_x, _y, (_z - _heightofground)]

You can of course reduce this process by substitution to:

mytrigger setPos [_x, _y, 0]

myobject setPos [_x, _y, (_z + (getPos mytrigger select 2))]

Prospero

Share this post


Link to post
Share on other sites

hmm I used

</span><table border="0" align="center" width="95%" cellpadding="3" cellspacing="1"><tr><td>Code Sample </td></tr><tr><td id="CODE">

_Dist = unit1 distance unit2

hint format ["%1", _Dist]

Also I used:

_Dist = (unit1 distance unit2)

hint format ["%1", _Dist]

<span id='postcolor'>

I didn't get any errors from either of them?

RED

Share this post


Link to post
Share on other sites

</span><table border="0" align="center" width="95%" cellpadding="3" cellspacing="1"><tr><td>Quote (bigpoppa @ Oct. 09 2002,09:59)</td></tr><tr><td id="QUOTE"></span><table border="0" align="center" width="95%" cellpadding="3" cellspacing="1"><tr><td>Quote (uiox @ Oct. 09 2002,09:29)</td></tr><tr><td id="QUOTE">biggrin.gif

It's not English Gameer77, it's EnglishOFP...

So, le Français que je suis, has understand and solve his problem.

wink.gif<span id='postcolor'>

I think that Gameer knows about the distance-problem  tounge.gif<span id='postcolor'>

Damn right! hotb.gifsneaky2.gifwithstupid.gif

peace.gifPEACE

Share this post


Link to post
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
Sign in to follow this  

×