Author Topic: Adding a Randomised/Area Teleport  (Read 3680 times)

0 Members and 1 Guest are viewing this topic.

Waffles

  • Full Member
  • ***
  • Posts: 127
Adding a Randomised/Area Teleport
« on: August 11, 2010, 05:04:17 PM »
Adding a Randomised Teleport

This tutorial will show you how to add a randomised teleport.

Step 1:

1. Make a "trigger_use_touch" and give it the KVPs of:
Code: [Select]
targetname | area_teleport
script_int | 1000
script_float | 10
script_noteworthy | buyable

   
2. script_noteworthy must be set to either "buyable" or "free". If it is set to "buyable", then script_int must also be set, as it controls the price. script_float controls the usage delay between teleports. If script_notewothy is set to "free", then no cost will be shown in the hintstring.

3. Make a "script_origin" and give it the KVP of:
Code: [Select]
targetname | spot
   
4. Now copy and paste the "script_origin" to the spots which you want to be picked as a teleport location
5. Select the "trigger_use_touch" and give it the KVP of:
Code: [Select]
target | spot
   
6. All the "script_origin" entities should connect to the "trigger_use_touch".

Step 2:

Add this line to your mp_mapname.gsc:
Code: [Select]

thread maps\mp\_areateleport.gsc


In this directory: Drive Letter:\Program Files\Activision\Call of Duty - World at War\raw\maps\mp, make a file called _areateleport.gsc and copy this script into it:

Code: [Select]

main()
{
areaTeleport = getEntArray( "area_teleport", "targetname" );
for( i = 0; i < areaTeleport.size; i++ )
areaTeleport[i] thread MonitorTeleport();
}

MonitorTeleport()
{
level endon( "game_ended" );

self.isUsed = false;
self setCursorHint( "HINT_NOICON" );

if( isDefined( self.script_noteworthy ) )
{
if( self.script_noteworthy == "buyable" && isDefined( self.script_string ) && isDefined( self.script_int ) )
self setHintString( self.script_string + " ^3[^1" + self.script_int + "^3]" );

if( self.script_noteworthy == "free" && isDefined( self.script_string ) )
self setHintString( self.script_string );
}

while(1)
{
self waittill( "trigger", player );

if( isPlayer( player ) && isAlive( player ) && !isAi( player ) )
{
if( isDefined( self.script_noteworthy ) )
{
if( self.script_noteworthy == "buyable" )
{
if( !isDefined( self.script_int ) )
{
assertMsg( "trigger needs KVP of script_int to be set!" );
return;
}

if( isDefined( self.script_string ) )
self setHintString( self.script_string + " ^3[^1" + self.script_int + "^3]" );

if( isDefined( player.score ) && player.score >= self.script_int && !self.isUsed )
{
self.isUsed = true;
self setHintString( "" );

player.score -= self.script_int;

if( player.score < 0 )
player.score = 0;

player startTeleport( self );
}
}
else if( self.script_noteworthy == "free" )
{
if( isDefined( self.script_string ) )
self setHintString( self.script_string );

player startTeleport( self );
}
else
{
assertMsg( "script_noteworthy is set incorrectly! Use either buyable or free as the string" );
return;
}
}
else
{
assertMsg( "script_noteworthy is not set! Use either buyable or free as the string" );
self setHintString( "" );
return;
}
}
}
}

startTeleport( trigger )
{
teleportSpots = getEntArray( trigger.target, "targetname" );

if( isDefined( teleportSpots ) )
{
newSpot = teleportSpots[RandomInt(teleportSpots.size)];
self setOrigin( newSpot.origin );
}
else
{
assertMsg( "No teleport spots defined. Connect the trigger to atleast one script_origin" );
trigger Delete();
}

if( !isDefined( trigger.script_float ) )
trigger.script_float = 10;

wait( trigger.script_float );
trigger.isUsed = false;

if( trigger.script_noteworthy == "buyable" )
trigger setHintString( trigger.script_string + " ^3[^1" + trigger.script_int + "^3]" );
else if( trigger.script_noteworthy == "free" )
trigger setHintString( trigger.script_string );
}


Step 3:

In your mp_mapname.csv, add this line:

Code: [Select]
rawfile,maps\mp\_areateleport.gsc

Now you should have teleport triggers in your map which allow you to teleport to multiple places.

King_Paradox

  • ʕ•ᴥ•ʔ O hai der
  • Retired zombieX Admin
  • Elite member
  • ******
  • Posts: 4,711
  • O hai der.
Re: Adding a Randomised/Area Teleport
« Reply #1 on: September 11, 2010, 10:49:04 AM »
*SOLVED*

Fixes:

.CSV Should be:  rawfile,maps/mp/_areateleport.gsc

.GSC Should be: maps\mp\_areateleport();

Regards.
« Last Edit: July 19, 2011, 03:59:50 PM by King_Paradox »

^PoW^|ReichToffen

  • Jr. Member
  • **
  • Posts: 74
Re: Adding a Randomised/Area Teleport
« Reply #2 on: December 03, 2011, 12:12:34 AM »
my .gsc wont have it for some reason i get compile complete and when i load i get bad syntax maps\mp\_areateleport();

Doom-Priest

  • Moderators & Server admins
  • Elite member
  • ********
  • Posts: 2,983
Re: Adding a Randomised/Area Teleport
« Reply #3 on: December 03, 2011, 12:31:05 AM »
Try:

Code: [Select]
maps\mp\_areateleport::main();

Or else is the bad syntax IN the _areateleport.gsc?

I can remember one of waffles scripts bugging me, but idk which one it was.

Edit: Screenshot it next time with console open. (shift + ~)

^PoW^|ReichToffen

  • Jr. Member
  • **
  • Posts: 74
Re: Adding a Randomised/Area Teleport
« Reply #4 on: December 03, 2011, 05:24:27 AM »
When i try on ZomX mod exceed limit (400) fx or something like that

^PoW^|ReichToffen

  • Jr. Member
  • **
  • Posts: 74
Re: Adding a Randomised/Area Teleport
« Reply #5 on: December 03, 2011, 05:43:08 AM »
Fixed but how do i get it to say something when i go to use it
amd how do i make it free for zombies
« Last Edit: December 03, 2011, 06:52:11 AM by ^PoW^|ReichToffen »

King_Paradox

  • ʕ•ᴥ•ʔ O hai der
  • Retired zombieX Admin
  • Elite member
  • ******
  • Posts: 4,711
  • O hai der.
Re: Adding a Randomised/Area Teleport
« Reply #6 on: December 03, 2011, 10:10:13 AM »
Select the trigger and open up the entity (press N).
Key: hintstring
Value: whatever you want
You can also use colours for the Value, so if you want Red Text, use ^1Teleport :)
You can use more than one colour.
Don't know how to make it free for zombies, my scripting skills are basic :o

Regards. Good Luck.

Doom-Priest

  • Moderators & Server admins
  • Elite member
  • ********
  • Posts: 2,983
Re: Adding a Randomised/Area Teleport
« Reply #7 on: December 03, 2011, 10:57:57 AM »
Select trigger.
Set
Code: [Select]
script_noteworthy | buyable
To
Code: [Select]
script_noteworthy | free

Its just saying that in the tutorial ._.

^PoW^|ReichToffen

  • Jr. Member
  • **
  • Posts: 74
Re: Adding a Randomised/Area Teleport
« Reply #8 on: December 03, 2011, 11:03:11 AM »
Quote from: Doom-Priest;56755
Select trigger.
Set
Code: [Select]
script_noteworthy | buyableTo
Code: [Select]
script_noteworthy | free
Its just saying that in the tutorial ._.


Free 4 zombies but buyable 4 hunters
« Last Edit: December 03, 2011, 11:15:12 AM by ^PoW^|ReichToffen »

^PoW^|ReichToffen

  • Jr. Member
  • **
  • Posts: 74
Re: Adding a Randomised/Area Teleport
« Reply #9 on: December 03, 2011, 11:25:28 AM »
Exceed limit 400 fx ~!!!!!!!!!! RAWR

Doom-Priest

  • Moderators & Server admins
  • Elite member
  • ********
  • Posts: 2,983
Re: Adding a Randomised/Area Teleport
« Reply #10 on: December 03, 2011, 11:43:04 AM »
Quote from: ^PoW^|ReichToffen;56757
Free 4 zombies but buyable 4 hunters


It should make it free for hunters too :/

400FX limit: http://wiki.modsrepository.com/index.php/Call_of_Duty_5:_Fixing_Exceeded_400Fxs_assets

Remove a line from csv.

Edit: for the teleport set the amount of cash needed to 0 too.

^PoW^|ReichToffen

  • Jr. Member
  • **
  • Posts: 74
Re: Adding a Randomised/Area Teleport
« Reply #11 on: December 04, 2011, 12:03:19 AM »
Quote from: Doom-Priest;56762
It should make it free for hunters too :/

400FX limit: http://wiki.modsrepository.com/index.php/Call_of_Duty_5:_Fixing_Exceeded_400Fxs_assets

Remove a line from csv.

Edit: for the teleport set the amount of cash needed to 0 too.


No i mean it needs to be free for zombies but not for free for hunters

McKay

  • Sup
  • Retired zombieX Admin
  • Elite member
  • ******
  • Posts: 1,215
Re: Adding a Randomised/Area Teleport
« Reply #12 on: February 26, 2012, 01:18:30 AM »
BUMP

Is it possible to have multiples teleporters? One teleporter teleports you to a certain location. Then there is another teleporter that teleports you back to another location on the map.

I'm trying to do multiple ones, but since there is only one target name 'spot' they all connect to the same one.
« Last Edit: February 26, 2012, 02:17:28 AM by McKay »
Maps made for Server:
Death Trap, Spherical, No Man's Land, Sumpf Trap, Dead City, Dead City V2, and Outlast.

DukemXNukem

  • Full Member
  • ***
  • Posts: 152
Re: Adding a Randomised/Area Teleport
« Reply #13 on: May 23, 2012, 11:54:36 PM »
Im guessing from mckay's bump its safe to post right know? Well I get Bad syntex(idk spelling for it) and I changed the csv and gsc to what king posted too, with and without it I get that when testing=:(

McKay

  • Sup
  • Retired zombieX Admin
  • Elite member
  • ******
  • Posts: 1,215
Re: Adding a Randomised/Area Teleport
« Reply #14 on: May 23, 2012, 11:58:36 PM »
In gsc put:

Code: [Select]
maps\mp\_areateleport::main();
in csv

Code: [Select]
rawfile,maps\mp\_areateleport.gsc
Maps made for Server:
Death Trap, Spherical, No Man's Land, Sumpf Trap, Dead City, Dead City V2, and Outlast.