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 9 years ago
by Eternal_Fire
0 Members and 1 Guest are viewing this topic.
6,568 views
broken avatar :(
×
broken avatar :(
Senpai
Location: us
Date Registered: 28 September 2013
Last active: 3 years ago
Posts
605
Respect
Forum Rank
Zombie Enslaver
Primary Group
Box Mappers Elite
My Groups
More
My Contact & Social Links
More
×
arceus's Groups
Box Mappers Elite
Box Mappers Elite
arceus's Contact & Social LinksarceusNT
if theres a wall in the way you will go to the wall but not threw it that would take a little more code
broken avatar :(
×
broken avatar :(
Location: au
Date Registered: 23 April 2015
Last active: 3 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
if theres a wall in the way you will go to the wall but not threw it that would take a little more code

Ah, good, thanks for the clarification.

Double Post Merge: September 19, 2015, 10:35:04 am
erm i have it setup like this:
Code Snippet
Plaintext
#include maps\_utility; 
#include common_scripts\utility;
#include maps\_zombiemode_utility;

init()
{
players = get_players();
for(i = 0; i<players.size ; i++)
{
players[i] thread blink_main();
}
}

blink_main()
{
angles = self GetPlayerAngles();
ang_fw = anglestoforward( angles );
while(1)
{
if (self meleebuttonpressed())
{
iprintln("ismeleeing");
// get the new destination 200 untis forward
destination = self.origin + vectorscale( ang_fw, 500);
        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 );
}
wait 0.1;
}
if (!self meleebuttonpressed())
{
iprintln("Not Meleeing");
wait 0.1;
}
else
{
continue;
wait 0.1;
}
}
}

But it isn't teleporting me anywhere? It does print "ismeleeing" when i melee but it doesnt actually teleport me. Any help?
Last Edit: September 19, 2015, 10:35:04 am by Eternal_Fire
broken avatar :(
×
broken avatar :(
Location: hkHong Kong
Date Registered: 26 August 2012
Last active: 7 years ago
Posts
17
Respect
Forum Rank
Legless Crawler
Primary Group
Member
My Contact & Social Links
More
×
JustForFun119's Groups
JustForFun119's Contact & Social LinksJustForFun119
Can anyone explain how dontInterpolate() works? I've read the Script Reference but have no idea what it says...
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
Can anyone explain how dontInterpolate() works? I've read the Script Reference but have no idea what it says...

Basicly when you move a player by just defining a new origin, so when you do player setorigin( 0,0,0 );  for example, normally you could see the player move to that coord in some cases. So you see the player model flashing very quick to it's new pos, when you use dontinterpolate() it wont show up when 'moving' to it's new pos so it looks better.
broken avatar :(
×
broken avatar :(
Location: gbMilton Keynes
Date Registered: 17 January 2014
Last active: 4 years ago
Posts
6,877
Respect
1,004Add +1
Forum Rank
Immortal
Primary Group
Community Scripter
My Groups
More
My Contact & Social Links
More
Signature
If you want scripts / features made for you, then contact me by PM or email / skype etc
it will cost you tho so if you have no intention of reciprocating don't even waste my time ;)
×
Harry Bo21's Groups
Donator ♥ Benevolent Soul who has our eternal gratitude and exclusive access to betas and the donator section of the forum.
Community Scripter Has shown effort and knowledge in the area of scripting while being a part of the UGX-Mods community.
Harry Bo21's Contact & Social Links[email protected]HarryBo21HarryBo000
Code Snippet
Plaintext
destination1 = self.origin + ( anglesToForward( self.angles ) * 40 );
destination = playerPhysicsTrace( self.origin, destination1 ) + ( anglesToForward( self.angles ) * 40 );
destination3 = playerPhysicsTrace( destination, destination + ( 0, 0, -1000 ) );
if ( destination != ( destination1 + ( anglesToForward( self.angles ) * 40 ) ) || distance( destination3, destination ) > 50 )
{
shield delete();
self setweaponammoclip( weapname, 1 );
continue;
}

Heres some example code from my shield

I used this to trace to the floor when a shield is placed and to place it "infront" of that player by 40 units, if something blocks it, it returns as far as it could until obstructed. In this case i had it abandon if that place wasnt where it was originally to go, but you could just use the new returned origin, which will be  just before it detected a obstruction

and if it has to drop more than 50 units, it abandons ( coz the shield floated in the air when i placed it over stairs or drops before but i didnt want them placing it on the floor, if the floor was a massive drop away either lol )

Its the same principal here, using  playerPhysicsTrace() will return "up to" the obstruction ;)




Code Snippet
Plaintext
destination1 = self.origin + ( anglesToForward( self.angles ) * 40 );
destination = playerPhysicsTrace( self.origin, destination1 ) + ( anglesToForward( self.angles ) * 40 );

"destination" would be the returned origin, up to the wall obstructing directly infront of you
"destination1" would be the orignal place it would have landed, if the wall wasnt there

if no obstruction, both would be the same
Last Edit: October 11, 2015, 05:56:35 pm by Harry Bo21

 
Loading ...