Need quick scripting help for kino style teleporters

broken avatar :(
Created 2555 days ago
by Psych
0 Members and 1 Guest are viewing this topic.
2,179 views
broken avatar :(
×
broken avatar :(
Location: usunited states
Date Registered: 19 August 2012
Last active: 110 days ago
Posts
215
Respect
Forum Rank
Mr. Elemental
Primary Group
Member
Personal Quote
Mapper
Signature
Maker of Contrivance
×
Psych's Groups
Psych's Contact & Social Links
Hey I posted this same question on zombiemodding but after a week or so no one has replied so I decided to take my business here. I recently found a very helpful tutorial on how to add kino style teleporters but the script only supports the use of one teleporter. I have 3 teleporters in my map so I want them all to have the kino style effect. can someone at least look at the script and tell me wether or not this can be done. I tried reading the script and figuring this out myself but I am no expert.

here is the script:

#include common_scripts\utility; 
#include maps\_utility;
#include maps\_zombiemode_utility;

init()
{
thread level_players();
addItems();
thread handleTriggers(level.kts["teleporter_trigger"], level.kts["mainframe_trigger"]);
flag_wait("electricity_on");
thread teleport_room_fx();
thread main();
}
addItems()
{
// Create Kino Teleporting System array
level.kts = [];
// Set variables needed for the teleporting system (using the setVar function)

// DO NOT EDIT THESE
setVar("teleporter_trigger", getEnt("kino_teleporter_trigger","targetname"));
setVar("mainframe_trigger", getEnt("kino_mainframe_trigger","targetname"));
setVar("teleporter_fxspot", getEnt("kino_teleporter_fxspot","targetname"));
setVar("mainframe_fxspot", getEnt("kino_mainframe_fxspot","targetname"));
setVar("zombie_goto", getEnt("kino_teleporter_zombiegoto","targetname"));
setVar("mainframe_spawn", getEntArray("kino_mainframe_spawn","targetname"));
setVar("pap_room_spawn", getEntArray("kino_paproom_spawn","targetname"));
setVar("transfer_room_structs", getEntArray("kino_image_room","targetname"));
setVar("teleporter_status", 0);
level.paping = false;
level.disable_pap = true;
level.kts["zombie_goto"] create_zombie_point_of_interest( 1536, 96, 10000, true );
level.kts["zombie_goto"].attract_to_origin = false;

// You CAN edit these
setVar("teleporter_cooldown_time", 60); // After a teleport, this is how long a wait until you can use it again
setVar("teleport_lag", 2); // When you go to teleport, this is how long it will wait until it actually teleports
setVar("pap_room_time", 50); // This is how long you are in the pack-a-punch room
setVar("wait_for_pap", true); // If false, you can be teleported out of the room even if there is a gun in the slot of the pap machine
setVar("teleport_cost", 115); // This is the amount of money it costs to teleport

// You MUST change these to be correct
setVar("room_is_pap", false); // If the room you go to when teleporting does NOT have the pack-a-punch in it, set this to false

if(!level.kts["room_is_pap"])
level.disable_pap = false;
}
level_players()
{
while(1)
{
level.players = get_players();
wait 0.5;
}
}
teleport_room_fx()
{
//points = level.kts["transfer_room_structs"];
points = getEntArray("kino_image_room","targetname");
for(i=0;i<points.size;i++)
{
points[i].struct = Spawn( "script_model", points[i].origin );
points[i].struct SetModel( "tag_origin_animate" );
points[i].struct.angles = points[i].angles;
PlayFxOnTag( level._effect["zombie_flashback_american"], points[i].struct, "tag_origin" );
}
}
main()
{
while(1)
{
setVar("teleporter_status", 1);
level.kts["teleporter_trigger"] waittill("trigger");
setVar("teleporter_status", 2);
level.kts["mainframe_trigger"] waittill("trigger");
setVar("teleporter_status", 3);
while(1)
{
level.kts["teleporter_trigger"] waittill("trigger", who);
if(level.kts["teleport_cost"] == 0)
break;

if(who.score < level.kts["teleport_cost"])
{
who playsound("deny");
continue;
}
who playsound("purchase");
who maps\_zombiemode_score::minus_to_player_score( level.kts["teleport_cost"] );
break;
}
setVar("teleporter_status", 4);
level.kts["teleporter_trigger"] do_teleport();
setVar("teleporter_status", 5);
wait level.kts["teleporter_cooldown_time"];
}
}
do_teleport()
{
// start fps fx
self thread teleport_pad_player_fx();

// Activate the TP zombie kill effect
self thread teleport_nuke( 20, 300, false); // Max 20 zombies and range 300

// 3rd Person Beam
level.kts["teleporter_fxspot"] thread pad_explosion();

// Teleport the players
self teleport_players();
}
teleport_players()
{
//thread do_mainframe_explode();
wait level.kts["teleport_lag"];
self notify( "fx_done" );
players_in = [];
attract = false;
for ( i = 0; i <level.players.size; i++ )
{
if( self player_is_near_pad( level.players[i] ) )
{
players_in[players_in.size] = level.players[i];
level.players[i] SetTransported( 2 );
level.players[i] SetStance( "stand" );
level.players[i] disableOffhandWeapons();
level.players[i] disableweapons();
image_room = getent( "teleport_room_" + i, "script_noteworthy" );
level.players[i].teleport_origin = spawn( "script_origin", level.players[i].origin );
level.players[i].teleport_origin.angles = level.players[i].angles;
level.players[i] linkto( level.players[i].teleport_origin );
level.players[i].teleport_origin.origin = image_room.origin + (0,70,-60); // 0, -70, -60
level.players[i].teleport_origin.angles = image_room.angles + (0,180,0);
setClientSysState("levelNotify", "t2d", level.players[i]);
level.players[i] FreezeControls( true );
wait_network_frame();
}
}
if(players_in.size == level.players.size)
{
attract = true;
level.kts["zombie_goto"].attract_to_origin = true;
}
wait 2;
for ( i = 0; i <players_in.size; i++ )
{
players_in[i].teleport_origin delete();
players_in[i].teleport_origin = undefined;
players_in[i] SetTransported( 0 );
players_in[i] FreezeControls( false );
players_in[i] enableOffhandWeapons();
players_in[i] enableweapons();
players_in[i] setOrigin(level.kts["pap_room_spawn"][i].origin);
}
if(level.kts["room_is_pap"])
level.disable_pap = false;
wait(level.kts["pap_room_time"] - 2);
if(level.kts["room_is_pap"] && level.kts["wait_for_pap"])
while(level.paping)
{
wait 0.5;
}
for ( i = 0; i <players_in.size; i++ )
players_in[i] SetTransported( 2 );
if(level.kts["room_is_pap"])
level.disable_pap = true;
level.kts["mainframe_fxspot"] thread do_mainframe_explode();
wait 2;
for ( i = 0; i <players_in.size; i++ )
{
players_in[i] SetTransported( 2 );
players_in[i] SetStance( "stand" );
players_in[i] disableOffhandWeapons();
players_in[i] disableweapons();
image_room = getent( "teleport_room_" + i, "script_noteworthy" );
players_in[i].teleport_origin = spawn( "script_origin", players_in[i].origin );
players_in[i].teleport_origin.angles = players_in[i].angles;
players_in[i] linkto( players_in[i].teleport_origin );
players_in[i].teleport_origin.origin = image_room.origin + (0,70,-60);
players_in[i].teleport_origin.angles = image_room.angles + (0,180,0);
players_in[i] FreezeControls( true );
setClientSysState("levelNotify", "t2d", players_in[i]);
wait_network_frame();
}
wait 2;
for ( i = 0; i <players_in.size; i++ )
{
players_in[i].teleport_origin delete();
players_in[i].teleport_origin = undefined;
players_in[i] SetTransported( 0 );
players_in[i] FreezeControls( false );
players_in[i] enableOffhandWeapons();
players_in[i] enableweapons();
players_in[i] setOrigin(level.kts["mainframe_spawn"][i].origin);
}
if(attract)
{
level.kts["zombie_goto"].attract_to_origin = false;
}
}
handleTriggers(self1, self2)
{
self1 SetCursorHint( "HINT_NOICON" );
self2 SetCursorHint( "HINT_NOICON" );
while(1)
{
hint1 = "";
hint2 = "";
switch(level.kts["teleporter_status"])
{
case 0: // Need power
hint1 = "You need to activate the power before using the teleporter";
hint2 = "You need to activate the power before using the teleporter";
break;
case 1: // Startup
hint1 = "Press &&1 to initiate link to mainframe";
hint2 = "Waiting for initial link to mainframe";
break;
case 2: // Waiting for link
hint1 = " ";
hint2 = "Press &&1 to link pad to mainframe";
break;
case 3: // Linked
if(level.kts["teleport_cost"] == 0)
hint1 = "Press &&1 to teleport";
else
hint1 = "Press &&1 to teleport [Cost: " + level.kts["teleport_cost"] + "]";
hint2 = " ";
break;
case 4: // Teleporting
hint1 = "Teleporting in progress";
hint2 = "Teleporting in progress";
break;
case 5: // Cooling down
hint1 = "The teleporter is cooling down";
hint2 = "The teleporter is cooling down";
break;
default: // Failsafe
hint1 = " ";
hint2 = " ";
break;
}
self1 setHintString(hint1);
self2 setHintString(hint2);
wait 0.5;
}
}
setVar(var, value)
{
// Sets the value on the array
level.kts[var] = value;
}
teleport_pad_player_fx()
{
self endon( "fx_done" );

while ( 1 )
{
players = getplayers();
for ( i = 0; i < players.size; i++ )
{
if ( isdefined( players[i] ) )
{
if ( self player_is_near_pad( players[i] ) )
{
players[i] SetTransported( 2 );
}
else
{
players[i] SetTransported( 0 );
}
}
}
wait ( .05 );
}
}
player_is_near_pad( player )
{
radius = 88;
scale_factor = 2;

dist = Distance2D( player.origin, self.origin );
dist_touching = radius * scale_factor;

if ( dist < dist_touching )
{
return true;
}

return false;
}
teleport_nuke( max_zombies, range, end_after_one )
{
self endon( "fx_done" );
if(!isDefined(end_after_one))
end_after_one = false;
while(1)
{
zombies = getaispeciesarray("axis");

zombies = get_array_of_closest( self.origin, zombies, undefined, max_zombies, range );

for (i = 0; i < zombies.size; i++)
{
wait (randomfloatrange(0.2, 0.3));
if( !IsDefined( zombies[i] ) )
{
continue;
}

if( is_magic_bullet_shield_enabled( zombies[i] ) )
{
continue;
}

if( !( zombies[i] enemy_is_dog() ) )
{
zombies[i] maps\_zombiemode_spawner::zombie_head_gib();
}

zombies[i] dodamage( 10000, zombies[i].origin );
playsoundatposition( "nuked", zombies[i].origin );
}
if(end_after_one)
return;
wait 0.01;
}
}
pad_explosion()
{
self thread pad_explosion_sound();
playfx(level._effect["transporter_pad_start"], self.origin);
wait level.kts["teleport_lag"];
playfx(level._effect["transporter_beam"], self.origin);
}
pad_explosion_sound()
{
count = 0;
while(1)
{
count ++;
if(count == 5)
return;
sound = "top_spark" + count + "_warmup";
playsoundatposition(sound, self.origin);
wait 0.1;
if(count == 4)
return;
}
}
do_mainframe_explode()
{
playfx(level._effect["zombie_mainframe_beam_start"], self.origin);
wait 4;
earthquake(0.3, 2, self.origin, 1024);
playfx(level._effect["zombie_mainframe_beam"], self.origin);
self thread teleport_nuke( 20, 300, true);
}
broken avatar :(
×
broken avatar :(
Location: 00
Date Registered: 14 March 2012
Last active: 48 days ago
Posts
170
Respect
Forum Rank
Pack-a-Puncher
Primary Group
Member
My Contact & Social Links
More
×
zNiiC's Groups
zNiiC's Contact & Social LinkszNiiCRAiiDz
If its designed to work with one teleporter, you will have to add more to make it work with three or whatever you need.
broken avatar :(
×
broken avatar :(
Location: usKentucky
Date Registered: 25 June 2011
Last active: 209 days ago
Posts
88
Respect
Forum Rank
Rotting Walker
Primary Group
UGX V.I.P.
My Groups
More
My Contact & Social Links
More
Personal Quote
Vr gb pf wd ya gs pf eg.
×
Aidan's Groups
Donator ♥ Benevolent Soul who has our eternal gratitude and exclusive access to betas and the donator section of the forum.
UGX V.I.P.
UGX V.I.P.
Aidan's Contact & Social Linksaddictedtocod1amw31rd1amw31rdPortfolio
I made this a long time ago. I don't really remember how it works, but I think if you just copy the script (one copy for each teleporter, so 3 copies) and then just change all the level.kts variables to something like level.kts1, level.kts2, etc, and then call init on all 3 copies, it should work. Change the variables in the AddItems() thing to reference each trigger part or struct (even tho it says don't edit them :P). I think that should work.
broken avatar :(
×
broken avatar :(
Location: usunited states
Date Registered: 19 August 2012
Last active: 110 days ago
Posts
215
Respect
Forum Rank
Mr. Elemental
Primary Group
Member
Personal Quote
Mapper
×
Psych's Groups
Psych's Contact & Social Links
Ok thanks! compiling to test it out now. I will tell you how it goes!  :D

 

Login

or login with an authentication provider below
Sign In with Google
Sign In with Twitter
Sign In with Discord
Sign In with Steam
Sign In with Twitch
Loading ...