• 🏆 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!
  • It's time for the first HD Modeling Contest of 2024. Join the theme discussion for Hive's HD Modeling Contest #6! Click here to post your idea!

[Trigger] Item cost food

Status
Not open for further replies.
Level 5
Joined
Jan 5, 2019
Messages
108
Hey can someone help me make my item cost food ?
This one doesn't work i need the item to take up one food space, and ask if there is enough food.


  • Spell Being Bought For Food
    • Events
      • Unit - A unit Acquires an item
    • Conditions
      • (Item-type of (Item being manipulated)) Equal to Frost Nova
    • Actions
      • Set PlayerBuyForFood = (Owner of (Item being manipulated))
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • PlayerBuyForFood Equal to (Owner of (Item being manipulated))
        • Then - Actions
          • Player - Add 1 to (Owner of (Triggering unit)) Food used
          • Trigger - Turn off (This trigger)
        • Else - Actions
 
Level 5
Joined
Jan 5, 2019
Messages
108
I am actually lost, i thought i fixed it but for some reason this one

  • If (((Owner of (Triggering unit)) Food max) Equal to 5) then do (Trigger - Turn off Thorn Aura <gen>) else do (Player - Add 1 to (Owner of (Triggering unit)) Food used)
Wont Turn off my Trigger before it does the rest at least one time... -_-


  • Thorn Aura
    • Events
      • Unit - A unit Acquires an item
    • Conditions
      • (Item-type of (Item being manipulated)) Equal to Thorn Aura
    • Actions
      • If (((Owner of (Triggering unit)) Food max) Equal to 5) then do (Trigger - Turn off Thorn Aura <gen>) else do (Player - Add 1 to (Owner of (Triggering unit)) Food used)
      • Set Units = (Triggering unit)
      • Set Ability[(Player number of (Owner of Units))] = Thorns Aura
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Level of Ability[(Player number of (Owner of Units))] for Units) Less than 1
        • Then - Actions
          • Unit - Add Ability[(Player number of (Owner of Units))] to Units
          • Game - Display to (Player group((Owner of Units))) for 5.00 seconds the text: |c0000FFFF Thorn Au...
          • Special Effect - Create a special effect attached to the origin of Units using Abilities\Spells\Items\AIem\AIemTarget.mdl
          • Special Effect - Destroy (Last created special effect)
        • Else - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (Level of Ability[(Player number of (Owner of Units))] for Units) Less than 10
            • Then - Actions
              • Unit - Increase level of Ability[(Player number of (Owner of Units))] for Units
              • Game - Display to (Player group((Owner of Units))) for 5.00 seconds the text: (|c0000FFFF Thorn Aura's |r Level + ( is + ( + (String((Level of Thorns Aura for Units))))))
              • Special Effect - Create a special effect attached to the origin of Units using Abilities\Spells\Items\AIem\AIemTarget.mdl
              • Special Effect - Destroy (Last created special effect)
            • Else - Actions
              • Game - Display to (Player group((Owner of Units))) for 5.00 seconds the text: This spell is alrea...
              • Player - Add 400 to (Owner of Units) Current gold
 
Level 5
Joined
Jan 5, 2019
Messages
108
I think i need some kind of looping check condition thingy running but i am bot sure hmmm
 
Level 6
Joined
Jan 9, 2019
Messages
102
  • If - Conditions
    • (Level of Ability[(Player number of (Owner of Units))] for Units) Less than 1
  • Then - Actions
    • Unit - Add Ability[(Player number of (Owner of Units))] to Units
    • Game - Display to (Player group((Owner of Units))) for 5.00 seconds the text: |c0000FFFF Thorn Au...
    • Special Effect - Create a special effect attached to the origin of Units using Abilities\Spells\Items\AIem\AIemTarget.mdl
    • Special Effect - Destroy (Last created special effect)
Place the action that add 1 food inside this?
 
Level 5
Joined
Jan 5, 2019
Messages
108
  • If - Conditions
    • (Level of Ability[(Player number of (Owner of Units))] for Units) Less than 1
  • Then - Actions
    • Unit - Add Ability[(Player number of (Owner of Units))] to Units
    • Game - Display to (Player group((Owner of Units))) for 5.00 seconds the text: |c0000FFFF Thorn Au...
    • Special Effect - Create a special effect attached to the origin of Units using Abilities\Spells\Items\AIem\AIemTarget.mdl
    • Special Effect - Destroy (Last created special effect)
Place the action that add 1 food inside this?

It didn't work :( it kind of fell like the comparison operator doesn't respond to value 5 no matter if its max food or food cap or what ever... and i don't know if for example its possible to make an action where you Set the comparison operator = food used 5 without making it a variable
 
Last edited:
Level 5
Joined
Jan 5, 2019
Messages
108
Isn't the first if redundant mate?

By the way, this exist.
  • ((Owner of (Triggering unit)) Food used) Equal to 5

If you mean if this is redundant ?
  • (Level of Ability[(Player number of (Owner of Units))] for Units) Less than 1
it not because i need the less then 1 to count, so i can add 1 food used if its less then 1 to control the players maximum ability available
 
Level 5
Joined
Jan 5, 2019
Messages
108
Right now it looks like this. i needed this trigger because it almost worked, but for some reason it added 1 spell even tho the trigger was disable
  • If (((Owner of (Triggering unit)) Food max) Equal to 5) then do (Unit - For (Triggering unit), Ability Thorns Aura , Disable ability: True, Hide UI: True) else do (Game - Set Tooltip of Thorns Aura to Cant Learn More Spells for level 1)
  • Thorn Aura
    • Events
      • Unit - A unit Acquires an item
    • Conditions
      • (Item-type of (Item being manipulated)) Equal to Thorn Aura
    • Actions
      • Set Units = (Triggering unit)
      • Set Ability[(Player number of (Owner of Units))] = Thorns Aura
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Level of Ability[(Player number of (Owner of Units))] for Units) Less than 1
        • Then - Actions
          • Player - Add 1 to (Owner of (Triggering unit)) Food used
          • If (((Owner of (Triggering unit)) Food max) Equal to 5) then do (Unit - For (Triggering unit), Ability Thorns Aura , Disable ability: True, Hide UI: True) else do (Game - Set Tooltip of Thorns Aura to Cant Learn More Spells for level 1)
          • Unit - Add Ability[(Player number of (Owner of Units))] to Units
          • Game - Display to (Player group((Owner of Units))) for 5.00 seconds the text: |c0000FFFF Thorn Au...
          • Special Effect - Create a special effect attached to the origin of Units using Abilities\Spells\Items\AIem\AIemTarget.mdl
          • Special Effect - Destroy (Last created special effect)
        • Else - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (Level of Ability[(Player number of (Owner of Units))] for Units) Less than 10
            • Then - Actions
              • Unit - Increase level of Ability[(Player number of (Owner of Units))] for Units
              • Game - Display to (Player group((Owner of Units))) for 5.00 seconds the text: (|c0000FFFF Thorn Aura's |r Level + ( is + ( + (String((Level of Thorns Aura for Units))))))
              • Special Effect - Create a special effect attached to the origin of Units using Abilities\Spells\Items\AIem\AIemTarget.mdl
              • Special Effect - Destroy (Last created special effect)
            • Else - Actions
              • Game - Display to (Player group((Owner of Units))) for 5.00 seconds the text: This spell is alrea...
              • Player - Add 400 to (Owner of Units) Current gold
 
Level 5
Joined
Jan 5, 2019
Messages
108
Here is my map if you wanna test it, i am about to go mad been looking for this trigger in 4 hours now :confused:
 

Attachments

  • Test (2).w3x
    335.2 KB · Views: 18
Level 6
Joined
Jan 9, 2019
Messages
102
Trying to point things in GUI is bloody difficult... Hopefully this is understandable.
  • Thorn Aura
    • Events
      • Unit - A unit Acquires an item
    • Conditions
      • (Item-type of (Item being manipulated)) Equal to Thorn Aura
    • Actions
      • Set Units = (Triggering unit) <---- This line is weird and unneeded
      • Set Ability[(Player number of (Owner of Units))] = Thorns Aura <---- This line means that each player can only hold 1 ability, otherwise it has bugs
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Level of Ability[(Player number of (Owner of Units))] for Units) Less than 1 <---- Same as above, and so is every line that refers Ability[]
        • Then - Actions
          • Player - Add 1 to (Owner of (Triggering unit)) Food used
          • If (((Owner of (Triggering unit)) Food max) Equal to 5) then do (Unit - For (Triggering unit), Ability Thorns Aura , Disable ability: True, Hide UI: True) else do (Game - Set Tooltip of Thorns Aura to Cant Learn More Spells for level 1) <---- This solution to no solution should not be used mate
          • Unit - Add Ability[(Player number of (Owner of Units))] to Units
          • Game - Display to (Player group((Owner of Units))) for 5.00 seconds the text: |c0000FFFF Thorn Au...
          • Special Effect - Create a special effect attached to the origin of Units using Abilities\Spells\Items\AIem\AIemTarget.mdl
          • Special Effect - Destroy (Last created special effect)
        • Else - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (Level of Ability[(Player number of (Owner of Units))] for Units) Less than 10
            • Then - Actions
              • Unit - Increase level of Ability[(Player number of (Owner of Units))] for Units
              • Game - Display to (Player group((Owner of Units))) for 5.00 seconds the text: (|c0000FFFF Thorn Aura's |r Level + ( is + ( + (String((Level of Thorns Aura for Units))))))
              • Special Effect - Create a special effect attached to the origin of Units using Abilities\Spells\Items\AIem\AIemTarget.mdl
              • Special Effect - Destroy (Last created special effect)
            • Else - Actions
              • Game - Display to (Player group((Owner of Units))) for 5.00 seconds the text: This spell is alrea...
              • Player - Add 400 to (Owner of Units) Current gold
This one should be more straightforward.
  • <TriggerName>
    • Events
      • Unit - A unit Acquires an item
    • Conditions
      • (Item being manipulated) Equal to <AbilityItem>
    • Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Level of <Ability> for (Triggering unit)) Equal to 0
        • Then - Actions
          • -------- New ability actions --------
        • Else - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (Level of <Ability> for (Triggering unit)) Greater than 10
            • Then - Actions
              • -------- Maxed ability actions --------
            • Else - Actions
              • -------- Increase ability level actions --------
 
Level 5
Joined
Jan 5, 2019
Messages
108
Trying to point things in GUI is bloody difficult... Hopefully this is understandable.
  • Thorn Aura
    • Events
      • Unit - A unit Acquires an item
    • Conditions
      • (Item-type of (Item being manipulated)) Equal to Thorn Aura
    • Actions
      • Set Units = (Triggering unit) <---- This line is weird and unneeded
      • Set Ability[(Player number of (Owner of Units))] = Thorns Aura <---- This line means that each player can only hold 1 ability, otherwise it has bugs
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Level of Ability[(Player number of (Owner of Units))] for Units) Less than 1 <---- Same as above, and so is every line that refers Ability[]
        • Then - Actions
          • Player - Add 1 to (Owner of (Triggering unit)) Food used
          • If (((Owner of (Triggering unit)) Food max) Equal to 5) then do (Unit - For (Triggering unit), Ability Thorns Aura , Disable ability: True, Hide UI: True) else do (Game - Set Tooltip of Thorns Aura to Cant Learn More Spells for level 1) <---- This solution to no solution should not be used mate
          • Unit - Add Ability[(Player number of (Owner of Units))] to Units
          • Game - Display to (Player group((Owner of Units))) for 5.00 seconds the text: |c0000FFFF Thorn Au...
          • Special Effect - Create a special effect attached to the origin of Units using Abilities\Spells\Items\AIem\AIemTarget.mdl
          • Special Effect - Destroy (Last created special effect)
        • Else - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (Level of Ability[(Player number of (Owner of Units))] for Units) Less than 10
            • Then - Actions
              • Unit - Increase level of Ability[(Player number of (Owner of Units))] for Units
              • Game - Display to (Player group((Owner of Units))) for 5.00 seconds the text: (|c0000FFFF Thorn Aura's |r Level + ( is + ( + (String((Level of Thorns Aura for Units))))))
              • Special Effect - Create a special effect attached to the origin of Units using Abilities\Spells\Items\AIem\AIemTarget.mdl
              • Special Effect - Destroy (Last created special effect)
            • Else - Actions
              • Game - Display to (Player group((Owner of Units))) for 5.00 seconds the text: This spell is alrea...
              • Player - Add 400 to (Owner of Units) Current gold
This one should be more straightforward.
  • <TriggerName>
    • Events
      • Unit - A unit Acquires an item
    • Conditions
      • (Item being manipulated) Equal to <AbilityItem>
    • Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Level of <Ability> for (Triggering unit)) Equal to 0
        • Then - Actions
          • -------- New ability actions --------
        • Else - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (Level of <Ability> for (Triggering unit)) Greater than 10
            • Then - Actions
              • -------- Maxed ability actions --------
            • Else - Actions
              • -------- Increase ability level actions --------
Thanks gonna try it out
 
Level 5
Joined
Jan 5, 2019
Messages
108
Okay i actually fixed it. now i only have a champagne problem with some strings saying they learned a spell even tho the player doesn't learn it. but thanks for the help anyways ^^

  • Food Spell Thorn Aura
    • Events
      • Unit - A unit Acquires an item
    • Conditions
      • (Item-type of (Item being manipulated)) Equal to Thorn Aura
    • Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Player 1 (Red) Food used) Not equal to 5
        • Then - Actions
          • Player - Add 1 to (Owner of (Triggering unit)) Food used
        • Else - Actions
  • Cant Learn Thorn Aura
    • Events
      • Unit - A unit Acquires an item
    • Conditions
      • (Item-type of (Item being manipulated)) Equal to Thorn Aura
    • Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Player 1 (Red) Food used) Equal to 5
        • Then - Actions
          • Unit - For (Triggering unit), Ability Thorns Aura , Disable ability: True, Hide UI: True
        • Else - Actions
          • Player - Add 400 to (Owner of Units) Current gold
  • Thorn Aura
    • Events
      • Unit - A unit Acquires an item
    • Conditions
      • (Item-type of (Item being manipulated)) Equal to Thorn Aura
    • Actions
      • Set Ability[(Player number of (Owner of Units))] = Thorns Aura
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Level of Ability[(Player number of (Owner of Units))] for Units) Less than 1
        • Then - Actions
          • Unit - Add Ability[(Player number of (Owner of Units))] to Units
          • Game - Display to (Player group((Owner of Units))) for 5.00 seconds the text: |c0000FFFF Thorn Au...
          • Special Effect - Create a special effect attached to the origin of Units using Abilities\Spells\Items\AIem\AIemTarget.mdl
          • Special Effect - Destroy (Last created special effect)
        • Else - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (Level of Ability[(Player number of (Owner of Units))] for Units) Less than 10
            • Then - Actions
              • Unit - Increase level of Ability[(Player number of (Owner of Units))] for Units
              • Game - Display to (Player group((Owner of Units))) for 5.00 seconds the text: (|c0000FFFF Thorn Aura's |r Level + ( is + ( + (String((Level of Thorns Aura for Units))))))
              • Special Effect - Create a special effect attached to the origin of Units using Abilities\Spells\Items\AIem\AIemTarget.mdl
              • Special Effect - Destroy (Last created special effect)
            • Else - Actions
              • Game - Display to (Player group((Owner of Units))) for 5.00 seconds the text: This spell is alrea...
              • Player - Add 400 to (Owner of Units) Current gold
 
Last edited:
Status
Not open for further replies.
Top