• 🏆 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] Guns don't use specific ammo

Status
Not open for further replies.
Level 9
Joined
Apr 23, 2010
Messages
312
I have 3 different guns that need to use a specific ammo but have no idea how to do this. Right now it doesn't matter what ammo you use, they all reload for every weapon. I'm using mana as the ammo counter and all the ammo's give the same amount of mana back to the user.

Gun 1 needs to use "9mm Rounds"
Gun 2 needs to use "5.56 Rounds"
Gun 3 needs to use ".308 Rounds"

If you need more info just let me know what you need to know. Will appreciate any help given and will +rep those who help.
 
Level 4
Joined
Aug 8, 2011
Messages
84
Store the amount of "ammo" (mana), whenever it changes. There should be three values per unit that can use ammo, since you have three types of ammo. Whenever a gun is changed, set the unit's mana to whatever the saved amount for that type of ammo was.

If your ammo packages are based off of mana potions, I would make it so that the mana given from each ammo package is triggered, this way if the current equipped gun doesn't use that ammo type, there will be no mana gain, only change the stored value for that ammo type so that if the gun is changed to that ammo type, there will be the correct amount of mana.
 
Level 9
Joined
Apr 23, 2010
Messages
312
Ok well this is what i've done..
  • Reload
    • Events
      • Unit - A unit Uses an item
    • Conditions
      • (Item-type of (Item being manipulated)) Equal to 9mm Rounds
      • (Item-type of (Item being manipulated)) Equal to 5.56 Rounds
      • (Item-type of (Item being manipulated)) Equal to .308 Rounds
    • Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • And - All (Conditions) are true
            • Conditions
              • (Item-type of (Item being manipulated)) Equal to 9mm Rounds
              • (Item-type of (Item carried by (Hero manipulating item) of type Jackel SMG)) Equal to Jackel SMG
        • Then - Actions
          • Unit - Set mana of (Hero manipulating item) to ((Mana of (Hero manipulating item)) + 35.00)
        • Else - Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • And - All (Conditions) are true
            • Conditions
              • (Item-type of (Item being manipulated)) Equal to 5.56 Rounds
              • (Item-type of (Item carried by (Hero manipulating item) of type Ulysses AR)) Equal to Ulysses AR
        • Then - Actions
          • Unit - Set mana of (Hero manipulating item) to ((Mana of (Hero manipulating item)) + 20.00)
        • Else - Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • And - All (Conditions) are true
            • Conditions
              • (Item-type of (Item being manipulated)) Equal to .308 Rounds
              • (Item-type of (Item carried by (Hero manipulating item) of type Buckeye Carbine)) Equal to Buckeye Carbine
        • Then - Actions
          • Unit - Set mana of (Hero manipulating item) to ((Mana of (Hero manipulating item)) + 10.00)
        • Else - Actions
The problem is the unit has no starting mana, the gun gives that to the unit and when I try to trigger adding mana to the unit, it does nothing.

Jackel SMG gives 35 mana.
Ulysses gives 20 mana.
Buckeye gives 10 mana.

EDIT: Nevermind, I just forgot to add the "OR - Any condition is true" to the manipulated item's check at the start. Thanks Ameranth, this is solved!
 
Level 37
Joined
Mar 6, 2006
Messages
9,240
The trigger structure should look like this:

  • Untitled Trigger 001
    • Events
    • Conditions
    • Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • Condition 1
          • Condition 2
        • Then - Actions
        • Else - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • Condition 1
              • Condition 2
            • Then - Actions
            • Else - Actions
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • Condition 1
                  • Condition 2
                • Then - Actions
                • Else - Actions
Remove the ands and the if/then/elses should be inside each other.
 
Status
Not open for further replies.
Top