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

Buyable bonus

broken avatar :(
Created 3 months ago
by Samoth
0 Members and 1 Guest are viewing this topic.
316 views
broken avatar :(
×
broken avatar :(
Location: fr
Date Registered: 24 September 2020
Last active: 2 months ago
Posts
3
Respect
Forum Rank
Fresh Corpse
Primary Group
Member
×
Samoth's Groups
Samoth's Contact & Social Links
Hello this is my first post and "tutorial". This fonction is inspired by NGcaudle tutorial (buyable ending) so thx.
This have for effect to buys with a trigger a bonus spawnable in a script_struct. Exemple for max ammo.
 
Step 1- Go to yourmapname.gsc, u can find this file in Blackops/raw/maps and open it.
 
Step 2- Find this line in youmapname.gsc "maps_zombiemode::main();" below past this :
Code Snippet
Plaintext
    ammo_trig = getentarray( "max_ammo","targetname" );
    array_thread( ammo_trig,::max_ammo );
Step 3 - At the bottom of this same file "yourmapname.gsc" paste this
 
Code Snippet
Plaintext
//////Buyable bonus by Samoth
 
max_ammo()
{
    user = undefined;
    cost = 5000;                        // Cost here
    self setCursorHint("HINT_NOICON");
    self UseTriggerRequireLookAt();
    self setHintString("press ^3&&1 ^7Max Ammo [Cost: "+cost+"]"); // Hintstring for buyable ammo
 
    while(1)
    {
        self waittill("trigger", user);
        if( is_player_valid(user) && user.score >= cost )
        {
            play_sound_at_pos( "cha_ching", self.origin );
            user thread maps\_zombiemode_score::minus_to_player_score( cost );
 
            //self delete(); add this if u want delete trigger after use
 
            level notify( "max_ammo" );
            level thread give_max_ammo();
        }
        else
        {
            play_sound_at_pos( "no_cha_ching", self.origin );
        }
    }
}
 
give_max_ammo()
{
    struct = getstruct("maxammo_spawn","targetname"); // name of struct
    maps\_zombiemode_powerups::specific_powerup_drop( "full_ammo", struct.origin ); // full ammo= name of bonus
}
////////

You can change variable of text u want say and the cost, as well as your bonus type.
I don't know if it's necessary but I advise you to copy the following files in your mods/map. (if you don't have this map folder create it).
go to blackops/raw/maps:
 
_zombiemode_powerups
And
_zombiemode_score
 
this is for the function access thread
 
Steps4 go to radiant ---> and create a trigger use with thats keys:
targetname  "max_ammo" and target "maxammo_spawn"

 
And a script_struct with thats key:
targetname maxammo_spawn

 
The bonus spawns at the location of the script_struct that can be activated by the trigger. Because the trigger targets the struct.
Don't forget to build and compile. You'r done.
 
Credit:
Samoth
NGcaudle
Tom_BMX
Vertasea
Last Edit: February 10, 2024, 07:48:51 pm by Samoth
broken avatar :(
×
broken avatar :(
Location: ru
Date Registered: 19 March 2021
Last active: 2 months ago
Posts
30
Respect
Forum Rank
Legless Crawler
Primary Group
Member
My Contact & Social Links
More
×
great dude, I made the "instant kill" bonus work, a pretty useful and logical function, can you still teach a lesson, for example, how to add a purchased elevator that works after turning on the power, with a closing door, and so that it makes sounds when you ride in it, and also preferably with switching light bulbs (red-green, like in a trap)?That would be very wonderful.


Double Post Merge: February 11, 2024, 03:44:09 pm
great dude, I made the "instant kill" bonus work, a pretty useful and logical function, can you still teach a lesson, for example, how to add a purchased elevator that works after turning on the power, with a closing door, and so that it makes sounds when you ride in it, and also preferably with switching light bulbs (red-green, like in a trap)?That would be very wonderful.
 
Hello this is my first post and "tutorial". This fonction is inspired by NGcaudle tutorial (buyable ending) so thx.
This have for effect to buys with a trigger a bonus spawnable in a script_struct. Exemple for max ammo.
 
Step 1- Go to yourmapname.gsc, u can find this file in Blackops/raw/maps and open it.
 
Step 2- Find this line in youmapname.gsc "maps_zombiemode::main();" below past this :
Code Snippet
Plaintext
ammo_trig = getentarray( "max_ammo","targetname" );
    array_thread( ammo_trig,::max_ammo );
Step 3 - At the bottom of this same file "yourmapname.gsc" paste this
 
Code Snippet
Plaintext
//////Buyable bonus by Samoth
 
max_ammo()
{
    user = undefined;
    cost = 5000;                        // Cost here
    self setCursorHint("HINT_NOICON");
    self UseTriggerRequireLookAt();
    self setHintString("press ^3&&1 ^7Max Ammo [Cost: "+cost+"]"); // Hintstring for buyable ammo
 
    while(1)
    {
        self waittill("trigger", user);
        if( is_player_valid(user) && user.score >= cost )
        {
            play_sound_at_pos( "cha_ching", self.origin );
            user thread maps\_zombiemode_score::minus_to_player_score( cost );
 
            //self delete(); add this if u want delete trigger after use
 
            level notify( "max_ammo" );
            level thread give_max_ammo();
        }
        else
        {
            play_sound_at_pos( "no_cha_ching", self.origin );
        }
    }
}
 
give_max_ammo()
{
    struct = getstruct("maxammo_spawn","targetname"); // name of struct
    maps\_zombiemode_powerups::specific_powerup_drop( "full_ammo", struct.origin ); // full ammo= name of bonus
}
////////

You can change variable of text u want say and the cost, as well as your bonus type.
I don't know if it's necessary but I advise you to copy the following files in your mods/map. (if you don't have this map folder create it).
go to blackops/raw/maps:
 
_zombiemode_powerups
And
_zombiemode_score
 
this is for the function access thread
 
Steps4 go to radiant ---> and create a trigger use with thats keys:
targetname  "max_ammo" and target "maxammo_spawn"
(Image removed from quote.)
 
And a script_struct with thats key:
targetname maxammo_spawn
(Image removed from quote.)
 
The bonus spawns at the location of the script_struct that can be activated by the trigger. Because the trigger targets the struct.
Don't forget to build and compile. You'r done.
 
Credit:
Samoth
NGcaudle
Tom_BMX
Vertasea
Last Edit: February 11, 2024, 03:44:09 pm by Дмитрий78
broken avatar :(
×
broken avatar :(
Location: fr
Date Registered: 24 September 2020
Last active: 2 months ago
Posts
3
Respect
Forum Rank
Fresh Corpse
Primary Group
Member
×
Samoth's Groups
Samoth's Contact & Social Links
great dude, I made the "instant kill" bonus work, a pretty useful and logical function, can you still teach a lesson, for example, how to add a purchased elevator that works after turning on the power, with a closing door, and so that it makes sounds when you ride in it, and also preferably with switching light bulbs (red-green, like in a trap)?That would be very wonderful.
 

Double Post Merge: February 11, 2024, 03:44:09 pm

great dude, I made the "instant kill" bonus work, a pretty useful and logical function, can you still teach a lesson, for example, how to add a purchased elevator that works after turning on the power, with a closing door, and so that it makes sounds when you ride in it, and also preferably with switching light bulbs (red-green, like in a trap)?That would be very wonderful.
Hello dud and thx. i'm happy to know u successfull. I'm not able to do you'r elevator tutorial. But you should know that on other maps there are elevator scripts, on battery for example. Maybe it will help you if you dig through the files.
Last Edit: February 12, 2024, 07:25:30 pm by Samoth

 
Loading ...