Hi! Welcome to the forum for Platinum Arts Sandbox Free 3D Game Maker. I currently have the forums locked as I am attempting to properly update them.

In the meantime please join the new Discord Server!

If you have any questions please e-mail me through the Platinum Arts website.

Switches controlling Elevators and Platforms

Learn more on how to use Sandbox, or submit your own tutorials or resources.
Post Reply
User avatar
CyberxNeku
Member
Member
Posts: 10
Joined: March 24th, 2011, 3:28 pm
Name: Raaaawr!

Switches controlling Elevators and Platforms

Post by CyberxNeku »

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 :mrgreen:

- 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 controled 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 yeild drifferent results. A good reference to these would be http://sandboxgamemaker.com/platinumart ... _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 platfom.
- 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 triger tag 1 and also have a platform with tag 1, and the two will be unrelated.
- Also i think platforms and elevators are not availible 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 sould 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 miliseconds ( 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 awsome 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 throught 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 im wrong on any of this ,since im still learning myself, do tell me XD
Last edited by CyberxNeku on March 25th, 2011, 2:32 pm, edited 2 times in total.
User avatar
Runescapedj
Member
Member
Posts: 1706
Joined: January 9th, 2010, 9:06 am
Name: Michiel
IRC Username: Sandboxdj
Location: Deventer, the Netherlands

Re: Switches controling Elevators and Platforms

Post by Runescapedj »

Looks good, maybe you can add it to the wiki?
http://sandboxgamemaker.com/wiki/index. ... =Main_Page
User avatar
CyberxNeku
Member
Member
Posts: 10
Joined: March 24th, 2011, 3:28 pm
Name: Raaaawr!

Re: Switches controlling Elevators and Platforms

Post by CyberxNeku »

thanks but I don't think I have rights to, let alone permission XD the license doesn't allow edits by everyone o.o but I don't really know much about that stuff anyway :P
chocolatepie33
Support Team
Support Team
Posts: 2458
Joined: April 27th, 2010, 5:31 pm
IRC Username: CP

Re: Switches controlling Elevators and Platforms

Post by chocolatepie33 »

just go ahead and add it. Or do you want someone else to do it for you?
Julius wrote:Contribute to http://www.opengameart.org NOW!
Save the wiki!
User avatar
CyberxNeku
Member
Member
Posts: 10
Joined: March 24th, 2011, 3:28 pm
Name: Raaaawr!

Re: Switches controlling Elevators and Platforms

Post by CyberxNeku »

Maybe someone else should do it, I tried editing in tutorials on a page that matched my tut but i wasn't allowed. Maybe im just doing it wrong, I never really done something like that before XD I know im a noob
chocolatepie33
Support Team
Support Team
Posts: 2458
Joined: April 27th, 2010, 5:31 pm
IRC Username: CP

Re: Switches controlling Elevators and Platforms

Post by chocolatepie33 »

I'll do it, then... And fix a couple of errors (spelling)

EDIT: here it is: http://sandboxgamemaker.com/wiki/index. ... /platforms
Julius wrote:Contribute to http://www.opengameart.org NOW!
Save the wiki!
User avatar
CyberxNeku
Member
Member
Posts: 10
Joined: March 24th, 2011, 3:28 pm
Name: Raaaawr!

Re: Switches controlling Elevators and Platforms

Post by CyberxNeku »

Thanks for doing that XD I know I'm not the greatest in spelling :P
chocolatepie33
Support Team
Support Team
Posts: 2458
Joined: April 27th, 2010, 5:31 pm
IRC Username: CP

Re: Switches controlling Elevators and Platforms

Post by chocolatepie33 »

Yeah, don't worry, we all do that occasionally.

You're welcome.
Julius wrote:Contribute to http://www.opengameart.org NOW!
Save the wiki!
Post Reply