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

Jump script trouble

broken avatar :(
Created 11 years ago
by Eternal_Fire
0 Members and 1 Guest are viewing this topic.
1,632 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've just written up a quick jump script but for some reason it isn't working, when i press the "use" button in the air, it doesn't do what it should do. Script is below.
Code Snippet
Plaintext
jump_test()
{
        wait 2;
        player = get_players();
        array_thread(player,::play_in_air_check);
}
 
play_in_air_check()
{
self endon( "death" );
self endon( "disconect" );
angles = self getplayerangles();
 
        while( !self IsOnGround() )
        {
                if( self UseButtonPressed() )
                {
                        iprintln("test jump");
                        self SetVelocity( (AnglesToUp(angles)) * 800 );
                        wait 0.1;
                        continue;
                }
        }
 
}

Double Post Merge: August 09, 2015, 11:36:17 am
Ech, never mind, i fixed it
Last Edit: August 09, 2015, 11:36:17 am by Eternal_Fire
broken avatar :(
×
broken avatar :(
Location: gbMilton Keynes
Date Registered: 17 January 2014
Last active: 6 years ago
Posts
6,875
Respect
Forum Rank
Immortal
Primary Group
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.
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 LinksHarryBo000[email protected]HarryBo21
you have a infinite loop if the person is in the air but "not" pressing the use button

make sure there is a wait in a loop, no matter what or itll infinate run and then just end the thread to prevent the entire game just crashing out

Code Snippet
Plaintext
while( !self IsOnGround() )
        {
                // if( self UseButtonPressed() )
                // {
                //         iprintln("test jump");
                //         self SetVelocity( (AnglesToUp(angles)) * 800 );
                //         wait 0.1;
                //         continue;
                // }
             // NO WAIT
        }


also this :

Code Snippet
Plaintext
angles = self getplayerangles();

needs to be defined "in" the loop, not before it, or itll grab your start angles, and never update again

also as a tip, this will qualify when "falling" too, might wanna add a check that their Z goes up at least slightly before qualifying, otherwise - they "fell" and didnt jump
Last Edit: August 12, 2015, 12:06:40 am by Harry Bo21
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
you have a infinite loop if the person is in the air but "not" pressing the use button

make sure there is a wait in a loop, no matter what or itll infinate run and then just end the thread to prevent the entire game just crashing out

Code Snippet
Plaintext
while( !self IsOnGround() )
        {
                // if( self UseButtonPressed() )
                // {
                //         iprintln("test jump");
                //         self SetVelocity( (AnglesToUp(angles)) * 800 );
                //         wait 0.1;
                //         continue;
                // }
             // NO WAIT
        }


also this :

Code Snippet
Plaintext
angles = self getplayerangles();

needs to be defined "in" the loop, not before it, or itll grab your start angles, and never update again

also as a tip, this will qualify when "falling" too, might wanna add a check that their Z goes up at least slightly before qualifying, otherwise - they "fell" and didnt jump

Yes, when I said That I fixed it, I also fixed that as well, anyways, thank you for pointing that out I guess.
broken avatar :(
×
broken avatar :(
Location: gbMilton Keynes
Date Registered: 17 January 2014
Last active: 6 years ago
Posts
6,875
Respect
Forum Rank
Immortal
Primary Group
Scripter
My Groups
More
My Contact & Social Links
More
×
Harry Bo21's Groups
Donator ♥ Benevolent Soul who has our eternal gratitude and exclusive access to betas and the donator section of the forum.
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 LinksHarryBo000[email protected]HarryBo21
sorry, you know me, cant help but answer questions that dont need answering  :D

glad it worked out for you ;)

 
Loading ...