Home   Help Search Login Register  

Author Topic: Elivator simulator  (Read 686 times)

0 Members and 1 Guest are viewing this topic.

Offline punisher

  • Members
  • *
Elivator simulator
« on: 15 Nov 2005, 21:09:49 »
How can i get a action to apear at the top of a building when you select an option to do so.
and then when you are at the top , selecting the action makes you apear at the botom.
So it basically simulates an elivator.

I was thinking putting objects at the botom and top of the building and adding actions to them, but i dont know what script or syntax to use.
thanks
The Gimp clan- pushing the limits of OFP
http://www.youtube.com/user/Pigdogmeat

Offline THobson

  • OFPEC Patron
  • Former Staff
  • ****
Re:Elivator simulator
« Reply #1 on: 15 Nov 2005, 21:42:03 »
Probably the simplest way is to do what you are thinking.  Put a Game Logic at the top and at the bottom of the building.  Call one of them GL_Bottom and the other GL_Top

then somewhere - in their init fields or in init.sqs put:

Code: [Select]
GL_Bottom addAction [{Teleport up},{Teleport.sqs}]
GL_Top addAction [{Teleport down},{Teleport.sqs}]
Teleport.sqs looks something like:

Code: [Select]
_obj = _this select 0
_man = _this select 1

if (_obj == GL_Bottom) then {_man setPos getPos GL_Top} else {_man setPos getPos GL_Bottom}
exit


Totally untested, but it might give you some ideas.

Offline Tyger

  • Former Staff
  • ****
  • I was at OFPEC when it still had dirt floors...
    • OFPEC
Re:Elivator simulator
« Reply #2 on: 15 Nov 2005, 21:49:55 »
_man cannot be _this select 1 in this case IIRC b/c you are not passing any parameters to the script.

Never mind, double checked in the comref:

_obj = _this select 0 (Object action was attached to)
_man = _this select 1 (Unit which activated it)
_index = _this select 2 (ID of action)

lets just say I learned something else today  ;D
« Last Edit: 16 Nov 2005, 21:49:23 by Tyger »
"People sleep soundly at night only because rough men stand ready to do violence on their behalf." - George Orwell

MSG Mike Everret - We Will Never Forget - '75-'08

Offline THobson

  • OFPEC Patron
  • Former Staff
  • ****
Re:Elivator simulator
« Reply #3 on: 15 Nov 2005, 22:00:38 »
 ;D ;D

Offline punisher

  • Members
  • *
Re:Elivator simulator
« Reply #4 on: 16 Nov 2005, 14:22:57 »
cheers thats just the ticket!
The Gimp clan- pushing the limits of OFP
http://www.youtube.com/user/Pigdogmeat