Modifying gun game rotation
-
Hey everyone, I've done some googling and browsing on these forums but I can't find an answer to this!
I would like to edit the gungame rotation to a custom one. How would I go about doing that?
-
You would have to override the
main
function inmaps/mp/gametypes/gun.gsc
As you can see there is a switch between multiple pre-made lists so you could replace the main function and then define a 4th list and set gunSelection to 4. -
Xerxes
replaceFunc() won't work for that situation though:
https://plutonium.pw/docs/modding/gsc/new-scripting-features/#replacefunc-specificsHasjBlok
A way to go about making a custom rotation would be to setgts gunSelection 4
in the server config so the default weapon progression doesn't get created.
Then you'd make a custom script and putaddguntoprogression()
function calls in the main() of the custom script.Alternatively, you can just modify the gun.gsc itself, you can get a working version here: https://github.com/JezuzLizard/Recompilable-gscs-for-BO2-zombies-and-multiplayer/blob/master/Multiplayer Core/patch_mp/maps/mp/gametypes/gun.gsc
It would go in storage/t6/maps/mp/gametypes once you've compiled it.
-
JezuzLizard So I tried the gun.gsc way but im running into a weird error.
I do spawn with the correct first gun but when I kill someone it does not promote me to the next weapon. Even though the only code I changed was adding a third case after line 112. The only code I can find that might have something to do with it is the if statement on line 201.Kind of lost at the moment but at least the custom gun rotation itself has now been added (I think...)
(Oh btw I did remove the if statement on line 41 as I made my new rotation gunlist 3.)
-
Then I tried to do it the other way:
(I haven't scripted a bunch on bo2 yet so maybe I'm completely misunderstanding how this works)- Set gts gunSelection to 4, meaning that the switch case never adds guns
- Create a custom script (The one from the docs + the addgun functions in the main() function)
- Compiled custom script and put it in t6r/scripts/mp as gungame_fix.gsc
- Restarted my servers
The servers started succesfully but upon loading in the player would just not have a weapon.
-
HasjBlok I'll have to look into it later to see what needs to be done for it to work then.
-
JezuzLizard Alright good luck! I'm surprised to see that nobody has made a handy gsc for this yet.
-
#include maps/mp/gametypes/gun; #include maps/mp/gametypes/_hud_util; #include maps/mp/_utility; #include common_scripts/utility; init() { level.gunprogression = []; addguntoprogression( "knife_ballistic_mp" ); addguntoprogression( "scar_mp" ); addguntoprogression( "tar21_mp" ); addguntoprogression( "an94_mp" ); addguntoprogression( "type95_mp" ); addguntoprogression( "xm8_mp" ); addguntoprogression( "sig556_mp" ); addguntoprogression( "sa58_mp" ); addguntoprogression( "saritch_mp" ); addguntoprogression( "hamr_mp" ); addguntoprogression( "lsat_mp" ); addguntoprogression( "qbb95_mp" ); addguntoprogression( "mk48_mp" ); addguntoprogression( "svu_mp" ); addguntoprogression( "as50_mp" ); addguntoprogression( "dsr50_mp" ); addguntoprogression( "ballista_mp+is" ); addguntoprogression( "usrpg_mp" ); addguntoprogression( "crossbow_mp" ); addguntoprogression( "knife_ballistic_mp" ); level.gungamekillscore = maps/mp/gametypes/_rank::getscoreinfovalue( "kill_gun" ); registerscorelimit( level.gunprogression.size * level.gungamekillscore, level.gunprogression.size * level.gungamekillscore ); setdvar( "scr_xpscale", 0 ); setdvar( "ui_weapon_tiers", level.gunprogression.size ); makedvarserverinfo( "ui_weapon_tiers", level.gunprogression.size ); }
If you don't get a weapon it's because the name isn't valid..
-
JezuzLizard Thank you so much this worked! I'm gonna try to look into making this process easier for future gungame enthousiasts.
-
hi
that not work its get me in error
can someone explain why