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

Gobble Gum Machine Prefab + Script! lad420 Edition help!!

broken avatar :(
Created 6 years ago
by kitos
0 Members and 1 Guest are viewing this topic.
2,319 views
broken avatar :(
×
broken avatar :(
Location: es
Date Registered: 25 May 2016
Last active: 4 years ago
Posts
98
Respect
Forum Rank
Rotting Walker
Primary Group
Member
×
kitos's Groups
kitos's Contact & Social Links
can you help me with this script I try to make the tutorial of goble gum but i don´t know why appears a image of hand when I try to buy gobble gum

this is the code

Code Snippet
Plaintext
//Add this script into your mapname.gsc file
//Add this: thread gobble_gum_machine(); after
 
/*--------------------
FUNCTION CALLS - PRE _Load
----------------------*/
//level thread DLC3_threadCalls();
//thread gobble_gum_machine(); HERE
 
 
gobble_gum_machine()
{
    //image of gobble gum
    PrecacheShader( "specialty_gobble_gum_zombies");
    PrecacheShader( "specialty_nuke");
    //cost of gobble gum buy
    cost = 500;
   
    //activate the following script code when player buys perk
    trigger = getEnt("gobble_gum_trigger", "targetname");
 
   
    bought_round_number = undefined;
    //level.round_number = 0;
    last_round = 0;
   
    trigger setHintString ("Hold &&1 to dispense Gobble Gum [500]");
                   
        //hold code till trigger is activated
        trigger waittill("trigger", player);
           
        using_player = player;
           
        //random gumball script here
            //--------------------------------------
        gobble_gums_index = 0;
           
        gobble_gums = [];
               
        add_to_array("gobble_gums","insta_kill");
        add_to_array("gobble_gums","double_points");
        add_to_array("gobble_gums","nuke");
        add_to_array("gobble_gums","plain_sight");
        add_to_array("gobble_gums","pack_a_punch");
               
        //gobble_gum = gobble_gums[RandomInt(gobble_gums.size)];
               
        //gobble_gum = array_randomize(gobble_gums);
               
        //if( gobble_gums_index >= gobble_gums.size )
        //{
        //  gobble_gums_index = 0;
        //  randomize_gobble_gums(gobble_gums);
        //}
               
        //gobble_gums_index++;
               
        //--------------------------------------
        //final gumball selected from script
        //this pack a punch gobble gum packs my current gun for 30 seconds and then returns the old one after the time has ran out!
        gumball = "pack_a_punch";
        //this gumball code will give me the gumball without picking a random one
        //--------------------------------------
           
           
        if ( player.score < cost )
        {
            //player iprintln( "Not enough points to buy Perk: " + perk );
            self playsound("deny");
            player thread play_no_money_perk_dialog();
            //continue;
        }
        else
        {
            //blur players view for effect
            player setblur( 4, 0.1 );
            wait(0.6);
            player setblur(0, 0.1);
               
            //add the image of the shader to the hud
            player thread gumball_hud_create(gumball);
                   
            //subtract players points for the cost of the gobble gum machine
            player maps\_zombiemode_score::minus_to_player_score(cost);
               
            player thread gobble_gum_activate(using_player, gumball);
           
            //bought_round_number = level.round_number;
        }
       
        //rerun the gobble gum machine script so it keeps running
        thread gobble_gum_machine();
   
}
 
gobble_gum_activate(using_player, gumball)
{
    perk_bottle = "specialty_quickrevive";
    while(1)
    {
        if(using_player useButtonPressed())
        {
            if(gumball == "none")
            {
                //iprintln("You have no gobble gums!");
            }
            else
            {
                //get players gun
                gun = self GetCurrentWeapon();
               
                //eat gobble gum when pressed button
                thread perk_give_bottle_begin(perk_bottle);
               
                //play blowing bubble sound effect
                //using_player playsound("blowing_gobble_gum");
                //notify player the gumball is being chewed (the player has the gumball)
                iprintln("Chewing Gobble Gum!");
                wait 3;
                thread perk_give_bottle_end(gun, perk_bottle);
               
                //remove gobble gum from hud because it was used
                using_player thread gumball_hud_destroy(gumball);
               
                //player eat gumball and recieve effects
                thread player_eat(gumball, using_player, gun);
                using_player setElectrified(true);
                gumball = "none";
            }
            wait 1;
        }
        wait 0.01;
       
    }
}
 
player_eat(gumball, using_player, gun)
{
    if(gumball == "insta_kill")
    {
        maps\_zombiemode_powerups::insta_kill_powerup();
    }
    if(gumball == "nuke")
    {
        maps\_zombiemode_powerups::nuke_powerup();
    }
    if(gumball == "max_ammo")
    {
        maps\_zombiemode_powerups::full_ammo_powerup();
    }
    if(gumball == "carpenter")
    {
       
    }
    if(gumball == "double_points")
    {
        maps\_zombiemode_powerups::double_points_powerup();
    }
    if(gumball == "pack_a_punch")
    {
        //time how long the player gets to use their pack-a-punched gun (seconds)
        level.packapunch_timeout = 30;
       
        packa_timer = spawn("script_origin", self.origin);
       
        using_player TakeWeapon(gun);
        using_player GiveWeapon(gun+"_upgraded");
        //using_player GiveMaxAmmo(gun+"_upgraded");
        using_player switchToWeapon(gun+"_upgraded");
       
        self thread wait_for_timeout(packa_timer);
        self waittill("pap_timeout");
       
        using_player TakeWeapon(self GetCurrentWeapon());
        wait 0.01;
        using_player GiveWeapon(gun);
        using_player switchToWeapon(gun);
    }
    //perkacholic is still beta
    if(gumball == "perkacholic")
    {
        using_player perk_hud_create("specialty_armorvest");
        using_player perk_hud_create("specialty_quickrevive");
        using_player perk_hud_create("specialty_fastreload");
        using_player perk_hud_create("specialty_rof");
        using_player.health = 300;
    }
    if(gumball == "plain_sight")
    {
        zombies = getaiarray("axis");
        zombies flagEnemyUnattackable();
    }
    if(gumball == "anywhere_but_here")
    {
        doggie = getent("start_zone_spawners_dog", "targetname");
        using_player setOrigin(doggie.origin);
        //using_player setElectrified(true);
    }
}
 
wait_for_timeout(packa_timer)
{
    wait( level.packapunch_timeout );
   
    self notify( "pap_timeout" );
    //packa_timer stoploopsound(.05);
    //packa_timer playsound( "packa_deny" );
}
 
gumball_hud_create(gumball)
{
    if ( !IsDefined( self.gumball_hud ) )
    {
        self.gumball_hud = [];
    }
 
    /#
        if ( GetDVarInt( "zombie_cheat" ) >= 5 )
        {
            if ( IsDefined( self.gumball_hud[gumball] ) )
            {
                return;
            }
        }
#/
        shader = "";
        overlay = "";
 
        switch(gumball)
        {
        case "pack_a_punch":
            shader = "specialty_gobble_gum_zombies";
            break;
       
        case "insta_kill":
            shader = "specialty_gobble_gum_zombies";
            break;
           
        case "nuke":
            shader = "specialty_nuke";
            break;
           
        case "max_ammo":
            shader = "specialty_gobble_gum_zombies";
            break;
           
        case "double_points":
            shader = "specialty_gobble_gum_zombies";
            break;
           
        case "carpenter":
            shader = "specialty_gobble_gum_zombies";
            break;
           
        case "perkacholic":
            shader = "specialty_gobble_gum_perkacholic";
            break;
           
        case "plain_sight":
            shader = "specialty_gobble_gum_zombies";
            break;
 
        default:
            shader = "specialty_gobble_gum_zombies";
            break;
        }
 
        hud = create_simple_hud( self );
        hud.foreground = true;
        hud.sort = 1;
        hud.hidewheninmenu = false;
        hud.alignX = "right";
        hud.alignY = "bottom";
        hud.horzAlign = "right";
        hud.vertAlign = "bottom";
        hud.x = self.gumball_hud.size - 35;
        hud.y = hud.y - 100;
        hud.alpha = 1;
        hud SetShader( shader, 48, 48 );
 
        self.gumball_hud2[ gumball ] = hud;
       
}
 
perk_hud_create( perk )
{
    if ( !IsDefined( self.perk_hud ) )
    {
        self.perk_hud = [];
    }
 
    /#
        if ( GetDVarInt( "zombie_cheat" ) >= 5 )
        {
            if ( IsDefined( self.perk_hud[ perk ] ) )
            {
                return;
            }
        }
#/
 
 
        shader = "";
 
        switch( perk )
        {
        case "specialty_armorvest":
            shader = "specialty_juggernaut_zombies";
            break;
 
        case "specialty_quickrevive":
            shader = "specialty_quickrevive_zombies";
            break;
 
        case "specialty_fastreload":
            shader = "specialty_fastreload_zombies";
            break;
 
        case "specialty_rof":
            shader = "specialty_doubletap_zombies";
            break;
 
        default:
            shader = "";
            break;
        }
 
        hud = create_simple_hud( self );
        hud.foreground = true;
        hud.sort = 1;
        hud.hidewheninmenu = false;
        hud.alignX = "left";
        hud.alignY = "bottom";
        hud.horzAlign = "left";
        hud.vertAlign = "bottom";
        hud.x = self.perk_hud.size * 30;
        hud.y = hud.y - 70;
        hud.alpha = 1;
        hud SetShader( shader, 24, 24 );
 
        self.perk_hud[ perk ] = hud;
       
}
 
gumball_hud_destroy(gumball)
{
    self.gumball_hud[gumball] destroy_hud();
    self.gumball_hud[gumball] = undefined;
}
 
perk_hud_destroy(perk)
{
    self.perk_hud[perk] destroy_hud();
    self.perk_hud[perk] = undefined;
}
 
perk_give_bottle_begin(perk_bottle)
{
    self DisableOffhandWeapons();
    self DisableWeaponCycling();
 
    self AllowLean( false );
    self AllowAds( false );
    self AllowSprint( false );
    self AllowProne( false );     
    self AllowMelee( false );
 
    wait( 0.05 );
 
    if ( self GetStance() == "prone" )
    {
        self SetStance( "crouch" );
    }
 
    gun = self GetCurrentWeapon();
    weapon = "";
 
    switch( perk_bottle )
    {
    case "specialty_armorvest":
        weapon = "zombie_perk_bottle_jugg";
        break;
 
    case "specialty_quickrevive":
        weapon = "zombie_perk_bottle_revive";
        break;
 
    case "specialty_fastreload":
        weapon = "zombie_perk_bottle_sleight";
        break;
 
    case "specialty_rof":
        weapon = "zombie_perk_bottle_doubletap";
        break;
    }
 
    self GiveWeapon( weapon );
    self SwitchToWeapon( weapon );
 
    return gun;
}
 
 
perk_give_bottle_end(gun, perk_bottle)
{
    assert( gun != "zombie_perk_bottle_doubletap" );
    assert( gun != "zombie_perk_bottle_revive" );
    assert( gun != "zombie_perk_bottle_jugg" );
    assert( gun != "zombie_perk_bottle_sleight" );
    assert( gun != "syrette" );
 
    self EnableOffhandWeapons();
    self EnableWeaponCycling();
 
    self AllowLean( true );
    self AllowAds( true );
    self AllowSprint( true );
    self AllowProne( true );       
    self AllowMelee( true );
    weapon = "";
    switch( perk_bottle )
    {
    case "specialty_armorvest":
        weapon = "zombie_perk_bottle_jugg";
        break;
 
    case "specialty_quickrevive":
        weapon = "zombie_perk_bottle_revive";
        break;
 
    case "specialty_fastreload":
        weapon = "zombie_perk_bottle_sleight";
        break;
 
    case "specialty_rof":
        weapon = "zombie_perk_bottle_doubletap";
        break;
    }
 
    // TODO: race condition?
    if ( self maps\_laststand::player_is_in_laststand() )
    {
        self TakeWeapon(weapon);
        return;
    }
 
    if ( gun != "none" && gun != "mine_bouncing_betty" )
    {
        self SwitchToWeapon( gun );
    }
    else
    {
        // try to switch to first primary weapon
        primaryWeapons = self GetWeaponsListPrimaries();
        if( IsDefined( primaryWeapons ) && primaryWeapons.size > 0 )
        {
            self SwitchToWeapon( primaryWeapons[0] );
        }
    }
 
    self GiveWeapon(gun);
    self SwitchToWeapon(gun);
}
 
play_no_money_perk_dialog()
{
   
    index = maps\_zombiemode_weapons::get_player_index(self);
   
    player_index = "plr_" + index + "_";
    if(!IsDefined (self.vox_nomoney_perk))
    {
        num_variants = maps\_zombiemode_spawner::get_number_variants(player_index + "vox_nomoney_perk");
        self.vox_nomoney_perk = [];
        for(i=0;i<num_variants;i++)
        {
            self.vox_nomoney_perk[self.vox_nomoney_perk.size] = "vox_nomoney_perk_" + i;   
        }
        self.vox_nomoney_perk_available = self.vox_nomoney_perk;       
    } 
    sound_to_play = random(self.vox_nomoney_perk_available);
   
    self.vox_nomoney_perk_available = array_remove(self.vox_nomoney_perk_available,sound_to_play);
   
    if (self.vox_nomoney_perk_available.size < 1 )
    {
        self.vox_nomoney_perk_available = self.vox_nomoney_perk;
    }
           
    self maps\_zombiemode_spawner::do_player_playdialog(player_index, sound_to_play, 0.25);
   
}

and this is the tutorial that I see:

http://ugx-mods.com/forum/index.php?topic=10044.0

please help me

broken avatar :(
×
broken avatar :(
Location: deDortmund
Date Registered: 20 December 2015
Last active: 4 months ago
Posts
307
Respect
Forum Rank
Perk Hacker
Primary Group
Community Scripter
My Groups
More
Personal Quote
Payback
Signature
Tears Of The Fallen | Join the project https://discord.gg/8gDNQRj
×
fanmagic's Groups
Community Scripter Has shown effort and knowledge in the area of scripting while being a part of the UGX-Mods community.
fanmagic's Contact & Social LinksTears Of The Fallen
It's not a very good script. If you need the gobblegum system from BO3 you can wait untill AllMoDs has finished his project and download it here
 http://ugx-mods.com/forum/index.php/topic,16022.0.html
broken avatar :(
×
broken avatar :(
Location: es
Date Registered: 25 May 2016
Last active: 4 years ago
Posts
98
Respect
Forum Rank
Rotting Walker
Primary Group
Member
×
kitos's Groups
kitos's Contact & Social Links
i need from cod waw
broken avatar :(
×
broken avatar :(
Location: deDortmund
Date Registered: 20 December 2015
Last active: 4 months ago
Posts
307
Respect
Forum Rank
Perk Hacker
Primary Group
Community Scripter
My Groups
More
Personal Quote
Payback
×
fanmagic's Groups
Community Scripter Has shown effort and knowledge in the area of scripting while being a part of the UGX-Mods community.
fanmagic's Contact & Social LinksTears Of The Fallen
i need from cod waw
It's for World at War.

 
Loading ...