- Joined
- Aug 27, 2013
- Messages
- 3,973
It's me again. So I've been making a custom bounty system. I want my player to get gold when an enemy dies nearby even if my player's unit isn't the one who killed it but of course with reduced amount. I wanted the system to have floating text just like the default one.
This is what I ended up with. It worked perfectly before I added the floating text but as soon as I added the floating text functions to the trigger, especially GetLocalPlayer, I no longer get gold from my ally's kills.
This is what I ended up with. It worked perfectly before I added the floating text but as soon as I added the floating text functions to the trigger, especially GetLocalPlayer, I no longer get gold from my ally's kills.
-
Bounty System
-
Events
- Unit - A unit Dies
-
Conditions
- ((Triggering unit) is A structure) Equal to False
-
Actions
- Set TempLoc[1] = (Position of (Triggering unit))
- Set BountS_Area = 1000.00
- Set BountS_RandomFactor = (Random integer number between 1 and 15)
- Set BountS_Group = (Units within BountS_Area of TempLoc[1] matching (((Owner of (Matching unit)) Not equal to Neutral Passive) and (((Matching unit) belongs to an enemy of (Triggering player)) Equal to True)))
-
Unit Group - Pick every unit in BountS_Group and do (Actions)
-
Loop - Actions
- Set GetLocalPlayer = (Owner of (Picked unit))
-
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
-
If - Conditions
- (Picked unit) Equal to (Killing unit)
-
Then - Actions
- Set BountS_Final = ((20 x (Level of (Triggering unit))) + BountS_RandomFactor)
- Player - Add BountS_Final to GetLocalPlayer Current gold
- Set BountS_String = <Empty String>
- Custom script: if GetLocalPlayer() == udg_GetLocalPlayer then
- Set BountS_String = (|cffffcc00+ + ((String(BountS_Final)) + |r))
- Custom script: endif
- Floating Text - Create floating text that reads BountS_String at TempLoc[1] with Z offset 0.00, using font size 10.00, color (100.00%, 100.00%, 100.00%), and 0.00% transparency
- Floating Text - Set the velocity of (Last created floating text) to 64.00 towards 90.00 degrees
- Floating Text - Change (Last created floating text): Disable permanence
- Floating Text - Change the lifespan of (Last created floating text) to 2.00 seconds
- Floating Text - Change the fading age of (Last created floating text) to 1.50 seconds
-
Else - Actions
- Set BountS_Final = ((20 x (Level of (Triggering unit))) + BountS_RandomFactor)
- Set BountS_Final = (BountS_Final / (Number of players in BountS_PGroup))
- Player - Add BountS_Final to GetLocalPlayer Current gold
- Set BountS_String = <Empty String>
- Custom script: if GetLocalPlayer() == udg_GetLocalPlayer then
- Set BountS_String = (|cffffcc00+ + ((String(BountS_Final)) + |r))
- Custom script: endif
- Floating Text - Create floating text that reads BountS_String at TempLoc[1] with Z offset 0.00, using font size 10.00, color (100.00%, 100.00%, 100.00%), and 0.00% transparency
- Floating Text - Set the velocity of (Last created floating text) to 64.00 towards 90.00 degrees
- Floating Text - Change (Last created floating text): Disable permanence
- Floating Text - Change the lifespan of (Last created floating text) to 2.00 seconds
- Floating Text - Change the fading age of (Last created floating text) to 1.50 seconds
-
If - Conditions
-
Loop - Actions
- Custom script: call DestroyGroup(udg_BountS_Group)
- Custom script: call RemoveLocation(udg_TempLoc[1])
-
Events
Last edited: