aL BeasTie
Well-known member
So I got the ammo script working again, it checks if player has pickup up the backback and changes the max ammo count.
I'm just unsure about where to declare the
At the moment to test I have it in level.c ...but this would make it reset every level?
I just want to set the variable somewhere when the game first starts.
Cheers,
level.c
didhitscript (for weapon pickup)
I'm just unsure about where to declare the
Code:
setglobalvar("backpack", 0);
At the moment to test I have it in level.c ...but this would make it reset every level?
I just want to set the variable somewhere when the game first starts.
Cheers,
level.c
Code:
int iPack = getglobalvar("backpack");
if (iPack == 0){ //NO Backpack
setglobalvar("maxbullet", 200);
setglobalvar("maxshell", 50);
setglobalvar("maxrocket", 50);
setglobalvar("maxcell", 300);
}
else if (iPack == 1){ //player has backpack, increase max ammo
setglobalvar("maxbullet", 400);
setglobalvar("maxshell", 100);
setglobalvar("maxrocket", 100);
setglobalvar("maxcell", 600);
didhitscript (for weapon pickup)
Code:
#import "data/scripts/weapons.c"
void main()
{
void self = getlocalvar("self");
//void opponent = getentityproperty(self, "opponent");
void opponent = getlocalvar("damagetaker");
int iSnd2 = loadsample("data/sfx/dswpnup.wav");
int iAmmo = getglobalvar("maxshell");
playsample(iSnd2, 0, openborvariant("effectvol"), openborvariant("effectvol"), 120, 0); //itemup sfx
setShotgun_wOwned(opponent, 1); //Means now that the player has picked-up and owns this weapon from now on.
if ( getShotgun_wAmmo(opponent)+8 < iAmmo ) {
setShotgun_wAmmo(opponent, getShotgun_wAmmo(opponent)+8);//Add to ammo stock
} else { setShotgun_wAmmo(opponent,iAmmo); }
setCurrentWeapon(opponent, 2);
changeentityproperty(opponent, "weapon", 2);
}