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

+15 Exp each time my hero with a passive item attack an enemy

Level 11
Joined
Sep 11, 2013
Messages
326
Greetings folks!
I wonder if someone can help me with such a system:peasant-work-work:

I have 2 player groups (team 1 & team 2) and i want to make an item that gives +15 Experience to the hero each time when he attacks(per hit) the enemy(enemy group or neutral creeps) only when the hero has a specific "X" item in inventory. If The hero has 6 items of "X", then he will get +15 - 6 times equal 90 Exp per hit.

Potential problems..
What will happen if an illusion of the hero with that "X" item will attack an enemy? ( I don't want that to work ) (The illusion must not receive Exp for the main hero)

The Help will be appreciated!
 

Uncle

Warcraft Moderator
Level 64
Joined
Aug 10, 2018
Messages
6,546
  • Exp Item Acquire
    • Events
      • Unit - A unit Acquires an item
    • Conditions
      • (Item-type of (Item being manipulated)) Equal to Exp Item
    • Actions
      • Set VariableSet Unit = (Triggering unit)
      • Set VariableSet Custom_Value = (Custom value of Unit)
      • -------- --------
      • -------- Track the unit's Exp bonus (add 15): --------
      • Set VariableSet Unit_Exp_Bonus[Custom_Value] = (Unit_Exp_Bonus[Custom_Value] + 15)
      • -------- --------
      • -------- Track how many of these items are equipped so we can manage the Damage trigger: --------
      • Set VariableSet Total_Item_Count = (Total_Item_Count + 1)
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • Total_Item_Count Equal to 1
        • Then - Actions
          • Trigger - Turn on Exp Item Damage <gen>
        • Else - Actions
  • Exp Item Lose
    • Events
      • Unit - A unit Loses an item
    • Conditions
      • (Item-type of (Item being manipulated)) Equal to Exp Item
    • Actions
      • Set VariableSet Unit = (Triggering unit)
      • Set VariableSet Custom_Value = (Custom value of Unit)
      • -------- --------
      • -------- Track the unit's Exp bonus (subtract 15): --------
      • Set VariableSet Unit_Exp_Bonus[Custom_Value] = (Unit_Exp_Bonus[Custom_Value] - 15)
      • -------- --------
      • -------- Track how many of these items are equipped so we can manage the Damage trigger: --------
      • Set VariableSet Total_Item_Count = (Total_Item_Count - 1)
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • Total_Item_Count Equal to 0
        • Then - Actions
          • Trigger - Turn off Exp Item Damage <gen>
        • Else - Actions
  • Exp Item Damage
    • Events
      • Unit - A unit Takes damage
    • Conditions
      • (Damage From Normal Attack) Equal to True
    • Actions
      • Set VariableSet Unit = (Damage source)
      • Set VariableSet Custom_Value = (Custom value of Unit)
      • -------- --------
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • Unit_Exp_Bonus[Custom_Value] Greater than 0
        • Then - Actions
          • Hero - Add Unit_Exp_Bonus[Custom_Value] experience to Unit, Show level-up graphics
        • Else - Actions
^ The Damage trigger should be initially OFF. These triggers are taking advantage of Bribe's Unit Indexer.

Note that I was playing around with the Mirror Image ability to test how Illusions worked (they can't gain experience - so no worries there) and I found out that this ability causes weird problems for the Unit Indexer and gives the Blademaster a new custom value whenever he casts the ability. In other words, that ability breaks the system (way to go Reforged).
 

Attachments

  • Exp Item Example 2.w3m
    23.9 KB · Views: 2
Level 11
Joined
Sep 11, 2013
Messages
326
Hi again!
I found 2 problems and i don't know how to solve them..
1. This item will give exp even if the hero hit an ally or a friend & i don't want that..
2.This item will give exp even if the hero hit a neutral passive unit & i don't want that..

This item must give exp only if the hero hit an enemy player (buildings or units) or an enemy neutral hostile (buildings or units).

Thanks for help & sorry to bother!:peasant-sad:
 
Last edited:

Uncle

Warcraft Moderator
Level 64
Joined
Aug 10, 2018
Messages
6,546
This is the Damage trigger:
  • Exp Item Damage
    • Events
      • Unit - A unit Takes damage
    • Conditions
      • (Damage From Normal Attack) Equal to True
    • Actions
      • Set VariableSet Unit = (Damage source)
      • Set VariableSet Custom_Value = (Custom value of Unit)
      • -------- --------
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • Unit_Exp_Bonus[Custom_Value] Greater than 0
        • Then - Actions
          • Hero - Add Unit_Exp_Bonus[Custom_Value] experience to Unit, Show level-up graphics
        • Else - Actions
Note the Conditions:
  • Conditions
    • (Damage From Normal Attack) Equal to True
This is where you would Add your own Conditions to produce the desired results.

(Damage Target) is the Event Response used to get the unit that took damage. So using a Boolean Comparison condition, you can add a check to see if the (Damage Target) belongs to an Enemy of the Owner of the (Damage source). In other words, check if the unit that took the damage is an enemy of the unit that dealt the damage.

Also, you can always disable friendly fire, a lot of custom maps do this to prevent people from abusing their teammates.
 
Last edited:
Top