| 09-03-2009, 08:53 AM | #1 |
Hey, I have a little problem with the code below. Most of it works fine, except that when a unit dies, a texttag isn't created on it, which it should, and I don't know what to do... oh well. Thanks in advance etc. JASS:scope Kills initializer Init private function Actions takes nothing returns nothing local texttag tt local multiboarditem mbi set Multiboard_PlayerKills[GetPlayerId(GetOwningPlayer(GetKillingUnit()))] = Multiboard_PlayerKills[GetPlayerId(GetOwningPlayer(GetKillingUnit()))] +1 set mbi = MultiboardGetItem(Multiboard_board,GetPlayerId(GetOwningPlayer(GetKillingUnit())),1) call MultiboardSetItemValue(mbi,"|cffffcc00"+I2S(Multiboard_PlayerKills[GetPlayerId(GetOwningPlayer(GetKillingUnit()))])) call MultiboardReleaseItem(mbi) set tt = CreateTextTag() call SetTextTagText(tt,"test",10) call SetTextTagPosUnit(tt,GetTriggerUnit(),0) call SetTextTagColor(tt,100,100,100,0) if(GetUnitTypeId(GetTriggerUnit()) == 'h001') then call AddHeroXP(MapSetup_God[GetPlayerId(GetOwningPlayer(GetKillingUnit()))],15,false) endif endfunction private function Init takes nothing returns nothing local trigger t = CreateTrigger() call TriggerRegisterAnyUnitEventBJ(t,EVENT_PLAYER_UNIT_DEATH) call TriggerAddAction(t,function Actions) endfunction endscope |
| 09-03-2009, 11:07 AM | #2 |
call SetTextTagVisibility(tt, true)
Also SetTextTagColor takes 0-255 instead of 0-100 and the last one (transparency) would be 0 for completely invisible and 255 for fully visible. But im not 100% sure on this. And you may also need these later: JASS:
call SetTextTagVelocity(tt, 0.0, 0.04)
call SetTextTagFadepoint(tt, 2.5)
call SetTextTagLifespan(tt, 4.0)
call SetTextTagPermanent(tt, false)
set tt = null
|
| 09-03-2009, 11:42 AM | #3 |
Adding the "call SetTextTagVisibility(tt, true)" doesn't do shit, nor does setting the transparency to 255 instead of 0. |
| 09-03-2009, 05:01 PM | #4 |
Ahh, I know this problem. Had this problem myself in the past. The main problem is here : JASS:call SetTextTagText takes texttag t, string s, real height and if you create a texttag with the GUI, it calls this native to set the text: JASS:function SetTextTagTextBJ takes texttag tt, string s, real size returns nothing local real textHeight = TextTagSize2Height(size) call SetTextTagText(tt, s, textHeight) endfunction and JASS:function TextTagSize2Height takes real size returns real return size * 0.023 / 10 endfunction Get it :) ?? So apparently, texttag "height" is different with texttag "size", where Code:
TexttagHeight = TexttagSize * 0.0023 so size 10 will have height = 10000/23 which means that the texttag is actually created when your unit dies but just in crazy gigantic size. |
