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

Wait breaks my script

HOT
broken avatar :(
Created 11 years ago
by Eternal_Fire
0 Members and 1 Guest are viewing this topic.
15,077 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 ive been making a script recently and when i add a wait 0.1; it just breaks it so the radius damage doesnt work

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

init()
{
self endon( "disconnect" );
players = get_players();
for(i = 0; i<players.size ; i++)
{
players[i] thread weapon_check();
}
}

weapon_check()
{
while(1)
{
self waittill("weapon_fired");

Weapon = self getcurrentweapon();
if(weapon == "zombie_shotgun")
{
self thread gravity_spikes_main();
}
else if(weapon == "gravity_spikes_upgraded")
{
self thread gravity_spikes_upgraded_main();
}
}
}

gravity_spikes_main()
{
if (self isonground())
{
iprintln("Ground Activate");
self SetVelocity( (AnglesToUp(self.angles + (6,0,0))) * 1000);
self thread SpikeRadiusDamage();
}
else if (!self isonground())
{
iprintln("OffGround Activate");
self SetVelocity( (AnglesToUp(self.angles + (600,0,0))) * -1);
}
}

SpikeRadiusDamage()
{
if (self IsOnGround())
{
iprintln("Radius dmg");
RadiusDamage(self.origin, 500, 1000, 600);
}
}

It works here, but it activated straight away because it still sees a player on the ground so i added a wait 0.1 before "self thread SpikeRadiusDamage" but then the function doesnt work and i dont get the iprintln from that function... Any ideas?
This topic contains a post which is marked as the Best Answer. Click here to view it.
broken avatar :(
×
broken avatar :(
RadihaX
Location: caCanada
Date Registered: 2 September 2012
Last active: 5 years ago
Posts
978
Respect
Forum Rank
The Decider
Primary Group
Mapper Elite
My Groups
More
My Contact & Social Links
More
Signature
Overrun
Lockdown
Overrun (Black Ops Mod)
Snowglobe
Leviathan
Abandoned School
Ski Resort
Leviathan Redux
×
JBird632's Groups
Donator ♥ Benevolent Soul who has our eternal gratitude and exclusive access to betas and the donator section of the forum.
UGX V.I.P.
UGX V.I.P.
Mapper Elite Has shown excellence and experience in the area of custom mapping in the UGX-Mods 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
JBird632's Contact & Social LinksJBird632JBird632JBird632JBird632JBird632Mapper
Well first of all, I'd like to see where your trying to add this wait - cause you might just be putting it in the wrong spot. Secondly, is your gravity spike weapon named "zombie_shotgun"?
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
Well first of all, I'd like to see where your trying to add this wait - cause you might just be putting it in the wrong spot. Secondly, is your gravity spike weapon named "zombie_shotgun"?

I am putting wait at
Code Snippet
Plaintext
gravity_spikes_main()
{
if (self isonground())
{
iprintln("Ground Activate");
self SetVelocity( (AnglesToUp(self.angles + (6,0,0))) * 1000);
                wait 0.1; //wait is here, but then it doesnt work when i try threading?
self thread SpikeRadiusDamage();
}
else if (!self isonground())
{
iprintln("OffGround Activate");
self SetVelocity( (AnglesToUp(self.angles + (600,0,0))) * -1);
}
}

And i just have it set to zombie_shotgun (Yes I do give zombie_shotgun, just incase you were wondering)  atm because i plan on modelling the gravity spikes later, but just want to get the script basics working.
Last Edit: October 15, 2015, 06:28:09 am by Eternal_Fire
broken avatar :(
×
broken avatar :(
RadihaX
Location: caCanada
Date Registered: 2 September 2012
Last active: 5 years ago
Posts
978
Respect
Forum Rank
The Decider
Primary Group
Mapper Elite
My Groups
More
My Contact & Social Links
More
×
JBird632's Groups
Donator ♥ Benevolent Soul who has our eternal gratitude and exclusive access to betas and the donator section of the forum.
UGX V.I.P.
UGX V.I.P.
Mapper Elite Has shown excellence and experience in the area of custom mapping in the UGX-Mods 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
JBird632's Contact & Social LinksJBird632JBird632JBird632JBird632JBird632Mapper
That's quite odd, cause looking at it there should be no issue with putting the wait there.  :/
I would recommend putting an iprintln right after the wait and another right at the beginning of SpikeRadiusDamage() just to see where the issue occurs.

Also, now that I've read through your script I can see a couple other issues as well:
Code Snippet
Plaintext
self endon( "disconnect" );
This won't do anything since its in the init function and not called on a player. You should move that into the beginning of the weapon_check() function.

Secondly I see a little bit of a logic error, if the player isn't on the ground after the wait then it won't do the damage, so you could replace the wait with a while loop that waits until the player is on the ground.

Something like this:
Code Snippet
Plaintext
gravity_spikes_main()
{
if(self isonground())
{
iprintln("Ground Activate");
self SetVelocity( (AnglesToUp(self.angles + (6,0,0))) * 1000);

while(self isonground()) // wait for player to jump
wait(0.05);

while(!self isonground()) // wait for player to land
wait(0.05);

self thread SpikeRadiusDamage();
}
else if(!self isonground())
{
iprintln("OffGround Activate");
self SetVelocity( (AnglesToUp(self.angles + (600,0,0))) * -1);

while(!self isonground()) // wait for player to land
wait(0.05);

self thread SpikeRadiusDamage();
}
}

Also I don't really get what your doing with the setVelocity - but if that works then whatever lol

Edit: I also forgot to mention you can remove the if(self IsOnGround()) statement from the SpikeRadiusDamage() function as well, since the checks are now done in the gravity_spikes_main() function.
Last Edit: October 15, 2015, 06:40:52 am by JBird632
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
That's quite odd, cause looking at it there should be no issue with putting the wait there.  :/
I would recommend putting an iprintln right after the wait and another right at the beginning of SpikeRadiusDamage() just to see where the issue occurs.

Also, now that I've read through your script I can see a couple other issues as well:
Code Snippet
Plaintext
self endon( "disconnect" );
This won't do anything since its in the init function and not called on a player. You should move that into the beginning of the weapon_check() function.

Secondly I see a little bit of a logic error, if the player isn't on the ground after the wait then it won't do the damage, so you could replace the wait with a while loop that waits until the player is on the ground.

Also I don't really get what your doing with the setVelocity - but if that works then whatever lol

Yeah thanks for the disconnect help, forgot that i hadnt defined self. Ech the script logic, just realised XD thanks. Yeah im just messing around with the velocity atm seeing what fits best. Thank you for the help :)
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
Code Snippet
Plaintext
#include maps\_utility;
#include common_scripts\utility;

init()
{
level thread onPlayerConnect();
}

onPlayerConnect()
{
for(;;)
{
level waittill( "connecting", player );

player thread onPlayerSpawned();
}
}

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

for(;;)
{
self waittill( "spawned_player" );

}
}
Use this as the base of the script. Currently the way you're doing it is extremely wrong and will cause issues.
Last Edit: October 15, 2015, 05:55:36 pm by DidUknowiPwn
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
Code Snippet
Plaintext
#include maps\_utility;
#include common_scripts\utility;

init()
{
level thread onPlayerConnect();
}

onPlayerConnect()
{
for(;;)
{
level waittill( "connecting", player );

player thread onPlayerSpawned();
}
}

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

for(;;)
{
self waittill( "spawned_player" );

}
}
Use this as the base of the script. Currently the way you're doing it is extremely wrong and will cause issues.

So i replaced my base with this and now it isnt working?

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

init()
{
level thread onPlayerConnect();
}

onPlayerConnect()
{
for(;;)
{
level waittill( "connecting", player );

player thread onPlayerSpawned();
}
}

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

for(;;)
{
self waittill( "spawned_player" );

self thread weapon_check();
}
}
weapon_check()
{
while(1)
{
self waittill("weapon_fired");
iprintln("weapon fired"); //getting no print?
Weapon = self getcurrentweapon();
if(weapon == "zombie_shotgun")
{
self thread gravity_spikes_main();
}
else if(weapon == "gravity_spikes_upgraded")
{
self thread gravity_spikes_upgraded_main();
}
}
}

gravity_spikes_main()
{
if (self isonground())
{
iprintln("Ground Activate");
self SetVelocity( (AnglesToUp(self.angles + (6,0,0))) * 1000);
wait 0.1;
self thread SpikeRadiusDamage();
}
else if (!self isonground())
{
iprintln("OffGround Activate");
self SetVelocity( (AnglesToUp(self.angles + (600,0,0))) * -1);
}
}

SpikeRadiusDamage()
{
if(!self isonground())
{
while(self IsOnGround())
{
iprintln("Radius dmg");
RadiusDamage(self.origin, 500, 1000, 600);
self thread weapon_check();
}
}
}
broken avatar :(
×
broken avatar :(
RadihaX
Location: caCanada
Date Registered: 2 September 2012
Last active: 5 years ago
Posts
978
Respect
Forum Rank
The Decider
Primary Group
Mapper Elite
My Groups
More
My Contact & Social Links
More
×
JBird632's Groups
Donator ♥ Benevolent Soul who has our eternal gratitude and exclusive access to betas and the donator section of the forum.
UGX V.I.P.
UGX V.I.P.
Mapper Elite Has shown excellence and experience in the area of custom mapping in the UGX-Mods 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
JBird632's Contact & Social LinksJBird632JBird632JBird632JBird632JBird632Mapper
A few issues again:

1. gravity_spikes_upgraded_main() isn't a defined function, so you will get an undefined function error.
2. Your while loop in SpikeRadiusDamage() has no wait in it and this will give you an infinite loop error.
3. Logically it doesn't make sense for your while loop to even be there, basically if the player is on the ground then it just keeps doing a radius damage forever.
4. You do not need to recursively call weapon_check() if its already on a loop
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
How did you even "copy" this wrong?  :D

DUKNIPWNS -
Code Snippet
Plaintext
onPlayerConnect()
{
for(;;)
{
level waittill( "connecting", player );

player thread onPlayerSpawned();
}
}

Yours -

Code Snippet
Plaintext
onPlayerSpawned()
{
self endon( "disconnect" );

for(;;)
{
self waittill( "spawned_player" );

self thread weapon_check();
}
}

level waittill( "spawned_player" );
player thread onPlayerSpawned();
Last Edit: October 16, 2015, 08:24:51 pm by Harry Bo21
broken avatar :(
×
broken avatar :(
Senpai
Location: us
Date Registered: 28 September 2013
Last active: 10 months ago
Posts
602
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
that is what dukip put if u look your comparing 2 functions that dukip had made not the same function
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
that is what dukip put if u look your comparing 2 functions that dukip had made not the same function
what DUKIPWN posted is the "correct" method to initiating a script "on player connect"

his version was just that, changed, and changed to "wrong"

this is what he was told to copy, and he said he did

you wouldnt need both
Last Edit: October 16, 2015, 09:33:27 pm by Harry Bo21
broken avatar :(
×
broken avatar :(
Senpai
Location: us
Date Registered: 28 September 2013
Last active: 10 months ago
Posts
602
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
I'm still failing to see what your saying is wrong I've looked at both and there the same except for this line:
Code Snippet
Plaintext
		self thread weapon_check();
and what he added underneath it those are the only things changed
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
I'm still failing to see what your saying is wrong I've looked at both and there the same except for this line:
Code Snippet
Plaintext
		self thread weapon_check();
and what he added underneath it those are the only things changed
ignore me, i see now
Last Edit: October 16, 2015, 09:39:59 pm 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
A few issues again:

1. gravity_spikes_upgraded_main() isn't a defined function, so you will get an undefined function error.
2. Your while loop in SpikeRadiusDamage() has no wait in it and this will give you an infinite loop error.
3. Logically it doesn't make sense for your while loop to even be there, basically if the player is on the ground then it just keeps doing a radius damage forever.
4. You do not need to recursively call weapon_check() if its already on a loop

1. It is defined, i just didnt include it in the script i was showing because it is the same as gravity_spikes_main() because i havent worked on it yet.

2/3/4 I made it so it would do the radius damage then it would thread weapon check which would then wait til the player fired again and loop around... thought that would work...

Double Post Merge: October 18, 2015, 08:26:08 am
How did you even "copy" this wrong?  :D

DUKNIPWNS -
Code Snippet
Plaintext
onPlayerConnect()
{
for(;;)
{
level waittill( "connecting", player );

player thread onPlayerSpawned();
}
}

Yours -

Code Snippet
Plaintext
onPlayerSpawned()
{
self endon( "disconnect" );

for(;;)
{
self waittill( "spawned_player" );

self thread weapon_check();
}
}

level waittill( "spawned_player" );
player thread onPlayerSpawned();

This is where i question my life.... Dunno how tf i copied wrong jeez XD

EDIT: Hang on... Those are 2 different functions -.- of course they aren't the same
Last Edit: October 18, 2015, 08:27: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
×
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
lol yes i see my mistake now

even still tho i cant see why youd need both, for what your doing on connect should be plenty, but yes dumb comment lol
Last Edit: October 18, 2015, 10:29:22 am by Harry Bo21

 
Loading ...