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

[Tutorial] Buyable powerups

broken avatar :(
Created 7 years ago
by shinged
0 Members and 1 Guest are viewing this topic.
9,212 views
broken avatar :(
×
broken avatar :(
Location: us
Date Registered: 17 February 2014
Last active: 1 year 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
Code Snippet
Plaintext
#using scripts\zm\_zm_score;

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

 Now at the bottom of your gsc paste this
Code Snippet
Plaintext
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
Code Snippet
Plaintext
"buyable_powerup_trig", "targetname"
Make a script_struct with this kvp
Code Snippet
Plaintext
"powerup_spawn", "targetname"
broken avatar :(
×
broken avatar :(
Location: es
Date Registered: 21 September 2014
Last active: 6 years 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: 1 year 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: 6 years 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: 4 years 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: 6 years 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: 3 years 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: 4 years ago
Posts
6,877
Respect
1,004Add +1
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?
broken avatar :(
×
broken avatar :(
Location: usUnited States
Date Registered: 23 August 2013
Last active: 4 years ago
Posts
10
Respect
Forum Rank
Legless Crawler
Primary Group
Member
×
BIGCountrysTV's Groups
BIGCountrysTV's Contact & Social LinksBIGCountrysTV
I know this is an old post but hoping someone will respond.

Is there a way to put a delay before the actual powerup spawns at the location? I want a delay to activate a sound then have it appear. This is what I have been trying but isnt working.

level.buyable_powerup_cost = 2500; // Cost for powerup
level.buyable_powerup_delay = 10; //Delay before the powerup appears in seconds
level.buyable_powerup_cooldown = 10; // Cooldown in seconds for buyable trigger in seconds

Line 2 is the line I put in for the delay.

Any help is appreciated

Thanks

EDIT:
I figured it out. Dont know how to delete :P
Last Edit: January 07, 2020, 03:08:07 pm by BIGCountrysTV

 
Loading ...