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] Food = Item being bought / spell

Discussion in 'Triggers & Scripts' started by Neptix, Feb 12, 2019 at 11:27 PM.

  1. Neptix

    Neptix

    Joined:
    Jan 5, 2019
    Messages:
    73
    Resources:
    0
    Resources:
    0
    Can someone help me set up a trigger, when ever an new item is being bought it count as 1 Food was used?

    In my case all my spells variable is set to be named Ability, so i would like to have my Ability/variable set to Food used + 1. so i can control how many spells the player gets to buy.

    But the tricky part is the item/spell the player bought cant cost any food after they bought it once, or else it wont be able to level up

    Here is how my spells setup looks.


    • Frost Nova
      • Events
        • Unit - A unit Acquires an item
      • Conditions
        • (Item-type of (Item being manipulated)) Equal to Frost Nova
      • Actions
        • Set Units = (Triggering unit)
        • Set Ability[(Player number of (Owner of Units))] = Frost Nova
        • 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 Frost No...
            • 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 Frost Nova's |r Level + ( is + ( + (String((Level of Frost Nova 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
     

    Attached Files:

    Last edited: Feb 12, 2019 at 11:39 PM
  2. Overfrost

    Overfrost

    Joined:
    Jan 9, 2019
    Messages:
    82
    Resources:
    0
    Resources:
    0
    Create a dummy unit in object editor, give it Locust ability and no model, make sure it costs 1 food as you said. Create that unit whenever the ability is added. You can place it anywhere if it has no model, otherwise place it somewhere that can't be seen. Also, make sure that its owner is the player that learns the ability.