• 🏆 Texturing Contest #33 is OPEN! Contestants must re-texture a SD unit model found in-game (Warcraft 3 Classic), recreating the unit into a peaceful NPC version. 🔗Click here to enter!
  • It's time for the first HD Modeling Contest of 2024. Join the theme discussion for Hive's HD Modeling Contest #6! Click here to post your idea!

[JASS] Texttag that don't appear

Status
Not open for further replies.
Level 4
Joined
Feb 12, 2007
Messages
99
Hello, back on mapmaking I am struck against a very odd bug, here I want to create three sets of units who each have texttag (floating text), it works for the first set (difficulty) but after that the units are correctly created but the texttag don't want to appear no matter what.

From many tests it doesn't seem like the recursive function is at fault nor the limit of texttag (managed to create another using another trigger).
I tried splitting the first set of units and the rest in two triggers too but the second and third set don't work...

I ran out of idea after three hours trying to find the problem and humbly ask if you've any idea to solve this problem ?

JASS:
function CreateDifficultyUnit takes integer i returns nothing
local location l = PolarProjectionBJ(Location(14261, -1452), 400, i*360/7 + 30)
local unit u = CreateUnit(Player(15), udg_ListTypeU[i], GetLocationX(l), GetLocationY(l), 270)
local texttag t = CreateTextTagUnitBJ(udg_ListSTR[i], u, 0, 10, 100, 90-i*10, 90-i*10, 0)
call SetTextTagPermanent(t, false)
call SetTextTagLifespan(t, 30)
if i < 7 then
call CreateDifficultyUnit(i+1)
endif
endfunction

function CreateHeroChoosingUnit takes integer i returns nothing
local location l = PolarProjectionBJ(Location(15200, -6900), 400, i*45 + 30)
local unit u = CreateUnit(Player(15), udg_ListTypeU[i], GetLocationX(l), GetLocationY(l), 270)
local texttag t = CreateTextTagUnitBJ(udg_ListSTR[i], u, 0, 10, 100, 90-i*10, 90-i*10, 0)
call SetTextTagPermanent(t, false)
call SetTextTagLifespan(t, 30)
call PauseUnit(u, true)
if i < 8 then
call CreateHeroChoosingUnit(i+1)
endif
set t = null
set u = null
endfunction

function Trig_CreateSelection_Actions takes nothing returns nothing
local unit u = CreateUnit(Player(15), 'n01P', 14261, -1452, 270)
local texttag t
//A-Create Difficulty units & TextTag
//ListTypeU[1->7] and ListSTR[0->7] are used here
set udg_ListSTR[0] = "God Play - The ultimate Challenge."
set udg_ListTypeU[1] = 'n008'
set udg_ListSTR[1] = "None - No attack, no event (good or bad)"
set udg_ListTypeU[2] = 'n00C'
set udg_ListSTR[2] = "Weak - Dying here is an impossibility"
set udg_ListTypeU[3] = 'n00D'
set udg_ListSTR[3] = "Average - Good difficulty to learn the game"
set udg_ListTypeU[4] = 'n010'
set udg_ListSTR[4] = "Strong - Getting serious."
set udg_ListTypeU[5] = 'n00J'
set udg_ListSTR[5] = "Very Strong - Prepare for full scale assault from early on."
set udg_ListTypeU[6] = 'n00S'
set udg_ListSTR[6] = "Insane - Prepare for constant attacks, Black clan incoming"
set udg_ListTypeU[7] = 'n00O'
set udg_ListSTR[7] = "Undefeatable - Varied, powerful, fast and monstruous assaults."
//ListSTR[8->?] used here
set udg_ListSTR[8] = "Empire : Management, lot of research and large armies."
set udg_ListSTR[9] = "Hero : Sometime, one lone being can change the face of the World."
set t = CreateTextTagUnitBJ(udg_ListSTR[0], u, 0, 10, 100, 10, 10, 0)
call SetTextTagPermanent(t, false)
call SetTextTagLifespan(t, 30)
call CreateDifficultyUnit(1)

//B-Create Units to choice empire or hero
set u = CreateUnit(Player(15), 'o000', 9090, -5640, 270)
call CreateTextTagUnitBJ( udg_ListSTR[8], u, 0, 1000, 100, 100, 100, 0)
call SetTextTagPermanent(t, false)
call SetTextTagLifespan(t, 30)

set u = CreateUnit(Player(15), 'h00X', 9350, -5640, 270)
set t = CreateTextTagLocBJ(udg_ListSTR[9], Location(9350, -5640), 0, 10, 50, 50, 80, 0)
call SetTextTagPermanent(t, false)
call SetTextTagLifespan(t, 30)

//  Set ListTypeU[1->7] to ID of heroes units
set udg_ListTypeU[1] = 'H000'
set udg_ListSTR[1] = "Berserk :Melee offensive class whole sole objective is to damage the opponent"
    set udg_ListTypeU[2] = 'H02U'
    set udg_ListSTR[2] = "Monk :Melee defensive(?) class who adore the goddess Pandobeer(Fun garanted)."
    set udg_ListTypeU[3] = 'H00T'
    set udg_ListSTR[3] = "Hunter :Ranged class adept of hit-and-run as well as traps."
    set udg_ListTypeU[4] = 'H00T'
    set udg_ListSTR[4] = "Dark Ranger :Ranged powerful hybrid class able to summon as well as damage and drain life,has however long cooldown and high mana cost."
    set udg_ListTypeU[5] = 'H02G'
    set udg_ListSTR[5] = "Necromancer :Int short-ranged hero able to summon powerful creatures to do his bidding,able to use very high damage spell... for a price..."
    set udg_ListTypeU[6] = 'H02U'
    set udg_ListSTR[6] = "Knight :->Semi-Tank with lot of buffs and heal, very hard to kill but still have some deadly ability.->Hybrid class needing a good repartition of stats, afraid of dispel.->Good at everything, bad in nothing, excel in nothing. "
    set udg_ListTypeU[7] = 'H01Q'
    set udg_ListSTR[7] = "Assassin :good for movement and instantkill, highest physical dps,start with a HIGH malus armor."
    set udg_ListTypeU[8] = 'H02H'
    set udg_ListSTR[8] = "Magician :Has large array of spells with varied effects, high damage.Bad with withstanding attacks once his mana is down."
    
call CreateHeroChoosingUnit(1)

set u = null
set t = null
endfunction

//===========================================================================
function InitTrig_CreateSelection takes nothing returns nothing
    set gg_trg_CreateSelection = CreateTrigger(  )
    call TriggerRegisterTimerEventSingle( gg_trg_CreateSelection, 1.00 )
    call TriggerAddAction( gg_trg_CreateSelection, function Trig_CreateSelection_Actions )
endfunction
 
Level 28
Joined
Jan 26, 2007
Messages
4,789
I advice you to remove all locations, you don't need 'em (also, PolarProjection is a pretty bad function :S).
The TextTag-function you use is also a heavy BJ (the function calls 3 function which - on their turn - call other functions, one of those functions calls another function).
It's just extremely inefficient...
But that shouldn't cause the problem :p

You also don't remove the locations O_O (leaks).

I want you to try this:

JASS:
local texttag tt = CreateTextTag()

call SetTextTagPosUnit(tt, u, 0.)
call SetTextTagText(tt, udg_ListSTR[i], 0.023) // The size = 0.0023 * (size), which becomes 0.023 here.
call SetTextTagColor(tt, 255, 230-(25*i). 230-(25*i), 0) // I hope I put enough brackets here... the integers are the actual color codes (ranging from 0 to 255).
call SetTextTagPermanent(tt, false)
call SetTextTagLifespan(tt, 30.)

Yes, it does look longer, but in truth it isn't (since your script calls a lot more functions).
 
Level 4
Joined
Feb 12, 2007
Messages
99
Tried to change a few things here and here, used GetHandleId which say that texttag are indeed created, however now none appear anymore.

Then I decided to reduce the trigger to it's simplest expression with only the first texttag, and I even removed the leaks removers just in case but even then the texttag still doesn't appear...
*Completely out of idea*

JASS:
function Trig_CreateSelection_Actions takes nothing returns nothing
local unit u = CreateUnit(Player(15), 'n01P', 14261, -1452, 270)
local texttag t = CreateTextTag()
local integer i = 1
local location l
//A-Create Difficulty units & TextTag
//ListTypeU[1->7] and ListSTR[0->7] are used here
set udg_ListSTR[0] = "God Play - The ultimate Challenge."
set udg_ListTypeU[1] = 'n008'
set udg_ListSTR[1] = "None - No attack, no event (good or bad)"
set udg_ListTypeU[2] = 'n00C'
set udg_ListSTR[2] = "Weak - Dying here is an impossibility"
set udg_ListTypeU[3] = 'n00D'
set udg_ListSTR[3] = "Average - Good difficulty to learn the game"
set udg_ListTypeU[4] = 'n010'
set udg_ListSTR[4] = "Strong - Getting serious."
set udg_ListTypeU[5] = 'n00J'
set udg_ListSTR[5] = "Very Strong - Prepare for full scale assault from early on."
set udg_ListTypeU[6] = 'n00S'
set udg_ListSTR[6] = "Insane - Prepare for constant attacks, Black clan incoming"
set udg_ListTypeU[7] = 'n00O'
set udg_ListSTR[7] = "Undefeatable - Varied, powerful, fast and monstruous assaults."
set udg_ListSTR[8] = "Empire : Management, lot of research and large armies."
set udg_ListSTR[9] = "Hero : Sometime, one lone being can change the face of the World."
call SetTextTagPosUnit(t, u, 0.)
call SetTextTagText(t, udg_ListSTR[0], 50.523) // The size = 0.0023 * (size), which becomes 0.023 here.
call SetTextTagColor(t, 255, 75, 75, 0) //the integers are the actual color codes (ranging from 0 to 255).
call SetTextTagPermanent(t, false)
call SetTextTagLifespan(t, 30.)
call DisplayTextToPlayer(Player(0), 0, 0, I2S(GetHandleId(t)))



set i = 0
endfunction

//===========================================================================
function InitTrig_CreateSelection takes nothing returns nothing
    set gg_trg_CreateSelection = CreateTrigger(  )
    call TriggerRegisterTimerEventSingle( gg_trg_CreateSelection, 1.00 )
    call TriggerAddAction( gg_trg_CreateSelection, function Trig_CreateSelection_Actions )
endfunction
 
Level 37
Joined
Mar 6, 2006
Messages
9,240
JASS:
call SetTextTagText(t, udg_ListSTR[0], 50.523)

I'm quite sure the size should be a lot smaller, try the 0.03-0.05 range for starters.

If you use this, the size is 10.0
  • Floating Text - Create floating text that reads ghklkl above (Leaving unit) with Z offset 0.00, using font size 10.00, color (100.00%, 100.00%, 100.00%), and 0.00% transparency
it will translate to 0.023 in the end due to this:
JASS:
function TextTagSize2Height takes real size returns real
    return size * 0.023 / 10
endfunction
 
Level 13
Joined
Jul 26, 2008
Messages
1,009
JASS:
        call SetTextTagText(tag, str, 0.024)
        call SetTextTagPos(tag, GetUnitX(u), GetUnitY(u), 0.00)
        call SetTextTagColor(tag, 255, 255, 255, 255)
        call SetTextTagVisibility(tag, true)
        call SetTextTagFadepoint(tag, 2)
        call SetTextTagLifespan(tag, 3)
        call SetTextTagPermanent(tag, false)

Is an example of a typical texttag setup. Maker is correct, you are placing a rather large number where it should be much smaller.
 
Level 4
Joined
Feb 12, 2007
Messages
99
@Maker : the size was actually for test, I tried multiple value trying to pinpoint where was the problem.

@Titanhex : I still don't know what was the problem but I used your setup for my texttag and now all work nicely. +rep ^^
 
Status
Not open for further replies.
Top