UGX-Mods Login

or login with an authentication provider below
Sign In with Google
Sign In with Twitter
Sign In with Discord
Sign In with Steam
Sign In with Facebook
Sign In with Twitch

Crate of ammunition

broken avatar :(
Created 10 years ago
by lmg60
0 Members and 1 Guest are viewing this topic.
1,676 views
broken avatar :(
×
broken avatar :(
Location: fr
Date Registered: 27 September 2016
Last active: 9 years ago
Posts
23
Respect
Forum Rank
Legless Crawler
Primary Group
Member
×
lmg60's Groups
lmg60's Contact & Social Links
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:

Code Snippet
Plaintext
level.give_ammo = 0;
ammo_trigs = getentarray("give_ammo","targetname");
array_thread(ammo_trigs,::give_ammo);

Then, create a new function:

Code Snippet
Plaintext
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
Last Edit: November 16, 2016, 10:41:40 am by Sidzzz
broken avatar :(
×
broken avatar :(
Pragmatist
Location: us
Date Registered: 9 May 2015
Last active: 1 year ago
Posts
451
Respect
Forum Rank
Perk Hacker
Primary Group
UGX Site Moderator
My Groups
More
My Contact & Social Links
More
Personal Quote
Fish. That is all
Signature
×
Sidzzz's Groups
UGX Site Moderator Has the ability to issue warnings to users, edit and remove posts from the forum and to move topics to other boards. Upholds the rules of the forum. Moderates Chat Rooms.
Sidzzz's Contact & Social LinksSidzzzsidzzzsidzzzTheSidzzzTheSidzzz@TheSidzzz
As per the rules of this forum, you must use the Code formatting tags to include scripts or code in any fashion, whether it's a simple thread call or an elaborate function. They can be found amid the numerous post formatting options.
broken avatar :(
×
broken avatar :(
Location: aupotato
Date Registered: 27 September 2013
Last active: 5 years ago
Posts
588
Respect
Forum Rank
Zombie Enslaver
Primary Group
Scripter
My Groups
More
My Contact & Social Links
More
Signature
respect the dead

donates greatly appreciated :) paypal.me/F3ARxReaper666
discord server:
https://discord.gg/tsGHW99
×
death_reaper0's Groups
Mapper Has released one or more maps to the UGX-Mods community.
Scripter Has shown effort and knowledge in the area of scripting while being a part of the UGX-Mods community.
looks like you simpily remove

Code Snippet
Plaintext

      if( maxammo <= ammocount - clipcount )
      {
         continue;
      }


and if you want to, remove

Code Snippet
Plaintext
      ammocount = who getammocount(weapon);
      clipcount = who getweaponammoclip(weapon);
      maxammo = weaponmaxammo(weapon);
as it wont be needed afterwards

 
Loading ...