Modme Forums
Menu:

Weapon Cabinet

Game Modding | Call of Duty: Black Ops 3 | Scripting


ModmeBot:

Thread By: raptroes
<h1>Currently WIP. Will update post soon. Please ignore right now.</h1>



[Need help, and then later on I plan on releasing this as a public asset.]

Hey y'all.
Despite not being a programmer, I've started working on the script to make my weapon cabinet functionally, and a lot of things are working, but I need help fine-tuning the code (I literally started scripting today lol). If it weren't for MakeCents' autocomplete, the bo3_scriptaifunctions document, and other sample code, it would've been impossible for me to get this far. Sorry if my coding sucks.

Anyways, the weapon cabinet in Nacht der Untoten is what I'm trying to script. I already have the script_models/textures/etc set up in Radiant. I just need to finalize the code and get rid of some funny bugs.

Here is what I have so far, all inside my <em>mapname.gsc</em> file:

Above

function main()
#using scripts\zm\_zm_score;

Inside of
function main()
level thread weapon_cabinet();

Below
function main()
, at the bottom of the GSC:
I'm actually in the process of updating the code. Will repost new code soon. I only removed the code that was here so I don't waste anyone's time.

Currently, the way this works is that you can buy the desired weapon (the Locus in this case, as seen in Zombie Chronicles version of Nacht der Untoten).
It will check to see if you have the weapon already or not, and charge you accordingly.
It will also check to see if you already opened the cabinet or not, so as to not rotate the cabinet doors more than once.

However, there are several bugs and bits of code missing that I need help with.
Bugs:
<ol><li>You are not charged for ammo. Once you own the weapon, you can purchase ammo indefinitely.</li>
<li>Not only that, but unlike a traditional wallbuy, it switches you from your other weapon to the cabinet weapon. (Minor inconvenience.)</li>
<li>There is no sound effect for when you cannot afford the weapon/ammo. (The thud noise.)</li>
</ol>Missing Features:
<ol><li>I didn't set up the if condition for an upgraded cabinet weapon yet, as I'm not sure how to add
_upgraded
to the end of the
cabinet_weapon
variable when applicable. Besides the 2 bugs listed above, this is something else I'd like to seek advice on.
</li>
<li>I didn't set up the script_model for the Locus worldmodel in Radiant yet, as that seems to cause issues for some reason. (I can probably figure this part out later on).</li>
<li>There is no sound effect when opening the cabinet. I imagine this is easy code I can add to the
weapon_cabinet_check()
function. I just don't know where to find the names of sounds that I can play via scripts using
player PlaySound();
.</li>
</ol>
If you have any answers or code optimization, it'd be much appreciated. I made a lot of comments to make it legible.