Okay, as the name of this thread suggests, I'm working on my own system for buying weapons using a money variable, and that has worked no problem. My current problem arose when I added in the code that would put the weapon slot system into work. I will bold the lines that were added reight before my failed test of the script.
;Artificial Intelligence Script
;Header
desc = Buy M16 W/ ACOG Sight for 1750 Points
;Triggers
:state=0:hudreset,hudx=50,hudy=45,hudimagefine=gamecore\huds\user\Survival Game Gun Pickup\buym16withacog.png,hudname=M16acog,hudhide=1,hudmake=display
:state=0:state=1
:state=1,plrdistfurther=50:hudunshow=M16acog
:state=1,plrnotfacing=40:hudunshow=M16acog
:state=1,inview=1,plrfacing=30,plrdistwithin=50:hudshow=M16acog
:state=1,inview=1,plrfacing=30,plrdistwithin=50,varless=cashcounter 1749,keypressed=18 1:state=21
:state=21,plrfacing=30,plrdistwithin=50,keypressed=18 0:state=1
:state=1,inview=1,plrfacing=30,plrdistwithin=50,vargreater=cashcounter 1749,keypressed=18 1:state=2
[b]:state=2,varless=weaponcounter 2:state=3
:state=2,varequal=weaponcounter 2:state=4[/b]
:state=3,plrfacing=30,plrdistwithin=50,vargreater=cashcounter 1749,keypressed=18 0:subvar=cashcounter 1750,state=5,hudunshow=M16acog,playertake,coloff,rundecal=-1,addvar=weaponcounter 1
:state=4,plrfacing=30,plrdistwithin=50,vargreater=cashcounter 1749,keypressed=18 0:[b]removecurrentweapon[/b],subvar=cashcounter 1750,state=5,hudunshow=M16acog,playertake,coloff,rundecal=-1
;End Of Script
Basically, I walk up to the weapon on the wall and it displays the HUD to buy it, but pressing the buy key no longer works. I have no idea what I'm doing wrong, but I'm certain it is with the addition of the weapon slot variable commands into this script that the problem was created. Below I'll also include the script that I'm using to create and initialize the weapon slot variable with a starting value of one for the starting weapon that is included in the start marker.
;Artificial Intelligence Script
;Header
desc = Creates a Custom Number of Weapon Slots (Maximum of 9) and Gives Intial Value of 1 for Starting Weapon
;Triggers
:state=0:dimvar=weaponcounter
:state=0:addvar=weaponcounter 1
;End Of Script
As always, any help is massively appreciated, and I intend to release the completed weapon slot script as soon as I can polish it.
AMD FX-6300 Vishera 3.5GHz, Radeon HD 7850 2GB, 8 GB RAM, Win 7 Pro 64 Bit