OFPEC Forum

Editors Depot - Mission Editing and Scripting => OFP - Editing/Scripting General => Topic started by: THobson on 26 May 2005, 18:15:05

Title: SetPos a trigger to the surface of the earth
Post by: THobson on 26 May 2005, 18:15:05
I have a trigger that is generating some environmental sounds.  All is fine if the trigger stays where it is, but I want to setPos it about to different locations.

SetPos ing a trigger seems to put it at sea level even if I do a
Code: [Select]
trigName setPos [getPos (object _obj) select 0,getPos (object _obj) select 1,0]
 
A subsequent getPos reveals the trigger to be at -330 or so.  The worms at that depth may then be able hear my sounds, but the player on the surface can't.

Does anybody have a solution?

Title: Re:SetPos a trigger to the surface of the earth
Post by: ACF on 26 May 2005, 18:33:41
If you can get the 'depth' as a value, can't you just change the sign and use it as a positive z component?  The SetPos would be in three stages - SetPos to new [x,y,0] coordinates; calculate depth z from GetPos; SetPos to new [x,y,-z].

I think the logic's right...
Title: Re:SetPos a trigger to the surface of the earth
Post by: macguba on 26 May 2005, 18:40:08
Yes, but setPos works off ground level, not sea level.    So he is already setpossing to the right place.   It's just not going there.

I think I have heard of something like this before.  Triggers are placed at ground level but when you start messing them around they go to sea level in at least some respects.  
Title: Re:SetPos a trigger to the surface of the earth
Post by: General Barron on 26 May 2005, 21:29:22
Maybe try using one of the sound "objects" that appear under the "empty" side? They might behave normally when setpossing them.
Title: Re:SetPos a trigger to the surface of the earth
Post by: THobson on 26 May 2005, 22:22:46
That is where I started.  The sound objects can't be setPosed (nor can they be created) unfortunately.

Thanks again
Title: Re:SetPos a trigger to the surface of the earth
Post by: UNN on 27 May 2005, 01:49:03
Try using the same method Vektorbosons used for his height above seal level function:

Code: [Select]
Trigger01 SetPos [XPos,YPos,0]
Trigger01 SetPos [XPos,YPos,Abs((GetPos Trigger01) Select 2)]
Title: Re:SetPos a trigger to the surface of the earth
Post by: THobson on 27 May 2005, 07:34:33
That seeme to be the answer.  Thank you.  When testing this I found a strange thing.  If I use:

Code: [Select]
trig1 setpos getpos player
trig2 setPos [getpos trig1 select 0,getpos trig1 select 1,abs(getpos trig1 select 2)]
then trig2 ends up at height 0 (ie on the surface)

but if instead of the player I use an object:

Code: [Select]
trig1 setpos getpos (object 2884)as the first line  then trig2 ends up at -4.97

So I got the location of object 2884 and found it was at +4.97.  Something wierd is happening - but what I now have will do for me.  

Thanks again.  Yesterday was not a good day - I can already see today will be different. :)