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

Teleport a player in a certain direction

HOT
broken avatar :(
Created 11 years ago
by Eternal_Fire
0 Members and 1 Guest are viewing this topic.
8,935 views
broken avatar :(
×
broken avatar :(
Location: au
Date Registered: 23 April 2015
Last active: 5 years ago
Posts
165
Respect
Forum Rank
Pack-a-Puncher
Primary Group
Donator ♥
My Groups
More
Signature
Money isn't everything but everything has a price
×
Eternal_Fire's Groups
Donator ♥ Benevolent Soul who has our eternal gratitude and exclusive access to betas and the donator section of the forum.
Eternal_Fire's Contact & Social Links
So i was wondering how i would teleport a player infront of themself 2 metres or so. I thought that I could do this by doing something like
Code Snippet
Plaintext
newplayerangles = player.angles + direction + angles(angles needed)

Yes i know that's not how it is supposed to be layed out but thats the sort of thing I want. Not sure how to check direction so if anyone could help that would be great :3
This topic contains a post which is marked as the Best Answer. Click here to view it.
broken avatar :(
×
broken avatar :(
Location: us
Date Registered: 14 September 2013
Last active: 6 years ago
Posts
1,895
Respect
Forum Rank
Zombie Destroyer
Primary Group
Scripter
My Groups
More
My Contact & Social Links
More
Personal Quote
BE ORIGINAL
Signature
×
MakeCents's Groups
Mapper Has released one or more maps to the UGX-Mods community.
Scripter Has shown effort and knowledge in the area of scripting while being a part of the UGX-Mods community.
BO3 Modtools Alpha
BO3 Modtools Alpha
This user has access to the Black Ops 3 Modtools Alpha
Direction isn't the only issue. The player would be able to go through walls and out of the map, and who knows what else. But anyway, here are some functions with some googling and math you should be able to get what you want:

http://wiki.modsrepository.com/index.php?title=Call_of_Duty_4:_Scripting_Reference_-_Vector
broken avatar :(
×
broken avatar :(
Location: au
Date Registered: 23 April 2015
Last active: 5 years ago
Posts
165
Respect
Forum Rank
Pack-a-Puncher
Primary Group
Donator ♥
My Groups
More
×
Eternal_Fire's Groups
Donator ♥ Benevolent Soul who has our eternal gratitude and exclusive access to betas and the donator section of the forum.
Eternal_Fire's Contact & Social Links
Direction isn't the only issue. The player would be able to go through walls and out of the map, and who knows what else. But anyway, here are some functions with some googling and math you should be able to get what you want:

http://wiki.modsrepository.com/index.php?title=Call_of_Duty_4:_Scripting_Reference_-_Vector

Alright, thx, will players be able to teleport inside of walls?
broken avatar :(
×
broken avatar :(
Location: us
Date Registered: 14 September 2013
Last active: 6 years ago
Posts
1,895
Respect
Forum Rank
Zombie Destroyer
Primary Group
Scripter
My Groups
More
My Contact & Social Links
More
Personal Quote
BE ORIGINAL
×
MakeCents's Groups
Mapper Has released one or more maps to the UGX-Mods community.
Scripter Has shown effort and knowledge in the area of scripting while being a part of the UGX-Mods community.
BO3 Modtools Alpha
BO3 Modtools Alpha
This user has access to the Black Ops 3 Modtools Alpha
Alright, thx, will players be able to teleport inside of walls?

When you teleport the player, i.e. setorigin, yes. Anywhere you say to teleport them they will go. I'm not sure if your trying to make nightcrawler or a boost or what. There are other ways to simulate a teleport that could be less dangerous, like using setvelocity That in combination with enable and disable invulnerability may also work for what you want.
Last Edit: September 18, 2015, 12:30:21 pm by MakeCents
broken avatar :(
×
broken avatar :(
Location: au
Date Registered: 23 April 2015
Last active: 5 years ago
Posts
165
Respect
Forum Rank
Pack-a-Puncher
Primary Group
Donator ♥
My Groups
More
×
Eternal_Fire's Groups
Donator ♥ Benevolent Soul who has our eternal gratitude and exclusive access to betas and the donator section of the forum.
Eternal_Fire's Contact & Social Links
When you teleport the player, i.e. setorigin, yes. Anywhere you say to teleport them they will go. I'm not sure if your trying to make nightcrawler or a boost or what. There are other ways to simulate a teleport that could be less dangerous, like using setvelocity

Im trying to make blink from destiny so I can't use setvelocity. Blink basically teleports you a certain distance and it would be nice if you could teleport through walls but not into them, maybe there could be some way by using a trigger_multiple on the walls to break the script if you are about to teleport to them?
broken avatar :(
×
broken avatar :(
Location: us
Date Registered: 14 September 2013
Last active: 6 years ago
Posts
1,895
Respect
Forum Rank
Zombie Destroyer
Primary Group
Scripter
My Groups
More
My Contact & Social Links
More
Personal Quote
BE ORIGINAL
×
MakeCents's Groups
Mapper Has released one or more maps to the UGX-Mods community.
Scripter Has shown effort and knowledge in the area of scripting while being a part of the UGX-Mods community.
BO3 Modtools Alpha
BO3 Modtools Alpha
This user has access to the Black Ops 3 Modtools Alpha
Im trying to make blink from destiny so I can't use setvelocity. Blink basically teleports you a certain distance and it would be nice if you could teleport through walls but not into them, maybe there could be some way by using a trigger_multiple on the walls to break the script if you are about to teleport to them?

Anything is possible, but there are probably better ways than using a trigger, but I don't know them. The problem with going through walls is getting into zombie spawn areas, out of map, and through doors without buying them. Of course, if your map works that way then cool. I'm sure it can be done.

Blunt may be the one to contact about tapping into the pathnodes maybe to keep the player in playable areas, if that is possible. I've seen his dog use them I think. Perhaps there is a way to get the pathnodes in front of a player and make them teleport to one...?
Last Edit: September 18, 2015, 12:36:36 pm by MakeCents
broken avatar :(
×
broken avatar :(
Location: au
Date Registered: 23 April 2015
Last active: 5 years ago
Posts
165
Respect
Forum Rank
Pack-a-Puncher
Primary Group
Donator ♥
My Groups
More
×
Eternal_Fire's Groups
Donator ♥ Benevolent Soul who has our eternal gratitude and exclusive access to betas and the donator section of the forum.
Eternal_Fire's Contact & Social Links
Anything is possible, but there are probably better ways than using a trigger, but I don't know them. The problem with going through walls is getting into zombie spawn areas, out of map, and through doors without buying them. Of course, if your map works that way then cool. I'm sure it can be done.

Blunt may be the one to contact about tapping into the pathnodes maybe to keep the player in playable areas, if that is possible. I've seen his dog use them I think. Perhaps there is a way to get the pathnodes in front of a player and make them teleport to one...?

Alright, will do, thanks for the help.
broken avatar :(
×
broken avatar :(
Location: us
Date Registered: 11 March 2014
Last active: 5 years ago
Posts
264
Respect
Forum Rank
Mr. Elemental
Primary Group
Member
Signature
"Always code as if the guy who ends up maintaining your code will be a violent psychopath who knows where you live."
×
buttkicker845's Groups
buttkicker845's Contact & Social Links
You can get all the pathnodes in a level by using getNodeArray("node_pathnode","classname");(I'm not positive if that is the right value for the classname and I'm on my phone so I can't check it) but if you used pathnodes it could still send you outside through a barrier if you don't check it. You should test if the pathnode that your going to send the player to is inside of the playable_area trigger that's used for spawning power ups
broken avatar :(
×
broken avatar :(
Location: us
Date Registered: 14 September 2013
Last active: 6 years ago
Posts
1,895
Respect
Forum Rank
Zombie Destroyer
Primary Group
Scripter
My Groups
More
My Contact & Social Links
More
Personal Quote
BE ORIGINAL
×
MakeCents's Groups
Mapper Has released one or more maps to the UGX-Mods community.
Scripter Has shown effort and knowledge in the area of scripting while being a part of the UGX-Mods community.
BO3 Modtools Alpha
BO3 Modtools Alpha
This user has access to the Black Ops 3 Modtools Alpha
You can get all the pathnodes in a level by using getNodeArray("node_pathnode","classname");(I'm not positive if that is the right value for the classname and I'm on my phone so I can't check it) but if you used pathnodes it could still send you outside through a barrier if you don't check it. You should test if the pathnode that your going to send the player to is inside of the playable_area trigger that's used for spawning power ups

This is a great way to do it. Now... the script... :D
broken avatar :(
×
broken avatar :(
[UGX] Documentation Writer & Programmer
Location: usLos Angeles, CA
Date Registered: 23 August 2013
Last active: 3 years ago
Posts
1,322
Respect
Forum Rank
Zombie Colossus
Primary Group
UGX Team Member
My Groups
More
My Contact & Social Links
More
Personal Quote
(ง º ω º )ง u wont sum m8y?
Signature
Do not take life too seriously. You will never get out of it alive.
×
DidUknowiPwn's Groups
UGX Team Member
Donator ♥ Benevolent Soul who has our eternal gratitude and exclusive access to betas and the donator section of the forum.
Scripter Elite Has shown excellence and experience in the area of custom scripting in the UGX-Mods community.
BO3 Modtools Alpha
BO3 Modtools Alpha
This user has access to the Black Ops 3 Modtools Alpha
Do a bulletTrace for this.
Marked as best answer by Eternal_Fire 11 years ago
broken avatar :(
×
broken avatar :(
Location: nlApeldoorn
Date Registered: 17 December 2013
Last active: 2 years ago
Posts
1,186
Respect
1,332Add +1
Forum Rank
Zombie Colossus
Primary Group
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.
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 LinksBluntStuffyBluntstuffy@BluntZombieStuffyZombie
something like this should work:

Code Snippet
Plaintext
// self is the player
teleport_player_forward()
{
angles = self GetPlayerAngles();
ang_fw = anglestoforward( angles );

// get the new destination 200 untis forward
destination = self.origin + vectorscale( ang_fw, 200 );
        ground_org = groundpos( destination+(0,0,35) );

// do a bullettrace to check for walls etc
if( bullettracepassed( self.origin+(0,0,30), ground_org+(0,0,30), false, self ) )
{
self dontinterpolate();
self setorigin( ground_org );
}
}
Last Edit: September 18, 2015, 05:57:23 pm by BluntStuffy
broken avatar :(
×
broken avatar :(
[UGX] Documentation Writer & Programmer
Location: usLos Angeles, CA
Date Registered: 23 August 2013
Last active: 3 years ago
Posts
1,322
Respect
Forum Rank
Zombie Colossus
Primary Group
UGX Team Member
My Groups
More
My Contact & Social Links
More
Personal Quote
(ง º ω º )ง u wont sum m8y?
×
DidUknowiPwn's Groups
UGX Team Member
Donator ♥ Benevolent Soul who has our eternal gratitude and exclusive access to betas and the donator section of the forum.
Scripter Elite Has shown excellence and experience in the area of custom scripting in the UGX-Mods community.
BO3 Modtools Alpha
BO3 Modtools Alpha
This user has access to the Black Ops 3 Modtools Alpha
Well what I meant is you can get a point that's in front of you using bulletTrace and set that origin.
broken avatar :(
×
broken avatar :(
Location: nlApeldoorn
Date Registered: 17 December 2013
Last active: 2 years ago
Posts
1,186
Respect
1,332Add +1
Forum Rank
Zombie Colossus
Primary Group
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.
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 LinksBluntStuffyBluntstuffy@BluntZombieStuffyZombie
Well what I meant is you can get a point that's in front of you using bulletTrace and set that origin.

I didn't say it was the only way or the best way to do it, but the OP mentioned he wasn't sure about direction stuff so it was more of a short example, since there's prob some other stuff you want to check on the player as well i wouldn't just go and use this 'script' in a map.
For doing a bullet trace he still needs a direction, or at least a start and end point. And your answer wasn't really that complete in terms of that :P
broken avatar :(
×
broken avatar :(
Location: us
Date Registered: 14 September 2013
Last active: 6 years ago
Posts
1,895
Respect
Forum Rank
Zombie Destroyer
Primary Group
Scripter
My Groups
More
My Contact & Social Links
More
Personal Quote
BE ORIGINAL
×
MakeCents's Groups
Mapper Has released one or more maps to the UGX-Mods community.
Scripter Has shown effort and knowledge in the area of scripting while being a part of the UGX-Mods community.
BO3 Modtools Alpha
BO3 Modtools Alpha
This user has access to the Black Ops 3 Modtools Alpha
That's really good stuff. I don't think he will be able to go through walls with bullet tracing though. If he uses the pathnodes and uses the playable area trigger, I think he will get what he wants, the safest.

Of course, you'll have to keep your pathnodes out of the doors, or players could get stuck, similar to the bullet trace method too.
Last Edit: September 18, 2015, 10:15:52 pm by MakeCents
broken avatar :(
×
broken avatar :(
Location: au
Date Registered: 23 April 2015
Last active: 5 years ago
Posts
165
Respect
Forum Rank
Pack-a-Puncher
Primary Group
Donator ♥
My Groups
More
×
Eternal_Fire's Groups
Donator ♥ Benevolent Soul who has our eternal gratitude and exclusive access to betas and the donator section of the forum.
Eternal_Fire's Contact & Social Links
something like this should work:

Code Snippet
Plaintext
// self is the player
teleport_player_forward()
{
angles = self GetPlayerAngles();
ang_fw = anglestoforward( angles );

// get the new destination 200 untis forward
destination = self.origin + vectorscale( ang_fw, 200 );
        ground_org = groundpos( destination+(0,0,35) );

// do a bullettrace to check for walls etc
if( bullettracepassed( self.origin+(0,0,30), ground_org+(0,0,30), false, self ) )
{
self dontinterpolate();
self setorigin( ground_org );
}
}

Thanks for this stuffy, so with the bullettracer thing, does that mean that you simply wont teleport if you are going to collide with a wall or can you teleport throught it?

 
Loading ...