How to make triggered elevators/platforms
Hello XD when I was first starting platinum arts I had trouble finding good tutorials on making an elevator or platform entity move according to a switch. So I decided to make one my self
- First off the difference between elevators and platforms are, elevators move up and down and platforms move side to side - Both elevator and platform entities are controlled with the "platform X Y" command, where X is the trigger tag and Y is the trigger state. For the switch, you can use a variety of trigger types that will yield different results. A good reference to these would be http://sandboxgamemaker.com/platinumartssandboxeditref.html#_mapmodel_ - I use the switch mapmodel as an example but you can really use any mapmodel you want you can even trigger the platforms with keys, that when pick up (using trigger types 12 or 13) move the elevator or platform. - Trigger tag # are associated with level_trigger_#. I believe elevator and platform tags have nothing to do with the "level_trigger_#" and only apply to the "platform # [state#]" so you can have a switch with trigger tag 1 and also have a platform with tag 1, and the two will be unrelated. - Also I think platforms and elevators are not available in RPG mode. I'm doing this all in FPS mode, so if these examples don't work that might be why O__O - all codes are put into mapname.cfg
First example: a switch that can only be touched once will move an elevator you need: the switch mapmodel ( trigger tag 1, trigger type 9 ) an elevator entity ( tag 1 ) CODE: SELECT ALL
level_trigger_1 = [ platform 1 1 echo "the elevator rises" ]
This should make the elevator rise when the switch is touched for the first time, touching it again does nothing. The echo is just for fun XD. You can also make the elevator lower by replacing "platform 1 1" with "platform 1 -1". You can also make the platform rise and then stop by coding CODE: SELECT ALL
level_trigger_1 = [ platform 1 1 sleep 5000 [ platform 1 0 ] ]
The elevator will rise for 5000 milliseconds ( 5 seconds ) at whatever speed you gave and stop after touching the switch.
Second example: A switch that toggles moves an elevator up and down you need: a switch mapmodel ( trigger tag 2, trigger type 8 or 7 ) an elevator entity ( tag 2 ) CODE: SELECT ALL
level_trigger_2 = [ if (= $triggerstate 1) [ platform 2 1 echo "elevator rises" ] [ platform 2 -1 echo "elevator lowers" ] ]
A trigger type of 7 or 8 toggles between trigger states 0 and 1. When the switch is touched it toggles to trigger state 1 and rises the elevator according to the "if" statement. When the switch is touched again, it toggles to trigger state 0 and lowers the elevator. You can make the switch do a variety of things like rise and stop the elevator, just change the "platform X Y" command to whatever you see fit XD. It would be awesome if platinum arts had a switch that could toggle between 3 states so you could lower, rise and stop the elevator, but they don't as of 2.6.1 ( as far as I know anyway ) If you want instead of using the "$triggerstate" value that applies to the level_trigger_# entity you can use your own make up value for example CODE: SELECT ALL swt = 0
level_trigger_2 = [ if (= $swt 0) [ platform 2 1 echo "elevator rises" swt = 1 ] [ platform 2 -1 echo "elevator lowers" swt = 0 ] ]
the switch is still a trigger type of 8 or 7. The value "swt" was made up and can be anything like "Bac0n" or "cheese" just make sure whatever you put down stays consistent throughout the code.
I set up these codes so you can put both example 1 and 2 in the same map for testing and whatnot. I hope this tutorial helps, and if I'm wrong on any of this ,since I'm still learning myself, do tell me XD
Added by Chocolatepie33 on behalf of CyberxNeku, who made this tutorial.
Please note: Do not make a trigger to cause the elevator cable to snap and make the elevator free fall. There has been no reported elevator free fall related deaths.