• Check out the results of the Techtree Contest #19!
  • Listen to a special audio message from Bill Roper to the Hive Workshop community (Bill is a former Vice President of Blizzard Entertainment, Producer, Designer, Musician, Voice Actor) 🔗Click here to hear his message!
  • Read Evilhog's interview with Gregory Alper, the original composer of the music for WarCraft: Orcs & Humans 🔗Click here to read the full interview.
  • Create a void inspired texture for Warcraft 3 and enter Hive's 34th Texturing Contest: Void! Click here to enter!
  • The Hive's 22nd Icon Contest: Creep Abilities is now concluded, time to vote for your favourite set of icons! Click here to vote!

local var is behaving like global...

Status
Not open for further replies.
Level 9
Joined
Aug 21, 2008
Messages
533
i have a prob with my texttags: at first, they behaving normally. Everytime a unit is damaged by this trigger, there is created a new texttag. But after soem time, suddenly instead of creating a new textag, a old one is changed.

This actually means, that a existing one is removed, and a new one, with the life span and visibly , is created.
So... just like i used a global instead of a local :ugly:


JASS:
function PhysicalDamage takes unit attacker, unit target , real dmg,boolean crit returns nothing

    local real armor    =   LoadReal(udg_HashTable, GetHandleId(target), StringHash("armor"))
    local real armor2   =   armor*0.7
    local texttag text  =   CreateTextTag()
    local texttag text2 =   CreateTextTag()
    
    //armor
    if armor>dmg then
        set dmg=dmg*0.3
    else
        set dmg=dmg-armor2
    endif
    
    //dmg
    call UnitDamageTarget(attacker,target,dmg,true,false,ATTACK_TYPE_MELEE, DAMAGE_TYPE_NORMAL,WEAPON_TYPE_WHOKNOWS)
    

    //text
    if crit==true then
        call SetTextTagText(text, I2S(R2I(dmg))+"!", 12* 0.023 / 10)
        call SetTextTagColor(text, 255, 0, 0, 0)
    else
        call SetTextTagText(text, I2S(R2I(dmg)), 8* 0.023 / 10)
        call SetTextTagColor(text, 255, 255, 255, 0)
    endif
    call SetTextTagPos(text, GetUnitX(target)+GetRandomReal(-25,25), GetUnitY(target)+GetRandomReal(-25,25), 50)
    call SetTextTagPermanent(text, false)
    call SetTextTagVelocity(text, 0, 0.04)
    call SetTextTagVisibility(text, true)
    call SetTextTagLifespan(text, 3)
    call SetTextTagFadepoint(text, 0.01)
    set text=null
endfucntion
 
i need text 2 for something different =/ I just delede everything trigger which may cause Problem and tested it again, i just forget to delete the var.

any way to extend the limit? or how im able to kill textags? I thought the lifespann kill it =/

no endfunction? well a c&p mistake =) its there, i just forget to copy it...
 
ok-it need exactly 100 hits

i found other function which was always creating atexttag too. But it only set a lifespan, when the attack failed.
So i thought it may be the bug

i created 20 textags in the function instead of 1 and, what a surprise, now i only need 6 attacks to create the bug.

changed the fucntion to only create the texttag, when its also destroying it. Hopefully it works now =/

edit: WORKS! WORKS!
now after this stupid bug is gone, i am able to continue =)
 
The typical handle (widgets, timers, rects) allocate a special handle ID that is unique to that handle.

Text-tags implement a different (perhaps better, except for the limit) method of creating IDs using an integer from either 1 to 100 or 0 to 99 (I forget which).
 
Text-tags implement a different (perhaps better, except for the limit) method of creating IDs using an integer from either 1 to 100 or 0 to 99 (I forget which).

Yep, they start off at 99 and go down to 0. ;) I believe ubersplats share the same quality, and maybe one more handle (weather, or something) I'm forgetting.
 
Status
Not open for further replies.
Back
Top