This system alows you to have control of almost everything related to the bounties (I am surprised that no one else has done this as far as I saw, I mean, I already saw other systems and none does everything that it does, and that I am not an expert and this is the first system that I share).
How to use it:
First use the event "BountyEvent becomes Equal to 2.00" (If you wanna do it in the map initialization) and set the values like this:
Set BountyUnitID = "Unit-type"
Set BountyBase = "Bounty base"
Set BountyDice = "Bounty number of dices"
Set BountySides = "Bounty sides per dice"
Trigger - Run BountySet (ignoring conditions)
Or you can do it in Jass like this
call BOUNTY(<'ID of the unit'>,<Bounty: Base>,<Bounty: Number of dice>,<Bounty: Sides per dice>)
Or in other case the bounty will be 0, and when a unit dies and there is a killing unit it will fire the event:
Game - BountyDeadEvent becomes Equal to 1.00
And with this you can edit the values: "Bounty": The quantity of gold or lumber that you will receive (it can be negative). "BountyTextTag": The texttag that will be displayed (never edit this value). "BountyPermanent": This allows erase it (care, if this value is true and you don't use the texttag later it can be an object leak) "BountyColor": The color of the text (if is not set, the color of the text will have the default values depending of the state). "BountySize": The size of the text. "BountyLifeSpan": The lifetime of the text. "BountyFadePoint": How many seconds the text will fade after the lifespan. "BountySpeed": The speed of the text. "BountyDirection": The direction to the texttag will move. "BountyHeight": How many distance the text will be from the floor. "BountyShow": To show the text or not. "BountyShowNothing": If the Bounty is 0 by default the text is not showed, if you set this to true, the text will be showed even if the bounty is 0. "BountyAllowFriendFire": By default the bounty only will happen if the dying unit is enemy of the killing unit, if you set this to true, the bounty will happen even if they weren't enemies. "BountyEffect": The effect that will be displayed (In the same place of the text) "BountyShowEffect": The effect will be displayed if this value is true. "BountyPlayer": The player how will receive the bounty. "BountyPlayerState": What type of bounty the player will receive (only "gold" and "lumber" are valid). "BountyUnitPos": The position of the text and the effect (If is a unit) "BountyLocPos": The position of the text and the effect (If is a location, this have more priority than BountyUnitPos, and is removed with the clear function to prevent object leak, of course only if "BountyNotClear" is not true, and for this reason don't set it to a variable that you gonna use later) "BountyWhoSee": The players who can see the text (if you change the variable "BountyPlayer", you must remove him from this group before and then add the new player).
And to replace the values "Killing unit" and "Dying unit" you have "BountyKillingUnit" and "BountyDyingUnit" respectively
If you wanna create a bounty with your own event just do:
What you want
What you want
Set Bounty = Your value
Set BountyUnitPos = Your unit
Set BountyPlayer = Your player
Player Group - Add BountyPlayer to BountyWhoSee
Anything else you wanna
Trigger - Run BountyText (ignoring conditions) or in Jass just do "call BountyText()"
If you wanna do some extra edit to the texttag do:
Game - BountyEvent becomes Equal to 1.00
Set LastCreatedTextTag = BountyTextTag
and then do whatever you want with that saved variable.
For more information look the comment section of the system.
To install it go to File>Prefferences>"Create unknow variables automatically while trigger data is pasted" and copy the carpet "Bounty Controller" (there are things those are "optional") and paste it in your map.
Question: Is there a library that saves the data of the texttags?, If not, I will create it.
Another question: If I use the function CreateTextTag() have I edit it inmediatly or it gets deleted or something?
Well, basically the lifespan is not the remaining life of the texttag, is the age it must have to get elimanted, so for that I have to set a lifespan with a big number to the text don't get deleted if I set its permanence to false.
PD: Updated (see the ChangeLog) and Lua version added (thank you @Uncle and @Tasyen).