UGX-Mods 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 Facebook
Sign In with Twitch

How would i use teleport() ?

broken avatar :(
Created 10 years ago
by BluntStuffy
0 Members and 1 Guest are viewing this topic.
2,056 views
broken avatar :(
×
broken avatar :(
Location: nlApeldoorn
Date Registered: 17 December 2013
Last active: 1 year ago
Posts
1,187
Respect
1,404Add +1
Forum Rank
Zombie Colossus
Primary Group
Community Scripter Elite
My Groups
More
My Contact & Social Links
More
Personal Quote
It aint much, if it aint Dutch
Signature
×
BluntStuffy's Groups
Donator ♥ Benevolent Soul who has our eternal gratitude and exclusive access to betas and the donator section of the forum.
Community Scripter Elite Has shown excellence and experience in the area of custom scripting in the UGX-Mods community.
Oil Rig Beta Access
Oil Rig Beta Access
BluntStuffy's Contact & Social LinksBluntstuffy@BluntZombieBluntStuffyStuffyZombie
I'm trying to get zombies to teleport, i searched for some reference script's and tried multiple setup's. Nothing happens..
The prints are printed onscreen and the destination (for testing) is a script_struct i placed in radiant..
Anybody knows why this isn't working? In the spawn function i'm calling:

Code Snippet
Plaintext
thread teleport_think(self);

and the function...

Code Snippet
Plaintext
teleport_think( zombie )
{
zombie endon( "death" );
iprintln( "teleport think threaded" );

target = getent( "teleport_target" , "targetname" );
teleport_radius = 122500; // 350 squared

while(1)
{

rand = randomintrange( 1, 101 );

if( rand < 51 )
{
players = get_players();
for ( i = 0; i < players.size; i++ )
{
if ( DistanceSquared( zombie.origin, players[i].origin ) < teleport_radius )
{
Iprintln( " Can teleport " );
nw_ori = target.origin;
iprintln( "new origin: ["+ nw_ori +"] " );
zombie teleport( target.origin, zombie.angles );
break;
}

else
{
Iprintln( " DO NOT teleport " );
wait 0.05;
}
}
}
Iprintln( " Recharging teleport function" );
wait 10;
}
}
Last Edit: January 26, 2014, 11:06:45 am by BluntStuffy
broken avatar :(
×
broken avatar :(
Location: de
Date Registered: 6 August 2012
Last active: 4 years ago
Posts
277
Respect
Forum Rank
Mr. Elemental
Primary Group
Community Scripter Elite
My Groups
More
×
YaPh1l's Groups
Community Scripter Elite Has shown excellence and experience in the area of custom scripting in the UGX-Mods community.
YaPh1l's Contact & Social Links
Does it print the origin? Because you said you used a script_struct, but in your script you use GetEnt(). script_structs need to be acquired by GetStruct().

- Phil.
broken avatar :(
×
broken avatar :(
Location: nlApeldoorn
Date Registered: 17 December 2013
Last active: 1 year ago
Posts
1,187
Respect
1,404Add +1
Forum Rank
Zombie Colossus
Primary Group
Community Scripter Elite
My Groups
More
My Contact & Social Links
More
Personal Quote
It aint much, if it aint Dutch
×
BluntStuffy's Groups
Donator ♥ Benevolent Soul who has our eternal gratitude and exclusive access to betas and the donator section of the forum.
Community Scripter Elite Has shown excellence and experience in the area of custom scripting in the UGX-Mods community.
Oil Rig Beta Access
Oil Rig Beta Access
BluntStuffy's Contact & Social LinksBluntstuffy@BluntZombieBluntStuffyStuffyZombie
Does it print the origin? Because you said you used a script_struct, but in your script you use GetEnt(). script_structs need to be acquired by GetStruct().

- Phil.

I changed that, it does actually print the correct origin on screen. The zombie just doesn't teleport  :'(
broken avatar :(
×
broken avatar :(
Location: de
Date Registered: 6 August 2012
Last active: 4 years ago
Posts
277
Respect
Forum Rank
Mr. Elemental
Primary Group
Community Scripter Elite
My Groups
More
×
YaPh1l's Groups
Community Scripter Elite Has shown excellence and experience in the area of custom scripting in the UGX-Mods community.
YaPh1l's Contact & Social Links
Maybe try ForceTeleport().

- Phil.
broken avatar :(
×
broken avatar :(
Location: nlApeldoorn
Date Registered: 17 December 2013
Last active: 1 year ago
Posts
1,187
Respect
1,404Add +1
Forum Rank
Zombie Colossus
Primary Group
Community Scripter Elite
My Groups
More
My Contact & Social Links
More
Personal Quote
It aint much, if it aint Dutch
×
BluntStuffy's Groups
Donator ♥ Benevolent Soul who has our eternal gratitude and exclusive access to betas and the donator section of the forum.
Community Scripter Elite Has shown excellence and experience in the area of custom scripting in the UGX-Mods community.
Oil Rig Beta Access
Oil Rig Beta Access
BluntStuffy's Contact & Social LinksBluntstuffy@BluntZombieBluntStuffyStuffyZombie
I took a look in nazi_zombie_factory_teleporter.gsc how the did it there. I'm spawning a script_origin now, link that to the zombie and set the new origin. That works!
Thanks though, i'll also give the forceteleport a try, see if that works..

 
Loading ...