Well, this system enables the player to only have six weapons at a time, one of each type.
1 melee
2 pistol
3 smg or machine gun
4 sniper
5 shotgun
6 explosives
These can be edited. The best part about it, is that there are only two scripts to worry about, the HUD menu script as well as the gun's script.
How it works In Game:
You can pick up up to 1 of each type of weapon. If you already have a pistol, you cannot pickup another one. By pressing "H", you open the Gun Menu. The HUD serves no function but to tell you wnat number drops what. Be prssing the slot number of your current weapon, you drop it and are able to pick up another weapon.
I origionaly had set up where each gun would have it's own script that when the gun menu was accessed, the gun's hud would pop up as sort of a graphical interface, similar to the gun images in Half life 2. However, I have problems with making seven HUDS appear at once. The engine does not allow two seperate scripts to show huds at the same time, or for that matter, seven. So I had to ditch the graphical way and use a simpler, much easier to set up, neumerical way.
To set up:
Place the guns in your level. Make them always active, and give one of these scripts:
Slot 1
;Artificial Intelligence Script
;Header
desc = Pickup Item (can drop - press 1) [SLOT 1] TRUNCHEON
;Triggers
:state=0:hudreset,hudx=50,hudy=90,hudimagefine=languagebankenglishtextgamecoretextpidkedupaweapon.tga,hudname=itemprompt,hudhide=1,hudmake=display,state=10,coloff
;slot empty - take weapon
:state=10:globalvar=11
:state=10,plrdistwithin=40,varnotequal=37:state=2,playertake,hudshow=itemprompt,hudfadeout=itemprompt,globalvar=11,setvar=37
:state=2,scancodekeypressed=35:state=3
:state=3,scancodekeypressed=36:state=2
:state=3,scancodekeypressed=79:playerdrop
:state=4,plrdistfurther=45:state=10,globalvar=11,setvar=5
;End of Script
Slot 2
;Artificial Intelligence Script
;Header
desc = Pickup Item (can drop - press 2) [SLOT 2] ELITE
;Triggers
:state=0:hudreset,hudx=50,hudy=90,hudimagefine=languagebankenglishtextgamecoretextpidkedupaweapon.tga,hudname=itemprompt,hudhide=1,hudmake=display,state=10,coloff
;slot empty - take weapon
:state=10:globalvar=12
:state=10,plrdistwithin=40,varnotequal=37:state=2,playertake,hudshow=itemprompt,hudfadeout=itemprompt,globalvar=12,setvar=37
:state=2,scancodekeypressed=35:state=3
:state=3,scancodekeypressed=36:state=2
:state=3,scancodekeypressed=80:playerdrop
:state=4,plrdistfurther=45:state=10,globalvar=12,setvar=5
;End of Script
Slot 3
;Artificial Intelligence Script
;Header
desc = Pickup Item (can drop - press 3) [SLOT 3]
;Triggers
:state=0:hudreset,hudx=50,hudy=90,hudimagefine=languagebankenglishtextgamecoretextpidkedupaweapon.tga,hudname=itemprompt,hudhide=1,hudmake=display,state=10,coloff
;slot empty - take weapon
:state=10:globalvar=13
:state=10,plrdistwithin=40,varnotequal=37:state=2,playertake,hudshow=itemprompt,hudfadeout=itemprompt,globalvar=13,setvar=37
:state=2,scancodekeypressed=35:state=3
:state=3,scancodekeypressed=36:state=2
:state=3,scancodekeypressed=81:playerdrop
:state=4,plrdistfurther=45:state=10,globalvar=13,setvar=5
;End of Script
Slot 4
;Artificial Intelligence Script
;Header
desc = Pickup Item (can drop - press 5) [SLOT 5]
;Triggers
:state=0:hudreset,hudx=50,hudy=90,hudimagefine=languagebankenglishtextgamecoretextpidkedupaweapon.tga,hudname=itemprompt,hudhide=1,hudmake=display,state=10,coloff
;slot empty - take weapon
:state=10:globalvar=14
:state=10,plrdistwithin=40,varnotequal=37:state=2,playertake,hudshow=itemprompt,hudfadeout=itemprompt,globalvar=14,setvar=37
:state=2,scancodekeypressed=35:state=3
:state=3,scancodekeypressed=36:state=2
:state=3,scancodekeypressed=75:playerdrop
:state=4,plrdistfurther=45:state=10,globalvar=14,setvar=5
;End of Script
Slot 5
;Artificial Intelligence Script
;Header
desc = Pickup Item (can drop - press 5) [SLOT 5]
;Triggers
:state=0:hudreset,hudx=50,hudy=90,hudimagefine=languagebankenglishtextgamecoretextpidkedupaweapon.tga,hudname=itemprompt,hudhide=1,hudmake=display,state=10,coloff
;slot empty - take weapon
:state=10:globalvar=15
:state=10,plrdistwithin=40,varnotequal=37:state=2,playertake,hudshow=itemprompt,hudfadeout=itemprompt,globalvar=15,setvar=37
:state=2,scancodekeypressed=35:state=3
:state=3,scancodekeypressed=36:state=2
:state=3,scancodekeypressed=76:playerdrop
:state=4,plrdistfurther=45:state=10,globalvar=15,setvar=5
;End of Script
Slot 6
;Artificial Intelligence Script
;Header
desc = Pickup Item (can drop - press 6) [SLOT 6]
;Triggers
:state=0:hudreset,hudx=50,hudy=90,hudimagefine=languagebankenglishtextgamecoretextpidkedupaweapon.tga,hudname=itemprompt,hudhide=1,hudmake=display,state=10,coloff
;slot empty - take weapon
:state=10:globalvar=16
:state=10,plrdistwithin=40,varnotequal=37:state=2,playertake,hudshow=itemprompt,hudfadeout=itemprompt,globalvar=16,setvar=37
:state=2,scancodekeypressed=35:state=3
:state=3,scancodekeypressed=36:state=2
:state=3,scancodekeypressed=77:playerdrop
:state=4,plrdistfurther=45:state=10,globalvar=16,setvar=5
;End of Script
Guns that should be in the same slot should have the same script.
Then, give a dynamic light this script:
;Artificial Intelligence Script
;Header
desc = Weapon HUD
;Triggers
:state=0:hudreset,hudx=50,hudy=67,hudimagefine=gamecorehudsweaponhudgun.tga,hudname=gunmenu,hudhide=1,hudmake=display,state=10
:state=10,scancodekeypressed=35:state=3,sound=audiobankmiscping.wav
:state=3:hudshow=gunmenu,hudfadeout=gunmenu
:state=3,scancodekeypressed=36:state=0,sound=audiobankmiscping.wav
That's it. I am sorry that this could not be more. Thiswas really cool, with one weapon, but as I added more, the engine started to fail me.
Anyhow, as you can se, you will need a Menu Hud as stated in the above script. I have attatched the one that I used.
Here is a link to a playable demo of the system in action.
http://files.filefront.com/Gun+Demozip/;11080026;/fileinfo.html
Known issues:
1. you have to exit the menu before you can pickup another gun or drop a gun if you picked it up, dropped it, and picked it up again.
2. you get more ammo thatn you did before. - soluton; set the ammo to 0.
As you can see, you can add more slots, take some out, ect. Feel free to edit the HUD. I just wish that this could be more. If anyone has ideas, please coment.