Home   Help Search Login Register  

Author Topic: setpos getpos problem.  (Read 1275 times)

0 Members and 1 Guest are viewing this topic.

Offline Yasirotta

  • Members
  • *
setpos getpos problem.
« on: 04 Jul 2008, 16:51:25 »
I have problem using this setpos&getpos command. Idea is, to use 2 triggers in same place, but diffrent times. Easiest way is to move another trigger in that place, when all previous missions are done. When all are done, i use this code:

Trigger2 setpos (getpos ContactGuy)

Everything is else working, but not this line. Feels like trigger isn't moving at all. Is it written ok and can that used in another triggers "On activition" line ?

Offline THobson

  • OFPEC Patron
  • Former Staff
  • ****
Re: setpos getpos problem.
« Reply #1 on: 04 Jul 2008, 17:27:25 »
Have you taken account of the fact that in OFP when a trigger is moved with a setPos it is moved to sea level and not to ground level?

Offline Yasirotta

  • Members
  • *
Re: setpos getpos problem.
« Reply #2 on: 04 Jul 2008, 18:39:21 »
Ofcourse i put that trigger into sea  :whistle:

Well, sometimes even simply things comes tricky. So, if i put trigger on land it should be ok ?

Offline THobson

  • OFPEC Patron
  • Former Staff
  • ****
Re: setpos getpos problem.
« Reply #3 on: 05 Jul 2008, 02:36:24 »
It depends on what the trigger does as to whether it is important how high it is.  If it is to detect the presence of a unit in the normal way then the height doesn't matter (unless you have some distance command in the condition field), if it is to be the source of a sound or explosion then if that is at sea level it may be to far away to be heared (if it is a sound) or to do any damage (if it is an explosion). 

If you want to move a trigger to ground level in ofp you need to do something like:

Code: [Select]
Trigger2 setpos getpos ContactGuy
Trigger2 setPos [getPos Trigger2 select 0,getPos Trigger2 select 1,-getPos Trigger2 select 2]
The first line moves the trigger to the position of ContactGuy, but at sea level.
The second line lifts the trigger to ground level.
« Last Edit: 05 Jul 2008, 03:01:04 by THobson »

Offline Yasirotta

  • Members
  • *
Re: setpos getpos problem.
« Reply #4 on: 07 Jul 2008, 14:45:47 »
Umm... I get this error:

-: Type Array, exepted Number

News: Tryed to remove that - from -getpos. Error gone but still not working
« Last Edit: 07 Jul 2008, 16:15:32 by Yasirotta »

Offline THobson

  • OFPEC Patron
  • Former Staff
  • ****
Re: setpos getpos problem.
« Reply #5 on: 07 Jul 2008, 19:19:14 »
Instead of removing the - (which is essential to move the trigger up to ground level) try:
.....-(getPos Trigger2 select 2)]

EDIT:

The above should work but I have also checked some old code of mine.  Try this:
Code: [Select]
Trigger2 setpos getpos ContactGuy
Trigger2 setPos [getPos Trigger2 select 0,getPos Trigger2 select 1,abs(getPos Trigger2 select 2)]





« Last Edit: 07 Jul 2008, 19:38:25 by THobson »