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

Gravity Change

HOT
broken avatar :(
Created 9 years ago
by GerardS0406
0 Members and 1 Guest are viewing this topic.
5,658 views
broken avatar :(
×
broken avatar :(
Location: se
Date Registered: 30 July 2013
Last active: 4 weeks ago
Posts
517
Respect
Forum Rank
Zombie Enslaver
Primary Group
Community Scripter
My Groups
More
My Contact & Social Links
More
×
Ege115's Groups
Community Scripter Has shown effort and knowledge in the area of scripting while being a part of the UGX-Mods community.
Ege115's Contact & Social LinksEge115
Here's a low gravity script I made a long long time ago. It may be not the best script but it works decently as far as I know.
Code Snippet
Plaintext
#include maps\_utility;
#include common_scripts\utility;
#include maps\_zombiemode_utility;

init()
{
level thread connect_gravity_on_player();
}

connect_gravity_on_player()
{
for(;;)
{
level waittill( "connecting", player );
player thread onPlayerSpawned();
}
}

onPlayerSpawned()
{
self endon("disconnect");
for(;;)
{
self waittill("spawned_player");
self thread gravity_jump_height();
self thread gravity_watch();
}
}

gravity_watch()
{
        self endon("disconnect");

low_gravity_area = getEntArray("low_gravity_area", "targetname");

while(1)
{
for(i=0;i<low_gravity_area.size;i++)
{
if(low_gravity_area[i].gravity_active && !self isOnGround() && (self getVelocity()[2] > 0 || self getVelocity()[2] < 0))
{
while(!self isOnGround())
{
angles = self getplayerangles();
angles = (0, angles[1], 0);
self SetVelocity( self getVelocity() + AnglesToUp(angles) * 34 );

if(!low_gravity_area[i].gravity_active)
break;

wait .05;
}
}
}

wait .05;
}
}

gravity_jump_height()
{
        self endon("disconnect");

low_gravity_area = getEntArray("low_gravity_area", "targetname");
for(i=0;i<low_gravity_area.size;i++)
low_gravity_area[i].gravity_active = false;

while(1)
{
for(i=0;i<low_gravity_area.size;i++)
{
if(self isTouching(low_gravity_area[i]) && !low_gravity_area[i].gravity_active)
{
low_gravity_area[i].gravity_active = true;
self setClientDvar("jump_height", 12);
}
else if(!self isTouching(low_gravity_area[i]) && low_gravity_area[i].gravity_active)
{
low_gravity_area[i].gravity_active = false;
self setClientDvar("jump_height", 39);
}
}

wait .05;
}
}
You make trigger multiples in the map with the KVP,
Code Snippet
Plaintext
targetname - low_gravity_area
If you touch those, you should have lower gravity when jumping.

If anyone wants this, feel free to edit.

EDIT: Also tell me if any glitches happens with this, or if any other scripter sees something stupid. Note this was a long time ago so I know I should improve it with what I know now. :P
Last Edit: August 01, 2015, 07:07:15 pm by Ege115
broken avatar :(
×
broken avatar :(
Location: us
Date Registered: 14 September 2013
Last active: 4 years ago
Posts
1,895
Respect
Forum Rank
Zombie Destroyer
Primary Group
Community Scripter
My Groups
More
My Contact & Social Links
More
Personal Quote
BE ORIGINAL
Signature
×
MakeCents'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.
BO3 Modtools Alpha
BO3 Modtools Alpha
This user has access to the Black Ops 3 Modtools Alpha
EDIT: Also tell me if any glitches happens with this, or if any other scripter sees something stupid. Note this was a long time ago so I know I should improve it with what I know now. :P

I had a few concerns, even questions, maybe some suggestions. I personally thread as little on the player as possible, cause you get into the, did I end it on death, do I got to start it again, shit, is it running twice? kind of stuff. Like here it doesn't appear you end it on death but you do start it on spawn each spawn. So, since you are using trigger multiples, I would rather use the triggers, then the players to thread things on for the most part. I didn't test any of this, just took your script and tweaked it. What you think?

Code Snippet
Plaintext
#include maps\_utility;
#include common_scripts\utility;
#include maps\_zombiemode_utility;

init()
{
low_gravity_area = getEntArray("low_gravity_area", "targetname");
array_thread(low_gravity_area,::WatchMe);// common_scripts\utility.gsc:
}

WatchMe(){
while(1){
waittill("trigger", player);
if(!isDefined(player.gravAffect)) player thread gravity_affect(self);
wait(.01);
}
}

gravity_affect(grav)
{
self.gravAffect = true;
self setClientDvar("jump_height", 39);
self endon("disconnect");
while(self isTouching(grav))
{
if(!self isOnGround() && (self getVelocity()[2] > 0 || self getVelocity()[2] < 0))
{
while(!self isOnGround())
{
angles = self getplayerangles();
angles = (0, angles[1], 0);
self SetVelocity( self getVelocity() + AnglesToUp(angles) * 34 );
wait .05;
}
}
wait .05;
}
self.gravAffect = undefined;
self setClientDvar("jump_height", 12);
}

broken avatar :(
×
broken avatar :(
Location: se
Date Registered: 30 July 2013
Last active: 4 weeks ago
Posts
517
Respect
Forum Rank
Zombie Enslaver
Primary Group
Community Scripter
My Groups
More
My Contact & Social Links
More
×
Ege115's Groups
Community Scripter Has shown effort and knowledge in the area of scripting while being a part of the UGX-Mods community.
Ege115's Contact & Social LinksEge115
I had a few concerns, even questions, maybe some suggestions. I personally thread as little on the player as possible, cause you get into the, did I end it on death, do I got to start it again, shit, is it running twice? kind of stuff. Like here it doesn't appear you end it on death but you do start it on spawn each spawn. So, since you are using trigger multiples, I would rather use the triggers, then the players to thread things on for the most part. I didn't test any of this, just took your script and tweaked it. What you think?

Code Snippet
Plaintext
#include maps\_utility;
#include common_scripts\utility;
#include maps\_zombiemode_utility;

init()
{
low_gravity_area = getEntArray("low_gravity_area", "targetname");
array_thread(low_gravity_area,::WatchMe);// common_scripts\utility.gsc:
}

WatchMe(){
while(1){
waittill("trigger", player);
if(!isDefined(player.gravAffect)) player thread gravity_affect(self);
wait(.01);
}
}

gravity_affect(grav)
{
self.gravAffect = true;
self setClientDvar("jump_height", 39);
self endon("disconnect");
while(self isTouching(grav))
{
if(!self isOnGround() && (self getVelocity()[2] > 0 || self getVelocity()[2] < 0))
{
while(!self isOnGround())
{
angles = self getplayerangles();
angles = (0, angles[1], 0);
self SetVelocity( self getVelocity() + AnglesToUp(angles) * 34 );
wait .05;
}
}
wait .05;
}
self.gravAffect = undefined;
self setClientDvar("jump_height", 12);
}

Oh shit, didn't mean to make it end on death, fixed on mine now. :-X

Yea yours is much more effective, I usually make player threads on most of my scripts, but I admit that trigger waits are better in this case.
broken avatar :(
×
broken avatar :(
[UGX] Documentation Writer & Programmer
Location: usLos Angeles, CA
Date Registered: 23 August 2013
Last active: 7 months 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.
Community 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
jump_height is a global var it won't affect anyone but host.

 
Loading ...