• Listen to a special audio message from Bill Roper to the Hive Workshop community (Bill is a former Vice President of Blizzard Entertainment, Producer, Designer, Musician, Voice Actor) 🔗Click here to hear his message!
  • Read Evilhog's interview with Gregory Alper, the original composer of the music for WarCraft: Orcs & Humans 🔗Click here to read the full interview.

Xp System Based on damage

Status
Not open for further replies.
Level 2
Joined
Oct 9, 2006
Messages
17
This is off the top of my head, it can be made better.
But make a (real) variable
EXP will be my variable

  • trig1
    • Events
      • Unit - A unit Is attacked
    • Conditions
    • Actions
      • Set EXP = ((Max life of (Attacked unit)) - (Life of (Attacked unit)))
      • Trigger - turn off (This trigger)
  • trig2
    • Events
      • Unit - A unit Dies
    • Conditions
    • Actions
      • Hero - Add (Integer(EXP)) experience to (Attacking unit), Show level-up graphics
      • Trigger - Turn on (trig1)
 
Level 2
Joined
Aug 24, 2008
Messages
16
U Said U Wanted A XP System Based On A Unit's Damage. Bt U Did Nt Mention Hw U Wanted It.

Did U Meant Exp Given = Total Damage Dealt To Unit, Or
Did U Meant Avrg Damage Dealt To Unit Convert To Exp?

If It Is The 1st 1 Use Blooper's Trigger. If Its The Latter,
U R Supposed To Do The Following:

-Events-
A unit is attacked
-Conditions-
Skip~
-Actions-
Set <Variable(Unit)> equals to attacked unit.
Set <Variable(Integer)> equals to [<Variable(Integer)>+1]

-Events-
A unit dies
-Conditions-
Dying unit equals to <Variable(Unit)> equals to true
-Actions-
Set <Variable(Integer2)> equals to [Max life of <Variable(Unit)> divided by <Variable(Integer)]
Set <Variable(Real)> equals to [Real<Variable(Integer2)>]
Add <Variable(Real)> to killing unit, show level-up graphics

If U Did Not Understand Why I Set <Variable(Integer)> To Itself +1, It Is Because Im Using It To Count The Number Of Hits U Took To Kill The Unit, And Thn Use The Max Life Of Killed Unit Divided By It To Obtain An Avrg Score.

What Are The Cons Of This Trigger:
[X] Exp Given Wil Be Inaccurate If Thrs More Than 1 Unit Attacking
[X] Causes Lag
[X] Can Onli Apply On 1 Unit
[X] If Thr Is Mor Than 1 Unit Attacking At The Same Time, The Following Might Happen:
[X]Wc3 TFT Crashes
[X]Trigger Fails And Leaks Totally
 
Level 3
Joined
Jul 6, 2008
Messages
42
First Trigger : Add all unit into specific unit in trigger 2.
  • Attacked
    • Events
      • Time - Every 0.10 seconds of game time
    • Conditions
    • Actions
      • Unit Group - Pick every unit in (Units in (Playable map area) matching (((Matching unit) is in XP_Picked_Unit) Equal to False)) and do (Actions)
        • Loop - Actions
          • Unit Group - Add (Picked unit) to XP_Picked_Unit
          • Trigger - Add to Take EXP <gen> the event (Unit - (Picked unit) Takes damage)
Second Trigger : Give exp to attacking unit.
  • Take EXP
    • Events
    • Conditions
    • Actions
      • Hero - Add (Integer((Damage taken))) experience to (Damage source), Show level-up graphics
The example i make for you need 2 trigger to function.
The 1st 1 is to add unit that being attacked into "Specified Unit"
of the event of the second trigger.

The second trigger is use to add XP to the unit that damage enermy .
The trigger above is just basic concept of this XP system.


Well , to make it more complete ,
you can try replace the action in second trigger with this .
  • Actions
    • Set DamagedTarget_Point = (Position of (Triggering unit))
    • Set Damages = (Integer((Damage taken)))
    • Unit Group - Pick every unit in (Units within 1200.00 of DamagedTarget_Point matching ((((Matching unit) belongs to an ally of (Owner of (Damage source))) Equal to True) and (((Matching unit) is A Hero) Equal to True))) and do (Actions)
      • Loop - Actions
        • Unit Group - Add (Picked unit) to Hero_Picked
    • Unit Group - Pick every unit in Hero_Picked and do (Actions)
      • Loop - Actions
        • Hero - Add (Damages / (Number of units in Hero_Picked)) experience to (Picked unit), Show level-up graphics
    • Unit Group - Remove all units from Hero_Picked
    • Custom script: call RemoveLocation(udg_DamagedTarget_Point)
Which is more recommented .

Variable That added :
unit group - Hero_Picked
point - DamagedTarget_Point
integer - Damages

This will add XP to heroes which are in 1200 range ( Default Maximum XP Gain Range ) of the unit that took damages equally whenever the unit own by the owner of hero attack units.The variables added is to prevent leakage.
 
Last edited:
Status
Not open for further replies.
Top