

![]() |
| Please help us to raise in the ranks of podcasting and subscribe to our itunes feed using the link above. |
|
Here is a quick and easy script to teleport the player to another location in your map.
For this example, in the map you will need a trigger_multiple pointing to a script runner that has a key of script and a value of tport/tporta
ie key=script value=tport/tporta You may want to adjust the delay or wait value for the trigger_multiple according to what is needed in the map You will need to put a folder called tport in your base/ds folder - we will save the script as tporta.ds and compile it into tporta.os and put it in the base/ds/tport folder later The main script command you need for the teleporter is... get entity activator This identifies the player who touched the trigger for your script and can be used for many other things in your scripts which I will go through in future tutorials So, let us begin our teleport script with the usual... #include "../common/header.ds" output "C:/sample/ds/test" We have to give the "activator" a name in the script - in this one I will call him "player1" So we need the following line in the script ... local entity player1 Now we tell the script who player1 is.... player1=get entity activator So the complete script so far is... -------------------------------------------------- #include "../common/header.ds" output "C:/sample/ds/test" local entity player1 player1=get entity activator -------------------------------------------------- Now we need a destination - using co-ordinates that can be found by moving your mouse to the location in Radiant or Quark Bear in mind that the player may arrive at the destination with his feet in the floor and will not be able to move - to prevent this, make the player appear 5 or 10 units above the floor at the destination (change the z value = the third number in the co-ordinates) Imagine that I have found the destination co-ordinates in my map and it is [128,450,32] The next line is simply... move entity player1 to [128,450,32] Now - if the teleport was to be used once, we would just write... exit But we almost certainly want to use the teleport many times in the map - for this we create a "loop" After the player has been teleported we need to stop the script but not exit it - for this we use the "suspend" command. The script will continue if it is triggered again (by another player touching the trigger_multiple) We now need to make the script return to the beginning - for this we need a "label" which we can call anything - I will call the label "xxx" and put it at the beginning of the script - it needs to be placed before the "player1=get entity activator" so that any player who touches the trigger will also be identified as the "activator" To go to the label I would simply write ... goto xxx So, now our complete script looks like this.... ---------------------------------------------------- #include "../common/header.ds" output "C:/sample/ds/test" local entity player1 label xxx player1=get entity activator move entity player1 to [128,450,32] suspend goto xxx ------------------------------------------------------ That's it! Note the "suspend", "label" and "goto" commands - we will be using them in many future scripts together with the "get entity activator" command Only one problem may arise with a teleporter - possibly a player will be standing at the destination when the other player appears in the same place - to prevent this you need to put a "push" brush at the destination - give it a low value of say....10 When the player arrives at the destination he will also be pushed out of the way in case there is a player immediately behind him who would also use the teleporter - You may not wish this push brush to be "on" all the time - in future tutorials I will explain how you can switch off the push brush and also switch other triggers on and off in your map using a script It is also possible, if necessary, to change the direction a player is facing when he appears at the destination For the best example of a teleporter with push brush see RDAM_Missile_Base map Hope this helps... Demise RDAM |
Latest MODSonline Poll
MODSonline Teamspeak
Partners of MODSonline
Friends of MODSonline
|