• 🏆 Texturing Contest #33 is OPEN! Contestants must re-texture a SD unit model found in-game (Warcraft 3 Classic), recreating the unit into a peaceful NPC version. 🔗Click here to enter!
  • 🏆 Hive's 6th HD Modeling Contest: Mechanical is now open! Design and model a mechanical creature, mechanized animal, a futuristic robotic being, or anything else your imagination can tinker with! 📅 Submissions close on June 30, 2024. Don't miss this opportunity to let your creativity shine! Enter now and show us your mechanical masterpiece! 🔗 Click here to enter!

[Trigger] Reloading and ammo system

Status
Not open for further replies.
Level 13
Joined
Sep 24, 2007
Messages
1,023
i was wondering if anyone nos where i could find a good ammo system or if you could help me make one if you dont no what im talking aobut ill explain
i want it so that you can equit guns and you need ammo in the gun for it too be able to shoot and once the in the gun runs out if you click on the gun in ur iventory and you have ammo in ur iventory it puts ammo in the gun
 
Level 13
Joined
Sep 24, 2007
Messages
1,023
whats mpi and mui i tihnk the board displaying the ammo would be a nice touch the gun would probly be
Gun Type Ammo used
Pistol Pistol ammo
Sniper rifle ammo
Semiautorifle rifle ammo
fullautorifle rifle ammo
machinegun machinegunammo
flame thrower nappalm cylinders
 
Level 29
Joined
Jul 29, 2007
Messages
5,174
Then I guess you don't have... lol.

JNGP (Jass New Gen Pack) is a hacked version of the normal WE (World Editor).
It allows you to use some new options in the overall use of the WE and it enchances Jass by allowing us to use vJass (which pretty much simulates OOP progamming languages) and some other usefull things.

If you do not use Jass its suggested. If you use Jass, its a must.
 
Level 29
Joined
Jul 29, 2007
Messages
5,174
This is an example of two ammo types.

Variables used:

AmmoTypeOne - Integer, arrayed, initial value 0
AmmoTypeTwo - Integer, arrayed, initial value 0
(you can put more then 0 if you want the players to start with ammo)

  • Ammunition
    • Events
      • Unit - A unit Uses an item
    • Conditions
      • Or - Any (Conditions) are true
        • Conditions
          • (Item-type of (Item being manipulated)) Ammo_Item_One
          • (Item-type of (Item being manipulated)) Equal to Ammo_Item_Two
    • Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Item-type of (Item being manipulated)) Ammo_Item_One
        • Then - Actions
          • Set AmmoTypeOne[(Player number of (Owner of (Triggering unit)))] = (AmmoTypeOne[(Player number of (Owner of (Triggering unit)))] + (Charges remaining in (Item being manipulated)))
        • Else - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (Item-type of (Item being manipulated)) Ammo_Item_Two
            • Then - Actions
              • Set AmmoTypeTwo[(Player number of (Owner of (Triggering unit)))] = (AmmoTypeTwo[(Player number of (Owner of (Triggering unit)))] + (Charges remaining in (Item being manipulated)))
            • Else - Actions

As you can see, you will need your ammo items to have a instant (no target) spell that will allow you to equip them.
You can also pretty easly set a maximum of bullets if you want.
 
Status
Not open for further replies.
Top