| 12-24-2006, 07:27 PM | #1 |
JASS:function Trig_Money_Setup_Conditions takes nothing returns boolean return IsUnitType(GetDyingUnit(), UNIT_TYPE_STRUCTURE) == false and IsUnitType(GetDyingUnit(), UNIT_TYPE_HERO) == false and IsUnitType(GetKillingUnit(), UNIT_TYPE_HERO) and GetOwningPlayer(GetKillingUnit()) != GetOwningPlayer(GetDyingUnit()) or IsUnitType(GetKillingUnit(), UNIT_TYPE_SUMMONED) == true endfunction function Trig_Money_Setup_Actions takes nothing returns nothing local unit a = GetDyingUnit() local unit d = GetKillingUnit() local integer b = GetUnitTypeId(a) local integer c = GetRandomInt(33,48) local integer cc = GetRandomInt(38,59) local integer ca = GetPlayerState(GetOwningPlayer(d), PLAYER_STATE_RESOURCE_GOLD) + c local integer cca = GetPlayerState(GetOwningPlayer(d), PLAYER_STATE_RESOURCE_GOLD) + cc local string cas = "+" + I2S(c) local string ccas = "+" + I2S(cc) local texttag t = CreateTextTag() local real ux = GetUnitX(a) local real uy = GetUnitY(a) local real vel = TextTagSpeed2Velocity(30) local real velx = vel * Cos(90 * bj_DEGTORAD) local real vely = vel * Sin(90 * bj_DEGTORAD) call SetTextTagPermanent(t, false) call SetTextTagPos( t, ux, uy, 0) call SetTextTagColorBJ(t, 85, 85, 15, 100) call SetTextTagVelocity(t, velx, vely) call SetTextTagLifespan(t, 5) call SetTextTagFadepoint(t, 3) if b == 'hfoo' or b == 'ugho' or b == 'edoc' or b == 'ogru' then call SetTextTagText( t, cas, TextTagSize2Height(11) ) call SetPlayerState( GetOwningPlayer(d), PLAYER_STATE_RESOURCE_GOLD, ca) elseif b == 'hsor' or b == 'uban' or b == 'ohun' or b == 'even' then call SetTextTagText( t, ccas, TextTagSize2Height(11) ) call SetPlayerState( GetOwningPlayer(d), PLAYER_STATE_RESOURCE_GOLD, cca) endif set t = null set a = null set d = null endfunction //=========================================================================== function InitTrig_Money_Setup takes nothing returns nothing set gg_trg_Money_Setup = CreateTrigger( ) call TriggerRegisterAnyUnitEventBJ( gg_trg_Money_Setup, EVENT_PLAYER_UNIT_DEATH ) call TriggerAddCondition( gg_trg_Money_Setup, Condition( function Trig_Money_Setup_Conditions ) ) call TriggerAddAction( gg_trg_Money_Setup, function Trig_Money_Setup_Actions ) endfunction |
| 12-24-2006, 08:17 PM | #2 |
umm... Idk, perhaps its something to do with all those variables, the booleans, and bj's and stuff... personally, I haven't a clue. |
| 12-25-2006, 12:52 AM | #3 |
JASS:local real velx = vel * Cos(90 * bj_DEGTORAD) local real vely = vel * Sin(90 * bj_DEGTORAD) So that can all be reduced to this: JASS:local real velx = 0 local real vely = vel Otherwise, the code looks fine. Consider adding BJDebugMsg() calls into the function to make sure it is passing its conditions when you want it to. If it is, then it should be relatively instantly visible. Notice also -- call SetTextTagColorBJ(t, 85, 85, 15, 100) JASS:function SetTextTagColorBJ takes texttag tt, real red, real green, real blue, real transparency returns nothing call SetTextTagColor(tt, PercentTo255(red), PercentTo255(green), PercentTo255(blue), PercentTo255(100.0-transparency)) endfunction This may also explain why you're not seeing it. |
| 12-25-2006, 01:24 AM | #4 |
Texttags aren't regular handles, are they? If it's not >0x100000 you don't need to null it. |
| 12-25-2006, 06:51 AM | #5 | |
Quote:
So could you check via (I2R(HtoI(SomeTextTag))>0x100000)? |
| 12-28-2006, 03:06 PM | #6 |
so..theres nothing really wrong with it that would delay the text by 2-3 seconds? The text does eventually show, just very delayed. |
| 12-30-2006, 10:40 PM | #7 |
Ok, everything is perfect now (Ty dusk), except for the condition. JASS:function Trig_Money_Setup_Conditions takes nothing returns boolean return IsUnitType(GetDyingUnit(), UNIT_TYPE_STRUCTURE) == false and IsUnitType(GetDyingUnit(), UNIT_TYPE_HERO) == false and IsUnitType(GetKillingUnit(), UNIT_TYPE_HERO) and GetOwningPlayer(GetKillingUnit()) != GetOwningPlayer(GetDyingUnit()) or IsUnitType(GetKillingUnit(), UNIT_TYPE_SUMMONED) == true endfunction the or part doesnt seem to be working b/c when i kill one of the units with a summon, it doesnt run |
| 12-31-2006, 12:46 AM | #8 |
Hmm.. maybe because one of your IsUnitType's is missing the "== true" |
| 12-31-2006, 02:22 AM | #9 |
thx ;>< my bad |
