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

Need Some Help With a Trigger Plz

Status
Not open for further replies.
Level 4
Joined
May 18, 2004
Messages
60
Code:
Level 1 Sharing Experience and Max
    Events
        Unit - A unit owned by Neutral Hostile Dies
    Conditions
        (Level of (Dying unit)) Equal to 1
    Actions
        If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            If - Conditions
                ((Killing unit) is A Hero) Equal to True
                (Hero level of (Killing unit)) Less than or equal to 7
            Then - Actions
                Set Sharing_Exp = 0
                Player Group - Remove (Owner of Players_Current_Hero[(Integer A)]) from Sharing_Exp_Players_In_Range
                For each (Integer A) from 1 to 6, do (Actions)
                    Loop - Actions
                        If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                            If - Conditions
                                ((Rect centered at (Position of Players_Current_Hero[(Player number of (Owner of (Killing unit)))]) with size (600.00, 600.00)) contains Players_Current_Hero[(Integer A)]) Equal to True
                            Then - Actions
                                Player Group - Add (Owner of Players_Current_Hero[(Integer A)]) to Sharing_Exp_Players_In_Range
                                Set Sharing_Exp = ((Point-value of (Dying unit)) / (Number of players in Sharing_Exp_Players_In_Range))
                                Hero - Add Sharing_Exp experience to Players_Current_Hero[(Integer A)], Show level-up graphics
                            Else - Actions
Do nothing
Else - Actions
Do nothing

Ok, the objective of this trigger is:

When a player kills a monster, if there is any other players within a circle range of 600, then it is suppose to take the exp from the monster kill, divide it by the # of players in range, then distrubute the divided amount to the near players and the inital hero that did the killing.

I ran a debug trigger as well, it is correclty working as for diving the amount, but it is NOT giving the exp amount to the player or players in range.

Can someone help me with this? What did I do wrong?
 
Level 4
Joined
May 18, 2004
Messages
60
So, neways, I spent hours trying different things and I finally got it to work.

For those interested, here's how I did it:

Code:
Level 1 Sharing Experience and Max
    Events
        Unit - A unit owned by Neutral Hostile Dies
    Conditions
        (Level of (Dying unit)) Equal to 1
    Actions
        If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            If - Conditions
                (((Killing unit) is A Hero) Equal to True) or (((Killing unit) is Summoned) Equal to True)
                (Hero level of (Killing unit)) Less than or equal to 7
            Then - Actions
                Set Sharing_Exp = 0
                Player Group - Remove all players from Sharing_Exp_Players_In_Range
                For each (Integer A) from 1 to 6, do (Actions)
                    Loop - Actions
                        If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                            If - Conditions
                                ((Rect centered at (Position of Players_Current_Hero[(Player number of (Owner of (Killing unit)))]) with size (600.00, 600.00)) contains Players_Current_Hero[(Integer A)]) Equal to True
                            Then - Actions
                                Player Group - Add (Owner of Players_Current_Hero[(Integer A)]) to Sharing_Exp_Players_In_Range
                                Set Sharing_Exp = ((Point-value of (Dying unit)) / (Number of players in Sharing_Exp_Players_In_Range))
                                If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                                    If - Conditions
                                        (Players[(Integer A)] is in Sharing_Exp_Players_In_Range) Equal to True
                                    Then - Actions
                                        Unit Group - Pick every unit in (Units in (Playable map area) owned by Players[(Integer A)]) and do (Actions)
                                            Loop - Actions
                                                Hero - Add Sharing_Exp experience to (Picked unit), Show level-up graphics
                                    Else - Actions
                                        Do nothing
                            Else - Actions
                                Do nothing
            Else - Actions
                Do nothing

That took forever! :p
 
Level 2
Joined
Mar 26, 2004
Messages
7
wouldnt it have been easier to just change the gameplay constants?
Hero Maximum XP Gain Range - (default 1200) change to 600
Hero XP Global Distribution - (default True) change to false

But then again If you want enermy heroes to gain XP from a kill then that trigger is the right way to do it
 
Level 9
Joined
Nov 27, 2004
Messages
465
bestest thing is to make "ready rect" and move it to the position of killing unit

so trigger will be

unit die
____
blablabla
____
if monster is lalalal (or if level of monster is lalal)
then
move "area of level lalala" to the position of killing unit
pick every unit at this position
add exp for picking unit

_____________
^^ That works 100%
 
Status
Not open for further replies.
Top