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

hero gain xp on return gold and lumber

Status
Not open for further replies.
Level 2
Joined
Nov 6, 2019
Messages
7
Hello, I'm putting the project back on track and I wanted to know if it's possible to make a hero gain experience by delivering gold and wood
 

Uncle

Warcraft Moderator
Level 64
Joined
Aug 10, 2018
Messages
6,510
Edit: Correction, the Harvest order is issued by the unit when it delivers gold/lumber. Thanks @Ziadoma.

See my bottom post.

There's no Event to detect when a unit delivers gold/lumber.

However, you can detect changes in a player's gold/lumber, so you could possibly determine when they gain +10 gold and reward XP in response, however, that means the trigger will run regardless of what gave them the 10 gold. Lumber can vary in amount so that's an even bigger issue.

Long story short, a bug free solution is probably not possible without a fairly involved resource harvesting system.
 
Last edited:
Level 14
Joined
Jan 24, 2017
Messages
246
Isn't Harvest issued when you order the unit to target the Gold Mine/Tree? I was under the impression it was not on delivery.
I think if you order them to harvest the order "smart" is being used. But you need to check around with the orders yourself. But maybe something like this could work:
  • Gain XP
    • Events
      • Unit - A unit Is issued an order targeting an object
    • Conditions
      • ((Triggering unit) is A Hero) Equal to True
    • Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Issued order) Equal to (Order(harvest))
        • Then - Actions
          • Hero - Add 50 experience to (Triggering unit), Hide level-up graphics
        • Else - Actions
 

Uncle

Warcraft Moderator
Level 64
Joined
Aug 10, 2018
Messages
6,510
I think if you order them to harvest the order "smart" is being used. But you need to check around with the orders yourself. But maybe something like this could work:
  • Gain XP
    • Events
      • Unit - A unit Is issued an order targeting an object
    • Conditions
      • ((Triggering unit) is A Hero) Equal to True
    • Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Issued order) Equal to (Order(harvest))
        • Then - Actions
          • Hero - Add 50 experience to (Triggering unit), Hide level-up graphics
        • Else - Actions
I just tested it and you're correct.

"smart" is issued when you right click a Gold Mine/Tree.
"harvest" is issued if you order the unit to use the Gather ability on a Gold Mine/Tree.
"harvest" is also issued when you deliver the resources to a town hall.

So you'd want to add another Condition to check if the target of "harvest" is a town hall.
  • Gain XP
    • Events
      • Unit - A unit Is issued an order targeting an object
    • Conditions
      • (Issued order) Equal to (Order(harvest))
      • ((Triggering unit) is A Hero) Equal to True
      • ((Target unit of issued order) is A town-hall-type unit) Equal to True
    • Actions
      • Hero - Add 50 experience to (Triggering unit), Hide level-up graphics
Perhaps you could even sync this up with a system that detects when a player's gold/lumber changes. Then you'd be able to detect the exact amount that was harvested and be able to vary the rewarded XP based on that amount.
 
Last edited:
Level 2
Joined
Nov 6, 2019
Messages
7
I checked if there was any specific trigger @Uncle but I didn't find it so I thought could do it by conditions but was in doubt about what it would be. Yes and at the time the unit delivers the resource @Ziadoma I was looking at adapting the mechanics of your empire earth to improve unit attributes such as damage, defense etc. thanks for the help
 
Status
Not open for further replies.
Top