Floating Text not working

rafaxik

New Member
Reaction score
2
I got a Damage Detect System that's working, but some strange reason the following triggers is driving me crazy:

This trigger works:
Trigger:
  • Floating Text - Create floating text that reads (((((Name of GDD_DamageSource) + damaged ) + (Name of GDD_DamagedUnit)) + ( for + ((String(GDD_Damage)) + damage.))) + ) above GDD_DamageSource with Z offset 0.00, using font size 10.00, color (100.00%, 0.00%, 0.00%), and 0.00% transparency

This trigger DOES NOT work... why?:
Trigger:
  • Floating Text - Create floating text that reads ((String(GDD_Damage)) + !) above GDD_DamageSource with Z offset 0.00, using font size 10.00, color (100.00%, 0.00%, 0.00%), and 0.00% transparency

EDIT: There's a Damage Detection System:
1 -
Trigger:
  • GDD Variable Creator
    • Events
    • Conditions
    • Actions
      • Set GDD_Damage = 0.00
      • Set GDD_Event = 0.00
      • Set GDD_DamagedUnit = No unit
      • Set GDD_DamageSource = No unit
      • Set GDD__Integers[0] = 0
      • Set GDD__TriggerArray[0] = (This trigger)
      • Set GDD__UnitArray[0] = No unit
      • Set GDD__LeftMapGroup = GDD__LeftMapGroup
2 - (JASS)
JASS:
//*********************************************************************************************
//* GUI-Friendly Damage Detection -- v1.2.0 -- by Weep                                        *
//*    <a href="http://www.thehelper.net/forums/showthread.php?t=137957" class="link link--internal">http://www.thehelper.net/forums/showthread.php?t=137957</a>                                *
//*                                                                                           *
//*    Requires: only this trigger and its variables.                                         *
//*                                                                                           *
//* -- What? --                                                                               *
//*    This snippet provides a leak-free, GUI-friendly implementation of an &quot;any unit takes   *
//*    damage&quot; event.  It requires no JASS knowledge to use.                                  *
//*                                                                                           *
//*    It uses the Game - Value Of Real Variable event as its method of activating other      *
//*    triggers, and passes the event responses through a few globals.                        *
//*                                                                                           *
//* -- Why? --                                                                                *
//*    The traditional GUI method of setting up a trigger than runs when any unit is damaged  *
//*    leaks trigger events.  This snippet is easy to implement and removes the need to do    *
//*    you own GUI damage detection setup.                                                    *
//*                                                                                           *
//* -- How To Implement --                                                                    *
//*    0. Before you copy triggers that use GDD into a new map, you need to copy over GDD     *
//*       with its GDD Variable Creator trigger, or the variables won&#039;t be automatically      *
//*       created correctly.                                                                  *
//*                                                                                           *
//*    1. Be sure &quot;Automatically create unknown variables while pasting trigger data&quot; is      *
//*       enabled in the World Editor general preferences.                                    *
//*    2. Copy this trigger category (&quot;GDD&quot;) and paste it into your map.                      *
//*       (Alternately: create the variables listed in the globals block below, create a      *
//*       trigger named &quot;GUI Friendly Damage Detection&quot;, and paste in this entire text.)      *
//*    3. Create your damage triggers using Game - Value Of Real Variable as the event,       *
//*       select GDD_Event as the variable, and leave the rest of the settings to the default *
//*       &quot;becomes Equal to 0.00&quot;.                                                            *
//*       The event responses are the following variables:                                    *
//*          GDD_Damage is the amount of damage, replacing Event Response - Damage Taken.     *
//*          GDD_DamagedUnit is the damaged unit, replacing Event Response - Triggering Unit. *
//*          GDD_DamageSource is the damaging unit, replacing Event Response - Damage Source. *
//*                                                                                           *
//* -- Notes --                                                                               *
//*    Don&#039;t write any values to the variables used as the event responses, or it will mess   *
//*    up any other triggers using this snippet for their triggering.  Only use their values. *
//*                                                                                           *
//*    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 --                                                                             *
//*    Captain Griffin on wc3c.net for the research and concept of GroupRefresh.              *
//*                                                                                           *
//*    Credit in your map not needed, but please include this README.                         *
//*                                                                                           *
//* -- Version History --                                                                     *
//*    1.2.0: Made this snippet work properly with recursive damage.                          *
//*    1.1.1: Added a check in order to not index units with the Locust ability (dummy units).*
//*           If you wish to check for damage taken by a unit that is unselectable, do not    *
//*           give the unit-type Locust in the object editor; instead, add the Locust ability *
//*           &#039;Aloc&#039; via a trigger after its creation, then remove it.                        *
//*    1.1.0: Added a check in case a unit gets moved out of the map and back.                *
//*    1.0.0: First release.                                                                  *
//*                                                                                           *
//*********************************************************************************************

//globals
//    real udg_GDD_Event
//    real udg_GDD_Damage
//    unit udg_GDD_DamagedUnit
//    unit udg_GDD_DamageSource
//    trigger array udg_GDD__TriggerArray
//    integer array udg_GDD__Integers
//    unit array udg_GDD__UnitArray
//    group udg_GDD__LeftMapGroup
//endglobals

function GDD_Event takes nothing returns boolean
    local unit damagedcache = udg_GDD_DamagedUnit
    local unit damagingcache = udg_GDD_DamageSource
    local real damagecache = udg_GDD_Damage
    set udg_GDD_DamagedUnit = GetTriggerUnit()
    set udg_GDD_DamageSource = GetEventDamageSource()
    set udg_GDD_Damage = GetEventDamage()
    set udg_GDD_Event = 1.
    set udg_GDD_Event = 0.
    set udg_GDD_DamagedUnit = damagedcache
    set udg_GDD_DamageSource = damagingcache
    set udg_GDD_Damage = damagecache
    set damagedcache = null
    set damagingcache = null
    return false
endfunction

function GDD_AddDetection takes nothing returns boolean
//    if(udg_GDD__Integers[0] &gt; 8190) then
//        call BJDebugMsg(&quot;GDD: Too many damage events!  Decrease number of units present in the map or increase recycle rate.&quot;)
//        ***Recycle rate is the number used in the TimerStart line at the bottom of this trigger.  Smaller is faster.***
//        return
//    endif
    if(IsUnitInGroup(GetFilterUnit(), udg_GDD__LeftMapGroup)) then
        call GroupRemoveUnit(udg_GDD__LeftMapGroup, GetFilterUnit())
    else
        if(GetUnitAbilityLevel(GetFilterUnit(), &#039;Aloc&#039;) == 0) then
            set udg_GDD__Integers[0] = udg_GDD__Integers[0]+1
            set udg_GDD__UnitArray[udg_GDD__Integers[0]] = GetFilterUnit()
            set udg_GDD__TriggerArray[udg_GDD__Integers[0]] = CreateTrigger()
            call TriggerRegisterUnitEvent(udg_GDD__TriggerArray[udg_GDD__Integers[0]], udg_GDD__UnitArray[udg_GDD__Integers[0]], EVENT_UNIT_DAMAGED)
            call TriggerAddCondition(udg_GDD__TriggerArray[udg_GDD__Integers[0]], Condition(function GDD_Event))
        endif
    endif
    return false
endfunction

function GDD_PresetDetection takes nothing returns nothing
    local group g = CreateGroup()
    local integer i = 0
    set i = 0
    loop
        call GroupEnumUnitsOfPlayer(g, Player(i), Condition(function GDD_AddDetection))
        call GroupClear(g)
        set i = i+1
        exitwhen i == bj_MAX_PLAYER_SLOTS
    endloop
    call DestroyGroup(g)
    set g = null
endfunction

function GDD_GroupRefresh takes nothing returns nothing
//Based on GroupRefresh by Captain Griffen on wc3c.net
    if (bj_slotControlUsed[5063] == true) then
        call GroupClear(udg_GDD__LeftMapGroup)
        set bj_slotControlUsed[5063] = false
    endif
    call GroupAddUnit(udg_GDD__LeftMapGroup, GetEnumUnit())
endfunction

function GDD_Recycle takes nothing returns nothing
    if(udg_GDD__Integers[0] &lt;= 0) then
        return
    elseif(udg_GDD__Integers[1] &lt;= 0) then
        set udg_GDD__Integers[1] = udg_GDD__Integers[0]
    endif
    if(GetUnitTypeId(udg_GDD__UnitArray[udg_GDD__Integers[1]]) == 0) then
        call DestroyTrigger(udg_GDD__TriggerArray[udg_GDD__Integers[1]])
        set udg_GDD__TriggerArray[udg_GDD__Integers[1]] = null
        set udg_GDD__TriggerArray[udg_GDD__Integers[1]] = udg_GDD__TriggerArray[udg_GDD__Integers[0]]
        set udg_GDD__UnitArray[udg_GDD__Integers[1]] = udg_GDD__UnitArray[udg_GDD__Integers[0]]
        set udg_GDD__UnitArray[udg_GDD__Integers[0]] = null
        set udg_GDD__Integers[0] = udg_GDD__Integers[0]-1
    endif
    set udg_GDD__Integers[1] = udg_GDD__Integers[1]-1
endfunction

function GDD_LeaveMap takes nothing returns boolean
    local boolean cached = bj_slotControlUsed[5063]
    if(udg_GDD__Integers[2] &lt; 64) then
        set udg_GDD__Integers[2] = udg_GDD__Integers[2]+1
    else
        set bj_slotControlUsed[5063] = true
        call ForGroup(udg_GDD__LeftMapGroup, function GDD_GroupRefresh)
        set udg_GDD__Integers[2] = 0
    endif
    call GroupAddUnit(udg_GDD__LeftMapGroup, GetFilterUnit())
    set bj_slotControlUsed[5063] = cached
    return false
endfunction

//===========================================================================
function InitTrig_GUI_Friendly_Damage_Detection takes nothing returns nothing
    local region r = CreateRegion()
    call RegionAddRect(r, GetWorldBounds())
    call TriggerRegisterEnterRegion(CreateTrigger(), r, Condition(function GDD_AddDetection))
    call TriggerRegisterLeaveRegion(CreateTrigger(), r, Condition(function GDD_LeaveMap))
    call GDD_PresetDetection()
    call TimerStart(CreateTimer(), 0.03, true, function GDD_Recycle)
    set r = null
endfunction
Trigger:
  • Critical Strike
    • Events
      • Game - GDD_Damage becomes Equal to 0.00
    • Conditions
    • Actions
      • Floating Text - Create floating text that reads ((String(GDD_Damage)) + !) above GDD_DamageSource with Z offset 0.00, using font size 10.00, color (100.00%, 0.00%, 0.00%), and 0.00% transparency
      • Set CritText = (Last created floating text)
      • Floating Text - Show CritText for (All players)
      • Floating Text - Set the velocity of CritText to 30.00 towards 90.00 degrees
      • Floating Text - Change the fading age of CritText to 1.00 seconds
      • Wait 1.50 seconds
      • Floating Text - Destroy CritText
There's a chat message that works:
Trigger:
  • Display Damage
    • Events
      • Game - GDD_Event becomes Equal to 0.00
    • Conditions
    • Actions
      • Game - Display to (All players) for 1.00 seconds the text: ((((Name of GDD_DamageSource) + damaged ) + (Name of GDD_DamagedUnit)) + ( for + ((String(GDD_Damage)) + damage.)))
      • Floating Text - Create floating text that reads (((((Name of GDD_DamageSource) + damaged ) + (Name of GDD_DamagedUnit)) + ( for + ((String(GDD_Damage)) + damage.))) + ) above GDD_DamageSource with Z offset 0.00, using font size 10.00, color (100.00%, 0.00%, 0.00%), and 0.00% transparency
If someone knows something different to critical strike (not the object editor's ability), please tell me.
 

Tawnttoo

New Member
Reaction score
36
Your problem is the event in 'Critical Strike' trigger. It's supposed to be 'GDD_Event Becomes Equal to 0.00' instead of 'GDD_Damage'. Just as it reads in 'Display Damage' trigger.
 

rafaxik

New Member
Reaction score
2
Your problem is the event in 'Critical Strike' trigger. It's supposed to be 'GDD_Event Becomes Equal to 0.00' instead of 'GDD_Damage'. Just as it reads in 'Display Damage' trigger.

Jeez! How couldn't I notice that?!
Thanks a lot, problem solved. +rep
 
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

      Staff online

      Members online

      Affiliates

      Hive Workshop NUON Dome World Editor Tutorials

      Network Sponsors

      Apex Steel Pipe - Buys and sells Steel Pipe.
      Top