• 🏆 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!

Ability Adding

Status
Not open for further replies.
Level 4
Joined
Dec 8, 2007
Messages
86
I'm working on a trigger that will (when buying an item/ability in the shop) the one who bought it will get the ability...

  • Mend Wounds
    • Events
      • Unit - A unit Uses an item
    • Conditions
      • (Item-type of (Item being manipulated)) Equal to Mend Wounds
    • Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Level of Mend Wounds for (Hero manipulating item)) Equal to 0
        • Then - Actions
          • Set GoldSpent[(Player number of (Owner of (Hero manipulating item)))] = (GoldSpent[(Player number of (Owner of (Hero manipulating item)))] + 400)
          • Unit - Add Mend Wounds to (Hero manipulating item)
          • Unit - Set level of Mend Wounds for (Hero manipulating item) to 1
        • Else - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (Level of Mend Wounds for (Hero manipulating item)) Less than 10
            • Then - Actions
              • Unit - Increase level of Mend Wounds for (Hero manipulating item)
            • Else - Actions
              • Game - Display to (Player group((Owner of (Hero manipulating item)))) for 4.00 seconds the text: You have already ma...
              • Player - Add 400 to (Owner of (Hero manipulating item)) Current gold
I wonder how to make this work (in other words what should i replace the Condition)
" If - Conditions
(Level of Mend Wounds for (Hero manipulating item)) Equal to 0"
with?
 
An ability can't be level 0. Have you seen many abilities out there with starting level of 0?
Just set a "True" boolean when a unit acquires this item. So, you can do this:
  • Mend Wounds
  • Events
    • Unit - A unit acquires an item [Event changed, noticed?]
  • Conditions
    • (Item-type of (Item being manipulated)) Equal to Mend Wounds
  • Actions
    • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
      • If - Conditions
        • UsedAlready[Player Number of (Owner of (Hero Manipulating Item))] Not Equal to True
      • Then - Actions
        • Set UsedAlready[Player Number of (Owner of (Hero Manipulating Item))] = True
        • Set GoldSpent[(Player number of (Owner of (Hero manipulating item)))] = (GoldSpent[(Player number of (Owner of (Hero manipulating item)))] + 400)
        • Unit - Add Mend Wounds to (Hero manipulating item)
        • Unit - Set level of Mend Wounds for (Hero manipulating item) to 1
      • Else - Actions
 
An ability can't be level 0. Have you seen many abilities out there with starting level of 0?

I guess an ability is level 0 when the unit does not have that ability o.o

Hmm... don't think you need to set the ability level to 1 :p
And I never remember correctly, perhaps you should use "A unit acquires an item" in the event, as PurplePoot said.
 
Level 4
Joined
Dec 8, 2007
Messages
86
Though... i do not quite understand why i should use "Aquires Item" before "Uses Item"... (the item is automatically used when aquired... and based on tomes)

When i try to see if the spell gets added with:
  • Mend Wounds
    • Events
      • Unit - A unit Uses an item
    • Conditions
      • (Item-type of (Item being manipulated)) Equal to Mend Wounds
    • Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Level of Mend Wounds for (Hero manipulating item)) Equal to 0
        • Then - Actions
          • Set GoldSpent[(Player number of (Owner of (Hero manipulating item)))] = (GoldSpent[(Player number of (Owner of (Hero manipulating item)))] + 400)
          • Unit - Add Mend Wounds to (Hero manipulating item)
        • Else - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (Level of Mend Wounds for (Hero manipulating item)) Less than 10
            • Then - Actions
              • Set GoldSpent[(Player number of (Owner of (Hero manipulating item)))] = (GoldSpent[(Player number of (Owner of (Hero manipulating item)))] + 400)
              • Unit - Increase level of Mend Wounds for (Hero manipulating item)
            • Else - Actions
              • Game - Display to (Player group((Owner of (Hero manipulating item)))) the text: You have already ma...
              • Player - Add 400 to (Owner of (Hero manipulating item)) Current gold
It doesn't (and it doesn't add the 400 into the "GoldSpent" Integer)
 
Though... i do not quite understand why i should use "Aquires Item" before "Uses Item"... (the item is automatically used when aquired... and based on tomes)

I guess the event "uses an item" is not triggered when the item is tome-based, because the item doesn't even show up in the inventory (proof: you can pick it with full inventory). Therefore, it's impossible to actually "use" the item xD

On the other hand, it's certain that the unit acquired the item :p

An extra Boolean variable is a "more work to be done"? Ok, nice...

Maybe not "more work to be done", but I think it's unecessary, as he could simply check for the ability level instead (assuming that it's impossible to decrease the level of an ability).


...And people don't have to call me "Marcelo Hossomi", choose only one please xD
 
Status
Not open for further replies.
Top