TextTag not showing up?

Carl-Fredrik

New Member
Reaction score
51
Hi everyone...
In my map there are a couple of explosive barrels, so I added damage through these in a trigger. I also want it to display "Boom!" at the exploding point, but nothing is displayed at all :(

JASS:
scope ExplosiveBarrel initializer EBInit

globals
    private group DAMAGEGROUP = CreateGroup()
    private destructable d
endglobals

private function Actions2 takes nothing returns boolean
    local texttag t 
    call CreateTextTagLocBJ("Boom!", GetDestructableLoc(d), 0, 20, 100, 50, 50, 0)
    set t = bj_lastCreatedTextTag
    call SetUnitLifePercentBJ(GetFilterUnit(),5.00)
    call DisplayTimedTextToForce( GetForceOfPlayer(GetOwningPlayer(GetFilterUnit())), 10.00, "It's an EXPLOSIVE barrel! What did you expect!?")
    call SetTextTagPermanent( t, false )
    call SetTextTagFadepoint( t, 3.00 )
    call SetTextTagAge(t, 3.00)
    call SetTextTagLifespan( t, 3.00 )
    set t = null
    return false
endfunction

function Destructables takes nothing returns nothing
    call KillDestructable( GetEnumDestructable() )
endfunction

private function Actions takes nothing returns nothing
    set d = GetDyingDestructable()
    call EnumDestructablesInCircleBJ( 300.00, GetDestructableLoc(d), function Destructables )
    call GroupEnumUnitsInRange(DAMAGEGROUP, GetDestructableX(d), GetDestructableY(d), 300.00, Filter(function Actions2))
    call GroupClear(DAMAGEGROUP)
endfunction

private function EBInit takes nothing returns nothing
    local trigger t = CreateTrigger(  )
    call TriggerRegisterDeathEvent( t, gg_dest_LTex_0985 )
    call TriggerRegisterDeathEvent( t, gg_dest_LTex_0984 )
    call TriggerRegisterDeathEvent( t, gg_dest_LTex_0983 )
    call TriggerRegisterDeathEvent( t, gg_dest_LTex_0986 )
    call TriggerAddAction( t, function Actions )
endfunction
endscope



Anybody knows why? :/
Thanks in advance!

// Carl-Fredrik

Edit: Also any optimization of the code is always appreciated.
Edit2: I found that the variable "d" is the problem.. how come it works in one of the functions but not the other? :S
 

Carl-Fredrik

New Member
Reaction score
51
I tried adding "CreateTextTag()" after but it didn't work :/

I don't have any idea if I need to set the velocity to be honest... let's make it show up before we worry about that stuff :p

Edit: I found that the variable "d" is the problem.. how come it works in one of the functions but not the other? :S
 

Artificial

Without Intelligence
Reaction score
326
JASS:
call SetTextTagAge(t, 3.00)
call SetTextTagLifespan( t, 3.00 )

The first line is making the text tag's age 3. The second one is making it die (aka. be removed) when its age becomes 3. Surprise surprise - it's age already is 3 (you just set it to 3), thus it's removed. You might wanna try removing the first line. ^_^
 

Tyrulan

Ultra Cool Member
Reaction score
37
@Whelp: True, wasn't thinking. And yeah, GetLastCreatedTextTag() returns bj_lastCreatedTextTag. My bad. ^^
 

Builder Bob

Live free or don't
Reaction score
249
Artificial has pointed out the text tag problem for you.

Another thing though.

JASS:
private function Actions takes nothing returns nothing
    set d = GetDyingDestructable()
    call EnumDestructablesInCircleBJ( 300.00, GetDestructableLoc(d), function Destructables )
    call GroupEnumUnitsInRange(DAMAGEGROUP, GetDestructableX(d), GetDestructableY(d), 300.00, Filter(function Actions2))
    call GroupClear(DAMAGEGROUP)
endfunction


If you want to use a global like that, you will need to refresh it after destroying every destructable in a circle. This is because a lot of new death events will trigger and overwrite the global d. When every death event has been triggered, they will all move on to damaging units in range, starting with the last triggered death event moving backwards to the first. The variable d will remain the last exploding barrel for every single barrel exploding in that chain reaction.

This will preserve the correct destructable and pass it on to the enumerating functions correctly.
JASS:
private function Actions takes nothing returns nothing
    local destructable whichDest = GetDyingDestructable()
    set d = whichDest 
    call EnumDestructablesInCircleBJ( 300.00, GetDestructableLoc(d), function Destructables )
    set d = whichDest 
    call GroupEnumUnitsInRange(DAMAGEGROUP, GetDestructableX(d), GetDestructableY(d), 300.00, Filter(function Actions2))
    call GroupClear(DAMAGEGROUP)
endfunction
 
General chit-chat
Help Users

      The Helper Discord

      Staff online

      Members online

      Affiliates

      Hive Workshop NUON Dome World Editor Tutorials

      Network Sponsors

      Apex Steel Pipe - Buys and sells Steel Pipe.
      Top