1. Join Texturing Contest #30 now in a legendary battle of mythological creatures!
    Dismiss Notice
  2. 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
  3. Melee Mapping Contest #3 - Results are out! Congratulate the winners and check plenty of new 4v4 melee maps designed for this competition!
    Dismiss Notice
  4. The winners of our cinematic soundtrack competition have been decided! Step by the Music Contest #11 - Results to check the entries and congratulate the winners!
    Dismiss Notice
  5. Check out the Staff job openings thread.
    Dismiss Notice

[Trigger] Food = Item being bought / spell

Discussion in 'Triggers & Scripts' started by Neptix, Feb 12, 2019.

  1. Neptix

    Neptix

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

    Overfrost

    Joined:
    Jan 9, 2019
    Messages:
    102
    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.