Login x
User Name:
Password:
Social Links Facebook Twitter YouTube Steam RSS News Feeds

Members Online

»
0 Active | 11 Guests
Online:

LATEST FORUM THREADS

»
warfare
CoD4 Map + Mod Releases
Voting menu on maps
CoD+UO General
Hauling 911
CoDBO3 General

Forums

»

Welcome to the MODSonline.com forums. Looking for Frequently Asked Questions? Check out our FAQs section or search it out using the SEARCH link below. If you are new here, you may want to check out our rules and this great user's guide to the forums and the website.
For more mapping and modding information, see our Wiki: MODSonWiki.com

Jump To:
Forum: All Forums : Soldier of Fortune
Category: SoF Mapping
Mapping, modeling, scripting, skinning and all forms of editing for the game Soldier of Fortune, the original game.
Moderators: foyleman, Foxhound, Mystic, StrYdeR, batistablr, Welshy, DrBiggzz, supersword
Latest Posts
Subscribed Posts
Search
Restricted Access Topic is Locked subscribe
Author Topic: Scripting SoF Teleporter
SeTanTA
General Member
Since: Aug 25, 2004
Posts: 202
Last: Apr 7, 2008
[view latest posts]
Level 4
Category: SoF Mapping
Posted: Sunday, Oct. 15, 2006 08:14 pm
Scripting: Teleporter

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
Share |
Restricted Access Topic is Locked subscribe
MODSonline.com Forums : Soldier of Fortune : SoF Mapping

Latest Syndicated News

»
Codutility.com up and runn...
Nice, and there still using the logo and template for the screenshots, which...
Codutility.com up and runn...
dundy writes...Quote:Call of Duty modding and mapping is barly alive only a ...
Codutility.com up and runn...
Mystic writes...Quote:It seems to me the like the site is completely dead? ...
Codutility.com up and runn...
It seems to me the like the site is completely dead?

Partners & Friends

»