Snippet Flawless Bounty Imitation FX

Weep

Godspeed to the sound of the pounding
Reaction score
400
Flawless Bounty Imitation FX
by Weep
Version 1.0.1​

FBI? :D 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 = 'z000'
    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, 'Aloc')
        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('OTip', 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('OTip', 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.

--------------------------------------​

All comments welcome.
 

Attachments

  • Bounty FX Demo.w3x
    22 KB · Views: 277

Gtam

Lerning how to write and read!! Yeah.
Reaction score
164
why are you using the local reals in the second code if you only refer to them once?
 

Gtam

Lerning how to write and read!! Yeah.
Reaction score
164
oh sorry didnt see the effect on but why dont you minus 16 for the variables where you declare them?

Edit: the third one is what the changes i suggested must happen if you want to.
 

Weep

Godspeed to the sound of the pounding
Reaction score
400
*insert cursing here* I realized I hadn't tested floating/amphibious units. Gonna need to update for those...
 

Nestharus

o-o
Reaction score
84
This is quite a useful snippet for good looking bounty and I've actually done something very similar to this in a map. The only problem is what happens when the text tag limit has been reached? Crash : (.


You need to do some sort of safety to prevent text tag limit from being reached, otherwise map will crash. On the map I was working on a long time ago, it crashed every single game because of the bounty text tags I had done (1 per killed unit, like norm).

I personally think bounty text tags are a bad idea because of this. If you have safety, then sometimes they won't show (eep). If you don't have safety, then map crash (eep).

I've tried to solve this dilemma, but I've found no way around it ; (.
 

Weep

Godspeed to the sound of the pounding
Reaction score
400
The only problem is what happens when the text tag limit has been reached? Crash : (.
Um, what? It doesn't for me.

I just edited my demo map with over 200 peasants with triggered bounty, and no crash. Since there's a 100 texttag limit, of course, some of the text didn't show, but that also happened when I tried it with native bounty.
 
General chit-chat
Help Users
  • No one is chatting at the moment.
  • Ghan Ghan:
    Still lurking
    +3
  • The Helper The Helper:
    I am great and it is fantastic to see you my friend!
    +1
  • The Helper The Helper:
    If you are new to the site please check out the Recipe and Food Forum https://www.thehelper.net/forums/recipes-and-food.220/
  • Monovertex Monovertex:
    How come you're so into recipes lately? Never saw this much interest in this topic in the old days of TH.net
  • Monovertex Monovertex:
    Hmm, how do I change my signature?
  • tom_mai78101 tom_mai78101:
    Signatures can be edit in your account profile. As for the old stuffs, I'm thinking it's because Blizzard is now under Microsoft, and because of Microsoft Xbox going the way it is, it's dreadful.
  • The Helper The Helper:
    I am not big on the recipes I am just promoting them - I use the site as a practice place promoting stuff
    +2
  • Monovertex Monovertex:
    @tom_mai78101 I must be blind. If I go on my profile I don't see any area to edit the signature; If I go to account details (settings) I don't see any signature area either.
  • The Helper The Helper:
    You can get there if you click the bell icon (alerts) and choose preferences from the bottom, signature will be in the menu on the left there https://www.thehelper.net/account/preferences
  • The Helper The Helper:
    I think I need to split the Sci/Tech news forum into 2 one for Science and one for Tech but I am hating all the moving of posts I would have to do
  • The Helper The Helper:
    What is up Old Mountain Shadow?
  • The Helper The Helper:
    Happy Thursday!
    +1
  • Varine Varine:
    Crazy how much 3d printing has come in the last few years. Sad that it's not as easily modifiable though
  • Varine Varine:
    I bought an Ender 3 during the pandemic and tinkered with it all the time. Just bought a Sovol, not as easy. I'm trying to make it use a different nozzle because I have a fuck ton of Volcanos, and they use what is basically a modified volcano that is just a smidge longer, and almost every part on this thing needs to be redone to make it work
  • Varine Varine:
    Luckily I have a 3d printer for that, I guess. But it's ridiculous. The regular volcanos are 21mm, these Sovol versions are about 23.5mm
  • Varine Varine:
    So, 2.5mm longer. But the thing that measures the bed is about 1.5mm above the nozzle, so if I swap it with a volcano then I'm 1mm behind it. So cool, new bracket to swap that, but THEN the fan shroud to direct air at the part is ALSO going to be .5mm to low, and so I need to redo that, but by doing that it is a little bit off where it should be blowing and it's throwing it at the heating block instead of the part, and fuck man
  • Varine Varine:
    I didn't realize they designed this entire thing to NOT be modded. I would have just got a fucking Bambu if I knew that, the whole point was I could fuck with this. And no one else makes shit for Sovol so I have to go through them, and they have... interesting pricing models. So I have a new extruder altogether that I'm taking apart and going to just design a whole new one to use my nozzles. Dumb design.
  • Varine Varine:
    Can't just buy a new heatblock, you need to get a whole hotend - so block, heater cartridge, thermistor, heatbreak, and nozzle. And they put this fucking paste in there so I can't take the thermistor or cartridge out with any ease, that's 30 dollars. Or you can get the whole extrudor with the direct driver AND that heatblock for like 50, but you still can't get any of it to come apart
  • Varine Varine:
    Partsbuilt has individual parts I found but they're expensive. I think I can get bits swapped around and make this work with generic shit though
  • Ghan Ghan:
    Heard Houston got hit pretty bad by storms last night. Hope all is well with TH.
  • The Helper The Helper:
    Power back on finally - all is good here no damage
    +2
  • V-SNES V-SNES:
    Happy Friday!
    +1
  • The Helper The Helper:
    New recipe is another summer dessert Berry and Peach Cheesecake - https://www.thehelper.net/threads/recipe-berry-and-peach-cheesecake.194169/

      The Helper Discord

      Members online

      No members online now.

      Affiliates

      Hive Workshop NUON Dome World Editor Tutorials

      Network Sponsors

      Apex Steel Pipe - Buys and sells Steel Pipe.
      Top