OFPEC Forum
Editors Depot - Mission Editing and Scripting => OFP - Editing/Scripting General => Topic started by: punisher 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
-
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:
GL_Bottom addAction [{Teleport up},{Teleport.sqs}]
GL_Top addAction [{Teleport down},{Teleport.sqs}]Teleport.sqs looks something like:
_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.
-
_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
-
;D ;D
-
cheers thats just the ticket!