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

Functions not threading properly.

broken avatar :(
Created 7 years ago
by HyperFirez
0 Members and 1 Guest are viewing this topic.
2,126 views
broken avatar :(
×
broken avatar :(
Location: us
Date Registered: 6 July 2015
Last active: 4 years ago
Posts
114
Respect
Forum Rank
Pack-a-Puncher
Primary Group
Member
My Contact & Social Links
More
Signature
Maps:
Standoff Zombies [WIP]
Der Blitzdrache [WIP] (Maybe Canceled)
FNAF 1-4 [WIP] (Maybe Canceled)
×
HyperFirez's Groups
HyperFirez's Contact & Social LinksHyperFirezHyperFirezHyperFirezHyperFirezHyperFirezHyperFirezHyperFirez
Yet another problem with my Gobblegum script... When I call the "gumball" function, (that is where it picks a random number and gives you the gumball),  it picks a random number, but doesn't thread the gobblegum that it chose. Script (Simplified)

Double Post Merge: January 04, 2017, 03:04:36 am
Also, even though I have a playable area trigger, the powerups from the "Kill Joy", "Dead of Nuclear Winter", etc... Doesn't spawn them anymore.
Last Edit: January 04, 2017, 03:04:36 am by HyperFirez
Marked as best answer by HyperFirez 7 years ago
broken avatar :(
×
broken avatar :(
Location: aupotato
Date Registered: 27 September 2013
Last active: 3 years ago
Posts
588
Respect
Forum Rank
Zombie Enslaver
Primary Group
Community Scripter
My Groups
More
My Contact & Social Links
More
Signature
respect the dead

donates greatly appreciated :) paypal.me/F3ARxReaper666
discord server:
https://discord.gg/tsGHW99
×
death_reaper0'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.
Yet another problem with my Gobblegum script... When I call the "gumball" function, (that is where it picks a random number and gives you the gumball),  it picks a random number, but doesn't thread the gobblegum that it chose. Script (Simplified)

Double Post Merge: January 04, 2017, 03:04:36 am
Also, even though I have a playable area trigger, the powerups from the "Kill Joy", "Dead of Nuclear Winter", etc... Doesn't spawn them anymore.

would it have anything to do with nothing is defined for threading it, therefor is not defining the player to do the effect?
things like
Code Snippet
Plaintext
 thread gumball();

should be
Code Snippet
Plaintext
player thread gumball();

then in the thread gumball()
Code Snippet
Plaintext

gumball()
{
    gum = RandomIntRange( 0,4 ); // <min value>, <max value> | zero counts as a number!

    switch( gum )
    {
        case 0:
  iprintln("Case 0");
  player thread anywhere_but_here();
          break;

case 1:
  iprintln("Case 1");
  player thread dead_of_nuclear_winter();
  break;

case 2:
  iprintln("Case 2");
  player thread cache_back();
  break;

case 3:
  iprintln("Case 3");
  player thread kill_joy();
  break;

        default:
            break;
    }
}




Double Post Merge: January 04, 2017, 06:59:39 am
Code Snippet
Plaintext

cache_back()
{
//iprintln("cache_back function activated");
for ( i = 0; i < level.zombie_powerup_array.size; i++ )
{
if ( level.zombie_powerup_array[i] == "full_ammo" )
{
level.zombie_powerup_index = i;
break;
}
}

player = get_players();
level.zombie_vars["zombie_drop_item"] = 1;
level.powerup_drop_count = 0;
wait(1);
level thread maps\_zombiemode_powerups::powerup_drop(player.origin + (100, 0, 10));
}


also theres nothing defining the player here, you have it getting an array of all players then dropping it at that spot, which idek how that would work. change the powerup funcions to something like this

Code Snippet
Plaintext

cache_back()
{
//iprintln("cache_back function activated");
for ( i = 0; i < level.zombie_powerup_array.size; i++ )
{
if ( level.zombie_powerup_array[i] == "full_ammo" )
{
level.zombie_powerup_index = i;
break;
}
}
level.zombie_vars["zombie_drop_item"] = 1;
level.powerup_drop_count = 0;
wait(1);
level thread maps\_zombiemode_powerups::powerup_drop(self.origin + (100, 0, 10));
}

Last Edit: January 04, 2017, 06:59:39 am by death_reaper0
broken avatar :(
×
broken avatar :(
Location: us
Date Registered: 6 July 2015
Last active: 4 years ago
Posts
114
Respect
Forum Rank
Pack-a-Puncher
Primary Group
Member
My Contact & Social Links
More
×
HyperFirez's Groups
HyperFirez's Contact & Social LinksHyperFirezHyperFirezHyperFirezHyperFirezHyperFirezHyperFirezHyperFirez
When I put player thread in the gumball() function, it says that it is an uninitialized variable...
broken avatar :(
×
broken avatar :(
Location: aupotato
Date Registered: 27 September 2013
Last active: 3 years ago
Posts
588
Respect
Forum Rank
Zombie Enslaver
Primary Group
Community Scripter
My Groups
More
My Contact & Social Links
More
×
death_reaper0'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.
When I put player thread in the gumball() function, it says that it is an uninitialized variable...
oh my bad, when a script is called by a player, self is whats used to thread other threads, so chnage all the players in gumball to self
broken avatar :(
×
broken avatar :(
Location: us
Date Registered: 6 July 2015
Last active: 4 years ago
Posts
114
Respect
Forum Rank
Pack-a-Puncher
Primary Group
Member
My Contact & Social Links
More
×
HyperFirez's Groups
HyperFirez's Contact & Social LinksHyperFirezHyperFirezHyperFirezHyperFirezHyperFirezHyperFirezHyperFirez
oh my bad, when a script is called by a player, self is whats used to thread other threads, so chnage all the players in gumball to self
When is player used?
Last Edit: January 04, 2017, 11:37:03 pm by HyperFirez
broken avatar :(
×
broken avatar :(
Location: aupotato
Date Registered: 27 September 2013
Last active: 3 years ago
Posts
588
Respect
Forum Rank
Zombie Enslaver
Primary Group
Community Scripter
My Groups
More
My Contact & Social Links
More
×
death_reaper0'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.
well theres lots of things that can define the player, for example:

if you have a trigger to be activated by a player you would normally have something like
Code Snippet
Plaintext
      gumball_machine waittill("trigger", player);

this tells the script that whoever activates the trigger, will be defined as "player" for the rest of that function, or untill that line is reintroduced. it doesnt have to be called "player" either, you can have it as anything you want but id recommend something thats easy to understand, like player or user. if a player is used to call a function like
Code Snippet
Plaintext
player thread function_name();

inside that function the player will be defined as "self" so if you want the player that called that thread to do something, have it as "self do_something()" instead of player.

theres a lot of things to learn for this,  so i dont really have the time to go through them all, but from the look of your script you shouldnt need any other way just yet (you will probably need it for some of the gumball effects)
broken avatar :(
×
broken avatar :(
Location: us
Date Registered: 6 July 2015
Last active: 4 years ago
Posts
114
Respect
Forum Rank
Pack-a-Puncher
Primary Group
Member
My Contact & Social Links
More
×
HyperFirez's Groups
HyperFirez's Contact & Social LinksHyperFirezHyperFirezHyperFirezHyperFirezHyperFirezHyperFirezHyperFirez
Thanks again. Also thanks for the mini tutorial.  :P

 
Loading ...