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 do you specify a player?

broken avatar :(
Created 7 years ago
by HyperFirez
0 Members and 1 Guest are viewing this topic.
3,236 views
broken avatar :(
×
broken avatar :(
Location: us
Date Registered: 6 July 2015
Last active: 4 years ago
Posts
114
Respect
Forum Rank
Pack-a-Puncher
Primary Group
Member
My Contact & Social Links
More
Signature
Maps:
Standoff Zombies [WIP]
Der Blitzdrache [WIP] (Maybe Canceled)
FNAF 1-4 [WIP] (Maybe Canceled)
×
HyperFirez's Groups
HyperFirez's Contact & Social LinksHyperFirezHyperFirezHyperFirezHyperFirezHyperFirezHyperFirezHyperFirez
In my script I am trying to get a specific player to be teleported when they activate the "Anywhere But Here" gobblegum. I tired using player = getplayers(); but that is giving me a syntax error...
This topic contains a post which is marked as the Best Answer. Click here to view it.
broken avatar :(
×
broken avatar :(
Location: aupotato
Date Registered: 27 September 2013
Last active: 3 years ago
Posts
588
Respect
Forum Rank
Zombie Enslaver
Primary Group
Community Scripter
My Groups
More
My Contact & Social Links
More
Signature
respect the dead

donates greatly appreciated :) paypal.me/F3ARxReaper666
discord server:
https://discord.gg/tsGHW99
×
death_reaper0's Groups
Community Mapper Has released one or more maps to the UGX-Mods community which have been added to the UGX Map Manager.
Community Scripter Has shown effort and knowledge in the area of scripting while being a part of the UGX-Mods community.
In my script I am trying to get a specific player to be teleported when they activate the "Anywhere But Here" gobblegum. I tired using player = getplayers(); but that is giving me a syntax error...

if its from anywhere but here you should have the player activating it calling the script already. just have the player running it as "self"
broken avatar :(
×
broken avatar :(
Location: us
Date Registered: 6 July 2015
Last active: 4 years ago
Posts
114
Respect
Forum Rank
Pack-a-Puncher
Primary Group
Member
My Contact & Social Links
More
×
HyperFirez's Groups
HyperFirez's Contact & Social LinksHyperFirezHyperFirezHyperFirezHyperFirezHyperFirezHyperFirezHyperFirez
if its from anywhere but here you should have the player activating it calling the script already. just have the player running it as "self"
Thanks man. I saw your "Nightclub" map & I love your Gobblegum system! Would it be possible to do a system like in Bo3 with menus instead of loading another map? (I'll do it either way, I am just curious).

Double Post Merge: January 02, 2017, 04:39:54 pm
Right now I have a struct with the targetname "abh_tele". Would I use getEnt to get the location's name? (This is my entire script if it helps any: http://paste.md-5.net/qinocenixo.coffee) (Also, sorry for all the questions)
Last Edit: January 02, 2017, 04:42:11 pm by HyperFirez
Marked as best answer by HyperFirez 7 years ago
broken avatar :(
×
broken avatar :(
Location: aupotato
Date Registered: 27 September 2013
Last active: 3 years ago
Posts
588
Respect
Forum Rank
Zombie Enslaver
Primary Group
Community Scripter
My Groups
More
My Contact & Social Links
More
×
death_reaper0's Groups
Community Mapper Has released one or more maps to the UGX-Mods community which have been added to the UGX Map Manager.
Community Scripter Has shown effort and knowledge in the area of scripting while being a part of the UGX-Mods community.
id say do it like this

Code Snippet
Plaintext

anywhere_but_here()
{
iprintln("anywhere_but_here function activated");

abh_tele = getentarray("abh_tele","targetname");
teleport_points = [];
//if no telepoints are active, teleport to own location to avoid errors
tele_point = self.origin;
//filter out undiscovered telepoints
for( i = 0; i < abh_tele.size; i++ )
{
if(isdefined(abh_tele[i].is_activated) && abh_tele[i].is_activated)
teleport_points[teleport_points.size] = abh_tele[i];
}

if(isdefined(teleport_points) && teleport_points.size > 0)
tele_point = teleport_points[RandomInt( teleport_points.size )];
wait(1);

self setOrigin(tele_point.origin);
}

anywhere_but_here_init()
{
abh_tele = getentarray("abh_tele","targetname");
for( i = 0; i < abh_tele.size; i++ )
{
abh_tele[i].is_activated = false;
abh_tele[i] thread anywhere_but_here_activate();
}
}

anywhere_but_here_activate()
{
while(1)
{

players = get_players();
for( i = 0; i < players.size; i++ )
if(distance(players[i].origin, self.origin) < 64)
{
self.is_activated = true;
break;
}
wait .1;
}
}

and call anywhere_but_here_init(); from the scripts init, or wherever so it starts when the level does. i'm pretty tired right now (just pulled an all nighter) so there may be a script error. anyway, that ent you were using, make sure its a script origin and you can have as many as you want, it will only teleport the player to any "activated" ones (ones a player has been near at some point) because of that, you should have like, one per room and make sure it isnt too close to another zone, or on the edge of one, should be somewhere the player is likely to walk across
Last Edit: January 02, 2017, 09:57:28 pm by death_reaper0
broken avatar :(
×
broken avatar :(
Location: us
Date Registered: 6 July 2015
Last active: 4 years ago
Posts
114
Respect
Forum Rank
Pack-a-Puncher
Primary Group
Member
My Contact & Social Links
More
×
HyperFirez's Groups
HyperFirez's Contact & Social LinksHyperFirezHyperFirezHyperFirezHyperFirezHyperFirezHyperFirezHyperFirez
Thanks for your help!

EDIT: Bad Syntax on: abh_tele = GetEntArray("abh_tele","targetname");
EDIT2: I moved abh_tele = ... above teleport_points = [], and now it is saying bad syntax on teleport_points = [];
Last Edit: January 02, 2017, 08:53:09 pm by HyperFirez
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
Thanks for your help!

EDIT: Bad Syntax on: abh_tele = GetEntArray("abh_tele","targetname");
EDIT2: I moved abh_tele = ... above teleport_points = [], and now it is saying bad syntax on teleport_points = [];

This line is missing a semicolon ;  That's why you get the error

Code Snippet
Plaintext
	iprintln("anywhere_but_here function activated")
broken avatar :(
×
broken avatar :(
Location: us
Date Registered: 6 July 2015
Last active: 4 years ago
Posts
114
Respect
Forum Rank
Pack-a-Puncher
Primary Group
Member
My Contact & Social Links
More
×
HyperFirez's Groups
HyperFirez's Contact & Social LinksHyperFirezHyperFirezHyperFirezHyperFirezHyperFirezHyperFirezHyperFirez
This line is missing a semicolon ;  That's why you get the error

Code Snippet
Plaintext
	iprintln("anywhere_but_here function activated")
Haha! I didn't even notice it!  :lol:
broken avatar :(
×
broken avatar :(
Location: aupotato
Date Registered: 27 September 2013
Last active: 3 years ago
Posts
588
Respect
Forum Rank
Zombie Enslaver
Primary Group
Community Scripter
My Groups
More
My Contact & Social Links
More
×
death_reaper0's Groups
Community Mapper Has released one or more maps to the UGX-Mods community which have been added to the UGX Map Manager.
Community Scripter Has shown effort and knowledge in the area of scripting while being a part of the UGX-Mods community.
Haha! I didn't even notice it!  :lol:
partly my fault derp, but that bit was copied from your code so i kinda overlooked it
broken avatar :(
×
broken avatar :(
Location: us
Date Registered: 6 July 2015
Last active: 4 years ago
Posts
114
Respect
Forum Rank
Pack-a-Puncher
Primary Group
Member
My Contact & Social Links
More
×
HyperFirez's Groups
HyperFirez's Contact & Social LinksHyperFirezHyperFirezHyperFirezHyperFirezHyperFirezHyperFirezHyperFirez
partly my fault derp, but that bit was copied from your code so i kinda overlooked it
No worries. When I do go in game, it says that the function is activated, but nothing happens. (I have a script_origin with the targetname: abh_tele)
Last Edit: January 02, 2017, 10:04:16 pm by HyperFirez
broken avatar :(
×
broken avatar :(
Location: aupotato
Date Registered: 27 September 2013
Last active: 3 years ago
Posts
588
Respect
Forum Rank
Zombie Enslaver
Primary Group
Community Scripter
My Groups
More
My Contact & Social Links
More
×
death_reaper0's Groups
Community Mapper Has released one or more maps to the UGX-Mods community which have been added to the UGX Map Manager.
Community Scripter Has shown effort and knowledge in the area of scripting while being a part of the UGX-Mods community.
No worries. When I do go in game, it says that the function is activated, but nothing happens. (I have a script_origin with the targetname: abh_tele)
looking at the script, theres nothing calling it,
change
Code Snippet
Plaintext
thread anywhere_but_here();

to
Code Snippet
Plaintext
player thread anywhere_but_here();
also with how you set it up its gonna happen as soon as its taken from the machine
broken avatar :(
×
broken avatar :(
Location: us
Date Registered: 6 July 2015
Last active: 4 years ago
Posts
114
Respect
Forum Rank
Pack-a-Puncher
Primary Group
Member
My Contact & Social Links
More
×
HyperFirez's Groups
HyperFirez's Contact & Social LinksHyperFirezHyperFirezHyperFirezHyperFirezHyperFirezHyperFirezHyperFirez
also with how you set it up its gonna happen as soon as its taken from the machine
I did that so it doesn't randomize the chances to get it & I can directly test a specific one.

Double Post Merge: January 03, 2017, 01:33:34 pm
It works now, thanks again!
Last Edit: January 03, 2017, 01:33:34 pm by HyperFirez

 
Loading ...