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

Status
Not open for further replies.
Level 5
Joined
Jan 5, 2019
Messages
108
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
 

Attachments

  • Test.w3x
    333.5 KB · Views: 29
Last edited:
Level 6
Joined
Jan 9, 2019
Messages
102
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.
 
Status
Not open for further replies.
Top