[Tutorial] Buyable powerups

broken avatar :(
Created 1037 days ago
by shinged
0 Members and 1 Guest are viewing this topic.
4,996 views
broken avatar :(
×
broken avatar :(
Location: us
Date Registered: 17 February 2014
Last active: 98 days ago
Posts
69
Respect
Forum Rank
Rotting Walker
Primary Group
Member
My Contact & Social Links
More
Personal Quote
What is broken can be reforged
Signature
Completed maps:
Kingdom Hearts - World at War Link
Minecraft - Black ops 3 Link

WIP:
~

×
shinged's Groups
shinged's Contact & Social LinksShingedvinny545TheShingedMatarra_
Hey guys, im here with a simple tutorial on how to add buyable powerups. This is what the end result should look like


 So lets start with the script, open up your mapname.gsc located in root/usermaps/mapname/scritps/zm/mapname.gsc
Make sure you dont open the CSC

 Now somewhere at the top of the gsc, add this
#using scripts\zm\_zm_score;

 At the bottom of the main function, add this
thread buyable_powerup();

 Now at the bottom of your gsc paste this
function buyable_powerup()
{
level.buyable_powerup_cost = 100; // Cost for powerup
level.buyable_powerup_cooldown = 20; // Cooldown in seconds for buyable trigger
while(1)
{
while(1)
{
buyable_powerup_trig = GetEnt("buyable_powerup_trig", "targetname");
buyable_powerup_trig SetHintString("Press and hold &&1 to spawn Powerup [Cost: " + level.buyable_powerup_cost + "]");
buyable_powerup_trig SetCursorHint("HINT_NOICON");
buyable_powerup_spawn = struct::get( "powerup_spawn", "targetname" );
buyable_powerup_trig waittill("trigger", player);

if(player.score >= level.buyable_powerup_cost)
{
player zm_score::minus_to_player_score(level.buyable_powerup_cost);

break;
}
}

/*
If you want a specific powerup, then uncomment the buyable_powerup_spawn below and delete or comment out the one above it.
Available Powerups: double_points, free_perk, full_ammo, nuke, fire_sale, carpenter, insta_kill, shield_charge, bonfire_sale,
*/

buyable_powerup_spawn thread zm_powerups::special_powerup_drop(buyable_powerup_spawn.origin);
//buyable_powerup_spawn thread zm_powerups::specific_powerup_drop("full_ammo", buyable_powerup_spawn.origin);

buyable_powerup_trig SetHintString("Recharing...");

wait(level.buyable_powerup_cooldown);
}
}


 Now for the radiant part, all you need is two things, the trigger to buy the powerup and the script_struct for where the powerup will spawn.
Make a trigger_use with this kvp
"buyable_powerup_trig", "targetname"
Make a script_struct with this kvp
"powerup_spawn", "targetname"
broken avatar :(
×
broken avatar :(
Location: es
Date Registered: 21 September 2014
Last active: 688 days ago
Posts
28
Respect
Forum Rank
Legless Crawler
Primary Group
Member
×
Minepro14's Groups
Minepro14's Contact & Social Links
not working for me, the triger says "Not available"
broken avatar :(
×
broken avatar :(
Location: us
Date Registered: 17 February 2014
Last active: 98 days ago
Posts
69
Respect
Forum Rank
Rotting Walker
Primary Group
Member
My Contact & Social Links
More
Personal Quote
What is broken can be reforged
×
shinged's Groups
shinged's Contact & Social LinksShingedvinny545TheShingedMatarra_
not working for me, the triger says "Not available"

You might have given the trigger the wrong kvp, or maybe you scripted something wrong
broken avatar :(
×
broken avatar :(
Location: es
Date Registered: 21 September 2014
Last active: 688 days ago
Posts
28
Respect
Forum Rank
Legless Crawler
Primary Group
Member
×
Minepro14's Groups
Minepro14's Contact & Social Links
i have done what you say
broken avatar :(
×
broken avatar :(
Location: fi
Date Registered: 24 April 2017
Last active: 324 days ago
Posts
2
Respect
Forum Rank
Fresh Corpse
Primary Group
Member
×
LSDsuperfruit's Groups
LSDsuperfruit's Contact & Social Links
bonfire_sale is not working. I can hear the powerup sound, but bonfire sale is not showing up.
broken avatar :(
×
broken avatar :(
Location: nl
Date Registered: 27 November 2017
Last active: 525 days ago
Posts
3
Respect
Forum Rank
Fresh Corpse
Primary Group
Member
My Contact & Social Links
More
×
Overkill_NL's Groups
Overkill_NL's Contact & Social LinksStrijperdijk
Im trying to find the mapname.gsc in usermaps. But I can't find it there, the only place where I find mapname.gsc is in the mods map. Does it still work then?
broken avatar :(
×
broken avatar :(
Location: gb
Date Registered: 24 September 2016
Last active: 11 days ago
Posts
144
Respect
Forum Rank
Pack-a-Puncher
Primary Group
Community Scripter
My Groups
More
My Contact & Social Links
More
Personal Quote
ZombieSlayerr115
Signature
Please. Save me.
×
isaacscott935's Groups
Community Scripter Has shown effort and knowledge in the area of scripting while being a part of the UGX-Mods community.
isaacscott935's Contact & Social LinksZombieSlayerr115isaac935
not working for me, the triger says "Not available"

This error is caused by not having matching KVPs in radiant and in the scripts. Check you copied the script correctly.
broken avatar :(
×
broken avatar :(
Location: gbMilton Keynes
Date Registered: 17 January 2014
Last active: 20 days ago
Posts
6,879
Respect
Forum Rank
Immortal
Primary Group
Community 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.
Community 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 Links[email protected]HarryBo21HarryBo000
Recharing?

 

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 Twitch
Loading ...