Hi everybody,
following a problem of message and price when buying a weapon custom example; Cod4, bo1 (no message and price a 0).
I recover this part of script to create a case of ammunition:
Open yourmap.gsc (raw\maps) and put this in the main() function:
level.give_ammo = 0; ammo_trigs = getentarray("give_ammo","targetname"); array_thread(ammo_trigs,::give_ammo);
Then, create a new function:
give_ammo() { while(1) { who = undefined; cost = 1500; string = "Press &&1 to buy ammo [Cost: " + cost + "]"; self sethintstring( string ); self SetCursorHint( "HINT_NOICON" ); self UseTriggerRequireLookAt(); self waittill( "trigger", who ); weapon = who GetCurrentWeapon(); ammocount = who getammocount(weapon); clipcount = who getweaponammoclip(weapon); maxammo = weaponmaxammo(weapon); // UNCOMMENT TO MAKE RAY GUN & WUNDERWAFFE AMMO UNBUYABLE //if( weapon == "tesla_gun" || weapon == "ray_gun" ) //{ // who iprintln( "You cannot buy ammo for this weapon" ); // level.give_ammo = 0; //} // UNCOMMENT TO MAKE RAY GUN & WUNDERWAFFE AMMO UNBUYABLE if( maxammo <= ammocount - clipcount ) { continue; } if ( weapon != "fraggrenade" && weapon!= "stielhandgranate" && weapon != "molotov" && weapon != "mine_bouncing_betty" && weapon != "mortar_round" && weapon != "satchel_charge_new") { if( who.score > cost ) { level.give_ammo = 1; } else { level.give_ammo = 0; } } if( level.give_ammo > 0 ) { who givemaxammo( who GetCurrentWeapon() ); who maps\_zombiemode_score::minus_to_player_score( cost ); who playsound( "cha_ching" ); } else { who playsound( "no_cha_ching" ); } wait(0.05); } }
I noticed that I can only buy ammunition either when the weapon and empty or when to use ammunition and reload.
I know not in script is that someone could modify me to make sure that one can buy ammunition when one wants?
And once it's done you can make me a copy of it's script so I have a second one but only for ammo weapon improve
I would like to have a crate for normal ammunition and another for ammo weapons improve
I thank you in advance
For the display message in game of the purchase of the weapon and the price I will see later