Skip to content
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Donate
Collapse

Plutonium

Ox_undefined

Ox_

@Ox_
About
Posts
53
Topics
1
Shares
0
Groups
0
Followers
15
Following
0

Posts

Recent Best Controversial

  • Where to find useful functions and variables (reference) for GSC?
    Ox_undefined Ox_

    More experienced people just remember the stuff from years of experience from earlier cods etc.
    When getting started, just pretty much just Google search for a list of stuff. Looking at what other people have done is also good when getting started.
    Loads of tutorials for gsc found with a Google search as well. Remember that you don't have to search for BO2 gsc, gsc is pretty much the same for all cods. Best documented stuff you'll probably find from earlier cods. Or maybe BO3 since it actually officially supports modding.

    Also don't forget about just studying the actual gscs BO2 runs off.
    It's very good to find new stuff as well.
    You'll find a dump for the decompiled gscs stickied in the BO2 modding section.
    For example that other question you just posted here, "how to find out zombie kills", is solved in like a minute by just searching the word "kills" in patch_zm.
    Personally I use "AstroGrep" to search for text inside the whole dump.

    BO2 Modding Support & Discussion

  • [Release] [GSC] Zombies Custom Powerup | Unlimited Ammo
    Ox_undefined Ox_

    So I was playing some zombies with a friend and wanted to do something with gsc. Just to remember the good old golden days. Thought of making a custom powerup and unlimited ammo seemed like a pretty cool one.

    So it'll drop on the ground randomly just like any powerup, and when someone picks it up, every player gets unlimited ammo for 30secs. Duration can be easily changed, of course.

    This is not intended for Turned or Grief. I have no idea what happens if you try to use them there. Nothing good I'd assume.
    Cba'd to make it work with them because who needs unlimited ammo in Turned, and who tf plays Grief.
    Other than that, should be all good. Managed to even spam myself with the powerup over 2000 times in a row with no issues.

    EDIT: Seems the shader I'm using for the icon wont load in all maps KMS KMS KMS KMS KMS KMS. I fucking cba trying to find one that works. Shit's fucking impossible. I can deal with a checkerboard icon in some maps.

    Video
    https://www.youtube.com/watch?v=M5qXeJAmdZ8
    Picture
    https://i.imgur.com/Amllzkw.jpg

    Full source for a minimal example script. Be sure to read the comments in there if you'll be doing any changes yourself.

    #include maps\mp\_utility;
    #include common_scripts\utility;
    #include maps\mp\gametypes_zm\_hud_util;
    #include maps\mp\gametypes_zm\_hud_message;
    
    //important include
    #include maps\mp\zombies\_zm_powerups;
    
    init()
    {
       	level thread onPlayerConnect();
    
    	//include and init the powerup
       	include_zombie_powerup("unlimited_ammo");
       	//change the powerup duration if you want
       	level.unlimited_ammo_duration = 30;
       	//shitty model, cant find a good model list so cba
       	//change to w/e if you have some nice model
       	//galil works in all maps though, so be decent in that regard ig
       	add_zombie_powerup("unlimited_ammo", "T6_WPN_AR_GALIL_WORLD", &"ZOMBIE_POWERUP_UNLIMITED_AMMO", ::func_should_always_drop, 0, 0, 0);
    	powerup_set_can_pick_up_in_last_stand("unlimited_ammo", 1);
    }
    
    onPlayerConnect()
    {
        for(;;)
        {
            level waittill("connected", player);
            player thread onPlayerSpawned();
        }
    }
    
    onPlayerSpawned()
    {
        self endon("disconnect");
    	level endon("game_ended");
        for(;;)
        {
            self waittill("spawned_player");
            if(self isHost() && !isDefined(level.unlimited_ammo_first_spawn))
            {
            	wait 2;
            	//store the original custom powerup grab function, 
            	//if one exists (Origins, Buried, Grief & Turned)
            	//note that this is not intended for Grief or Turned
            	//I have no idea what will happen, probably pretty broken
            	if(isDefined(level._zombiemode_powerup_grab))
            		level.original_zombiemode_powerup_grab = level._zombiemode_powerup_grab;
            		
            	//delayed defining of the custom function so we're sure to
            	//override the function Origins and Buried defines for this
            	level._zombiemode_powerup_grab = ::custom_powerup_grab;
            	
            	//message for the host to indicate that it should be all good
            	wait 2;
    		self iprintlnbold("^7Unlimited Ammo Custom Powerup Loaded!");
            	
            	//gives host the ability to test the powerup at the start of the game
            	//can be used to make sure it's actually working and all good
            	//remove the line directly below to disable
            	self thread test_the_powerup();
            	
            	//whatever so this variable isn't undefined anymore
            	level.unlimited_ammo_first_spawn = "fortnite!fortnite!!";
            }
        }
    }
    
    test_the_powerup()
    {
    	self endon("death");
    	self endon("disconnected");
    	self endon("testing_chance_ended");
    	level endon("game_ended");
    	wait 3;
    	self iprintlnbold("^7Press ^1[{+smoke}] ^7to test, you have ^15 seconds^7.");
    	self thread testing_duration_timeout();
    	for(;;)
    	{
    		if(self secondaryoffhandbuttonpressed())
    		{
    			level specific_powerup_drop("unlimited_ammo", self.origin + VectorScale(AnglesToForward(self.angles), 70));
    			return;
    		}
    		wait .05;
    	}
    }
    
    testing_duration_timeout()
    {
    	self endon("death");
    	self endon("disconnected");
    	wait 5;
    	self notify("testing_chance_ended");
    }
    
    //fires when we grab any custom powerup
    custom_powerup_grab(s_powerup, e_player)
    {
    	if (s_powerup.powerup_name == "unlimited_ammo")
    		level thread unlimited_ammo_powerup();
    	
    	//pass args onto the original custom powerup grab function
    	else if (isDefined(level.original_zombiemode_powerup_grab))
    		level thread [[level.original_zombiemode_powerup_grab]](s_powerup, e_player);
    }
    
    unlimited_ammo_powerup()
    {
    	foreach(player in level.players)
    	{
    		//if powerup is already on, turn it off
    		player notify("end_unlimited_ammo");
    		//small cha ching sound for each player when someone picks up the powerup
    		//cba'd to come up with anything better and don't have a list of sounds, 
    		//change to w/e if you want.
    		player playsound("zmb_cha_ching");
    		player thread turn_on_unlimited_ammo();
    		player thread unlimited_ammo_on_hud();
    		player thread notify_unlimited_ammo_end();
    	}
    }
    
    unlimited_ammo_on_hud()
    {
    	self endon("disconnect");
    	//hud elems for text & icon
    	unlimited_ammo_hud_string = newclienthudelem(self);
    	unlimited_ammo_hud_string.elemtype = "font";
    	unlimited_ammo_hud_string.font = "objective";
    	unlimited_ammo_hud_string.fontscale = 2;
    	unlimited_ammo_hud_string.x = 0;
    	unlimited_ammo_hud_string.y = 0;
    	unlimited_ammo_hud_string.width = 0;
    	unlimited_ammo_hud_string.height = int( level.fontheight * 2 );
    	unlimited_ammo_hud_string.xoffset = 0;
    	unlimited_ammo_hud_string.yoffset = 0;
    	unlimited_ammo_hud_string.children = [];
    	unlimited_ammo_hud_string setparent(level.uiparent);
    	unlimited_ammo_hud_string.hidden = 0;
    	unlimited_ammo_hud_string maps/mp/gametypes_zm/_hud_util::setpoint("TOP", undefined, 0, level.zombie_vars["zombie_timer_offset"] - (level.zombie_vars["zombie_timer_offset_interval"] * 2));
    	unlimited_ammo_hud_string.sort = .5;
    	unlimited_ammo_hud_string.alpha = 0;
    	unlimited_ammo_hud_string fadeovertime(.5);
    	unlimited_ammo_hud_string.alpha = 1;
    	//cool powerup name, sounds like something that could actually be in the game
    	//credits to "Banni" for it
    	unlimited_ammo_hud_string setText("Bottomless Clip!");
    	unlimited_ammo_hud_string thread unlimited_ammo_hud_string_move();
    	
    	unlimited_ammo_hud_icon = newclienthudelem(self);
    	unlimited_ammo_hud_icon.horzalign = "center";
    	unlimited_ammo_hud_icon.vertalign = "bottom";
    	unlimited_ammo_hud_icon.x = -75;
    	unlimited_ammo_hud_icon.y = 0;
    	unlimited_ammo_hud_icon.alpha = 1;
    	unlimited_ammo_hud_icon.hidewheninmenu = true;   
    	unlimited_ammo_hud_icon setshader("hud_icon_minigun", 40, 40);
    	self thread unlimited_ammo_hud_icon_blink(unlimited_ammo_hud_icon);
    	self thread destroy_unlimited_ammo_icon_hud(unlimited_ammo_hud_icon);
    }
    
    unlimited_ammo_hud_string_move()
    {
    	wait .5;
    	self fadeovertime(1.5);
    	self moveovertime(1.5);
    	self.y = 270;
    	self.alpha = 0;
    	wait 1.5;
    	self destroy();
    }
    
    //blinking times match the normal powerup hud blinking times
    unlimited_ammo_hud_icon_blink(elem)
    {
    	level endon("disconnect");
    	self endon("disconnect");
    	self endon("end_unlimited_ammo");
    	time_left = level.unlimited_ammo_duration;
    	for(;;)
    	{
    		//less than 5sec left on powerup, blink fast
    		if(time_left <= 5)
    			time = .1;
    		//less than 10sec left on powerup, blink
    		else if(time_left <= 10)
    			time = .2;
    		//over 20sec left, dont blink
    		else
    		{
    			wait .05;
    			time_left -= .05;
    			continue;
    		}
    		elem fadeovertime(time);
    		elem.alpha = 0;
    		wait time;
    		elem fadeovertime(time);
    		elem.alpha = 1;
    		wait time;
    		time_left -= time * 2;
    	}
    }
    
    destroy_unlimited_ammo_icon_hud(elem)
    {
    	level endon("game_ended");
    	//timeout just in case aswell, shouldnt ever get used, but who knows if I missed something
    	self waittill_any_timeout(level.unlimited_ammo_duration+1, "disconnect", "end_unlimited_ammo");
    	elem destroy();
    }
    
    turn_on_unlimited_ammo()
    {
    	level endon("game_ended");
    	self endon("disonnect");
    	self endon("end_unlimited_ammo");
    	for(;;)
    	{
    		//simply set the current mag to be full on a loop
    		self setWeaponAmmoClip(self GetCurrentWeapon(), 150);
    		wait .05;
    	}
    }
    
    notify_unlimited_ammo_end()
    {
    	level endon("game_ended");
    	self endon("disonnect");
    	self endon("end_unlimited_ammo");
    	wait level.unlimited_ammo_duration;
    	//the same sound that plays when instakill powerup ends
    	self playsound("zmb_insta_kill");
    	self notify("end_unlimited_ammo");
    }
    

    Download to a precompiled .gsc you can use:
    https://www.mediafire.com/file/h501pdsime694jx/BO2-Zombies-Custom-Powerup-Unlimited-Ammo.zip/file
    https://www.virustotal.com/gui/file/e7efd7e643d5f5e2a4aa29c32af186b13d314b0915687f13724b88ec890bd604/detection

    Hope someone finds some use, or maybe figures out how to add their own custom powerups, post them down below if you do.
    And if you have any ideas for improvement, or other custom powerups, or any other custom stuff, post them down below. I might make them if I find them cool.

    ~Ox

    BO2 Modding Releases & Resources

  • [Support] Randomize what perk perk-a-cola machines give
    Ox_undefined Ox_

    After taking a quick look, I'm seeing four ways you could do this.

    You could patch e.g. the vending_trigger_post_think() function, which is one the functions that will run when you purchase a perk, in _zm_perks.gsc, but that would require some doing. You'd have to fix all the decompilation errors in that gsc and then recompile it. Could be pretty easy, but could also be that it's straight up missing some code and you'd have to fill it in yourself.
    This approach would surely give you the most control, and you could customize anything and everything about it. If this happens to be one of those gscs that doesn't have terrible decompilation errors, this is a really good approach.

    Another way, which already seems pretty good, would be changing the perks that are associated with the perk machine triggers. This way you wouldn't have to recompile the _zm_perks gsc.
    This is the beginning of the vending_trigger_think() function, which is holds the logic for each perk machine's trigger.

    vending_trigger_think()
    {
    	self endon( "death" );
    	wait 0.01;
    	perk = self.script_noteworthy;
    	...
    

    The function is owned by each perk machine's trigger, so self is the trigger.
    So what you could do is just change the value of trigger's script_noteworthy.
    Without doing any testing, I think it'd be done with just doing this:
    (jugger to speedcola)

    foreach (trigger in getentarray("zombie_vending", "targetname"))
    	if (trigger.script_noteworthy == "specialty_armorvest")
    		trigger.script_noteworthy = "specialty_fastreload";
    

    Though, you'd need to get that to run before the init() in _zm_perks, which might not be that easy.
    But in that case, could of course just notify the desired trigger with a "death", and then restart the desired trigger's logic function (vending_trigger_think())

    However, this approach would come with the downside(?) of your hud saying speed cola when you're standing next to the jugger machine. Basically the machine acts exactly like the speed cola machine.

    And then the third approach I could quickly think of:
    In the vending_trigger_post_think() function, which is the function that runs after you make a perk purchase, there is a very helpful little line of code:

    vending_trigger_post_think( player, perk )
    {
    	player endon( "disconnect" );
    	player endon( "end_game" );
    
    	...
    	
    	if ( isDefined( level.perk_bought_func ) )
    	{
    		player [[ level.perk_bought_func ]]( perk );
    	}
    	
    	...
    }
    

    A globally defined function that runs after you buy (and finished drinking) the perk.
    Now that's lucky.
    Be very easy to add your own custom logic onto that function. And in your case, I guess your desired custom logic would be removing the purchased perk and replacing it with another perk.
    And on top of that, you can add whatever else custom logic as well.

    I'd consider this the best approach, since you won't have to deal with recompiling the _zm_perks gsc, and you can basically still have a lot of control over what actually happens upon buying the perk by just removing it and then doing whatever.

    The fourth way, is basically a duplicate of the above, with the downside of not having a direct way to tell what perk the player just bought.
    Players are notified with a "burp" (this occurs in the aforementioned vending_trigger_post_think() function) upon finishing drinking a perk bottle. So could listen for that notification and then do the same as above, remove the perk that was just bought and replace it whatever else. You'd just have to create your own custom logic for determining that perk was just bought.

    Most definitely not a bad approach, but I don't really see any reason to do this, since the previous approach I suggested just straight up passes the name of perk to the level.perk_bought_func function.

    So yeah, there most definitely are way more ways of doing this. This is just what I could see after taking a quick glance at the _zm_perks gsc.
    Though, I don't think it can get any better than using the globally defined level.perk_bought_func function. At least for the usage you seem to be after.

    BO2 Modding Support & Discussion

  • [Release] [ZM] ZOMBIES++
    Ox_undefined Ox_

    SlyJF said in [Release] [Zombies] ZOMBIES++ MOD (Extra Perk Machines, Powerups, more):

    MiguelitoS2 Cahz yeah im trying to figure out why zombie blood isnt working, any updates here?

    It's because powerup isn't passed onto the original _zombiemode_powerup_grab function if it the powerup wasn't one of the user added custom ones. Instead it's just discarded.
    Don't know why he missed that part when he copied over my code.

    BO2 Modding Releases & Resources
  • 1 / 1
  • Login

  • Don't have an account? Register

  • Login or register to search.
  • First post
    Last post
0
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Donate