1. The poll for our 11th Music Contest is up! Help us choose the most awesome cinematic tracks by casting a vote!
    Dismiss Notice
  2. Melee Mapping contest #3 - Poll is up! Vote for the best 4v4 melee maps!
    Dismiss Notice
  3. The 30th edition of the Modeling Contest is finally up! The Portable Buildings need your attention, so come along and have a blast!
    Dismiss Notice
  4. The Aftermath has been revealed for the 19th Terraining Contest! Be sure to check out the Results and see what came out of it.
    Dismiss Notice

[Trigger] Item cost food

Discussion in 'Triggers & Scripts' started by Neptix, Feb 14, 2019 at 3:11 AM.

  1. Neptix

    Neptix

    Joined:
    Jan 5, 2019
    Messages:
    73
    Resources:
    0
    Resources:
    0
    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
     
  2. Overfrost

    Overfrost

    Joined:
    Jan 9, 2019
    Messages:
    82
    Resources:
    0
    Resources:
    0
    (Owner of (Item being manipulated)) -> (Owner of (Triggering unit)) ?
     
  3. Neptix

    Neptix

    Joined:
    Jan 5, 2019
    Messages:
    73
    Resources:
    0
    Resources:
    0

    Nvm i think i fixed it :) you where right those two where totally irrelevant
     
    Last edited: Feb 15, 2019 at 3:31 AM
  4. Neptix

    Neptix

    Joined:
    Jan 5, 2019
    Messages:
    73
    Resources:
    0
    Resources:
    0
    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
     
  5. Neptix

    Neptix

    Joined:
    Jan 5, 2019
    Messages:
    73
    Resources:
    0
    Resources:
    0
    I think i need some kind of looping check condition thingy running but i am bot sure hmmm
     
  6. Overfrost

    Overfrost

    Joined:
    Jan 9, 2019
    Messages:
    82
    Resources:
    0
    Resources:
    0
    • 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?
     
  7. Neptix

    Neptix

    Joined:
    Jan 5, 2019
    Messages:
    73
    Resources:
    0
    Resources:
    0
    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: Feb 15, 2019 at 7:33 AM
  8. Overfrost

    Overfrost

    Joined:
    Jan 9, 2019
    Messages:
    82
    Resources:
    0
    Resources:
    0
    Isn't the first if redundant mate?

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

    Neptix

    Joined:
    Jan 5, 2019
    Messages:
    73
    Resources:
    0
    Resources:
    0
    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
     
  10. Neptix

    Neptix

    Joined:
    Jan 5, 2019
    Messages:
    73
    Resources:
    0
    Resources:
    0
    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
     
  11. Neptix

    Neptix

    Joined:
    Jan 5, 2019
    Messages:
    73
    Resources:
    0
    Resources:
    0
    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:
     

    Attached Files:

  12. Overfrost

    Overfrost

    Joined:
    Jan 9, 2019
    Messages:
    82
    Resources:
    0
    Resources:
    0
    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 --------
     
  13. Neptix

    Neptix

    Joined:
    Jan 5, 2019
    Messages:
    73
    Resources:
    0
    Resources:
    0
    Thanks gonna try it out
     
  14. Neptix

    Neptix

    Joined:
    Jan 5, 2019
    Messages:
    73
    Resources:
    0
    Resources:
    0
    But how does that make the spell cost food ?
     
  15. Neptix

    Neptix

    Joined:
    Jan 5, 2019
    Messages:
    73
    Resources:
    0
    Resources:
    0
    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: Feb 15, 2019 at 12:49 PM