Weep
Godspeed to the sound of the pounding
- Reaction score
- 400
Flawless Bounty Imitation FX
by Weep
Version 1.0.1
by Weep
Version 1.0.1
FBI? Yes, the name is for laughs.
-- General Information --
These snippets create effects as close to matching the in-game gold bounty FX and text as I know to be possible. There are three levels of complexity, trading off with decreasing generality of which kinds of units are properly handled.The demo map demonstrates all 3 snippets on all the various kinds of units, showing the differences (snippet FX on the blue player's units on the left half, true WC3 bounty on the neutral hostile units on the right half).
-- Full FX --
Requires one dummy unit-type ([ljass]'z000'[/ljass] in the demo map). Almost exactly matches any kind of unit, be it ground, floating, or flying, even at cliffs and over trees. The use of a dummy unit is required to get an accurate height of a flying unit over any terrain (GetUnitFlyHeight is not accurate).- Code -
JASS:
function GoldBountyFXFull takes unit u, integer gold, player p returns nothing
local integer FLYING_GOLD_UNITTYPE = 039;z000039;
local texttag t = CreateTextTag()
local real ux = GetUnitX(u)
local real uy = GetUnitY(u)
local real uz = GetUnitFlyHeight(u)
local destructable d
local unit f
if(IsUnitType(u, UNIT_TYPE_FLYING)) then
set f = CreateUnit(Player(15), FLYING_GOLD_UNITTYPE, ux, uy, 0)
call SetUnitScale(f, 1, 1, 1)
call SetUnitFlyHeight(f, uz, 0)
call UnitAddAbility(f, 039;Aloc039;)
call SetTextTagText(t, "+" + I2S(gold), 0.023)
call SetTextTagPosUnit(t, f, -13)
call KillUnit(f)
else
call SetTextTagText(t, "+" + I2S(gold), 0.024)
call SetTextTagPos(t, ux-16, uy-16, uz)
set d = CreateDestructableZ(039;OTip039;, ux-16, uy-16, uz, 0.00, 1, 0) //http://wc3jass.com/viewtopic.php?t=2472
call DestroyEffect(AddSpecialEffect("UI\\Feedback\\GoldCredit\\GoldCredit.mdl", ux-16, uy-16))
call RemoveDestructable(d)
endif
call SetTextTagColor(t, 255, 220, 0, 255)
call SetTextTagVelocity(t, 0, 0.03)
call SetTextTagVisibility(t, GetLocalPlayer() == p)
call SetTextTagFadepoint(t, 2)
call SetTextTagLifespan(t, 3)
call SetTextTagPermanent(t, false)
set t = null
set f = null
set d = null
endfunction
-- Ground FX --
Requires no unit-type and does not create any units, and will accurately match hovering units with height, but will only approximate the height of flying units over varied terrain. Still creates a temporary platform destructable to create the special effect at a particular height.- Code -
JASS:
function GoldBountyFXGround takes unit u, integer gold, player p returns nothing
local texttag t = CreateTextTag()
local real ux = GetUnitX(u)
local real uy = GetUnitY(u)
local real uz = GetUnitFlyHeight(u)
local destructable d
if(IsUnitType(u, UNIT_TYPE_FLYING)) then
call SetTextTagText(t, "+" + I2S(gold), 0.023)
call SetTextTagPos(t, ux, uy, uz)
else
call SetTextTagText(t, "+" + I2S(gold), 0.024)
call SetTextTagPos(t, ux-16, uy-16, uz)
endif
set d = CreateDestructableZ(039;OTip039;, ux-16, uy-16, uz, 0.00, 1, 0) //http://wc3jass.com/viewtopic.php?t=2472
call DestroyEffect(AddSpecialEffect("UI\\Feedback\\GoldCredit\\GoldCredit.mdl", ux-16, uy-16))
call RemoveDestructable(d)
call SetTextTagColor(t, 255, 220, 0, 255)
call SetTextTagVelocity(t, 0, 0.03)
call SetTextTagVisibility(t, GetLocalPlayer() == p)
call SetTextTagFadepoint(t, 2)
call SetTextTagLifespan(t, 3)
call SetTextTagPermanent(t, false)
set t = null
set d = null
endfunction
-- Strict Ground FX --
Requires no unit-type and does not create any units nor destructables, but will only be accurate for ground units with no flying height (eg. not for the default hovering units).- Code -
JASS:
function GoldBountyFXStrictGround takes unit u, integer gold, player p returns nothing
local texttag t = CreateTextTag()
local real ux = GetUnitX(u)-16
local real uy = GetUnitY(u)-16
call SetTextTagText(t, "+" + I2S(gold), 0.024)
call SetTextTagPos(t, ux, uy, GetUnitFlyHeight(u)) //Meh.
call DestroyEffect(AddSpecialEffect("UI\\Feedback\\GoldCredit\\GoldCredit.mdl", ux, uy))
call SetTextTagColor(t, 255, 220, 0, 255)
call SetTextTagVelocity(t, 0, 0.03)
call SetTextTagVisibility(t, GetLocalPlayer() == p)
call SetTextTagFadepoint(t, 2)
call SetTextTagLifespan(t, 3)
call SetTextTagPermanent(t, false)
set t = null
endfunction
-- Notes --
It's originally based off of the bounty text found in Cohadar's Pyramidal Sandbox map, but significantly tweaked from there to better match WC3's look.I've not vJASS-ified it nor ObjectMerger'd the dummy unit due to lack of access to the necessary programs to test the results. If someone would care to do so, I'll gladly add it to the post and give credit.
This uses arrays, so can have a maximum of 8190 instances at a time, and cleans up data at a rate of 33.33 per second. This should be enough for most maps.
-- Credits --
Cohadar for the original bounty text code.KaTTaNa for the method to create a special effect at a specified height, without using a unit.
Credit in your map not needed.
-- Version History --
1.0.1: Minor optimization.
1.0.0: First release.
1.0.0: First release.
--------------------------------------
All comments welcome.