Warcraft III resources & community, 2003–2006 · archived

BountyFromUnit()

not rated
Submitted by N-a-z-g-u-lFunctions0 downloads
BountyFromUnit(Receiver, BountyFrom, Bounty) gives < Bounty > gold to < Receiver > and shows effects and bounty message on < BountyFrom >

Source

function BountyFromUnit takes player Receiver, unit BountyFrom, integer Bounty returns nothing
	local texttag BountyText = CreateTextTag(  )
	call AdjustPlayerStateBJ( Bounty, Receiver, PLAYER_STATE_RESOURCE_GOLD )
	if Bounty >= 0 then
		call SetTextTagText(BountyText, "+" + I2S(Bounty), 0.023)
	else
		call SetTextTagText(BountyText, I2S(Bounty), 0.023)
	endif
	call SetTextTagPos(BountyText, GetUnitX(BountyFrom), GetUnitY(BountyFrom), GetUnitFlyHeight(BountyFrom))
	call SetTextTagColor(BountyText, 254, 211, 18, 255)
	call SetTextTagVisibility(BountyText, GetLocalPlayer() == Receiver)
	call SetTextTagVelocity(BountyText, 0, 0.03)
	call SetTextTagFadepoint(BountyText, 2 )
	call SetTextTagLifespan(BountyText, 3 )
	call SetTextTagPermanent(BountyText, false )
	call DestroyEffect(AddSpecialEffectTarget("UI\\Feedback\\GoldCredit\\GoldCredit.mdl", BountyFrom, "origin"))
	set BountyText = null
endfunction

Comments

5
No no, i didn't mean that you've stolen it, i just noticed that there is a similar one, and i thought you didn't know that. It's ok, and i see the advantages of yours!
yes, that works, too, but there are some advantages of my script:

- the effect is displayed to all players, as the normal bounty is, too.
- you can give the function a unit and do not have to give it coordinates.
- text and effect are on the height of the unit, which is, i think, the most important point.

or do you mean its stolen? then think about why i have different color values (i use #fed312), and also the text size is different... i cant explain why. i found my values trying it out (added custom bounty to all units, which had normal bounty, and tried to let the floating texts be exactly over each other)
What about this:
http://www.wc3jass.com/viewtopic.php?t=101
its not that ugly as you may think... it adds for example the player stats, too. Well, there something could be changed, but I thought it was okay.
AdjustPlayerStateBJ is ugly :P