| 10-24-2006, 04:27 PM | #1 |
Im trying to make an Assasinate ability, that deals damage to a unit and bonus damage equal to 2xagility if the target has a specific buff, but the bonus damage doesnt seem to trigger at all? Help please JASS:function Trig_Assasinate_Cast_Conditions takes nothing returns boolean return GetSpellAbilityId() == 'A000' endfunction function Trig_Assasinate_Cast_Actions takes nothing returns nothing local unit caster = GetTriggerUnit() local unit target = GetSpellTargetUnit() local real targetX = GetUnitX(target) local real targetY = GetUnitY(target) local integer agilityBonus = 2*(GetHeroAgi(caster, true)) local integer spellLevel = GetUnitAbilityLevel(caster, 'A000') local texttag damageText call UnitDamageTarget(caster, target, 200+(50*spellLevel), false, false, ATTACK_TYPE_CHAOS, DAMAGE_TYPE_UNIVERSAL, WEAPON_TYPE_CLAW_HEAVY_SLICE) if (GetUnitAbilityLevel(GetFilterUnit(), 'B000') > 0) == true then call UnitDamageTarget(caster, target, agilityBonus, false, false, ATTACK_TYPE_CHAOS, DAMAGE_TYPE_UNIVERSAL, WEAPON_TYPE_CLAW_HEAVY_SLICE) set damageText = CreateTextTag() call SetTextTagText(damageText, I2S(agilityBonus), 90) call SetTextTagPos(damageText, targetX, targetY, 64) call SetTextTagVelocity(damageText, 64, 90) call SetTextTagVisibility(damageText, true) call SetTextTagColor(damageText, 100, 0, 0, 0) call TriggerSleepAction(1.00) call DestroyTextTag(damageText) set damageText = null endif set caster = null set target = null endfunction //=========================================================================== function InitTrig_Assasinate_Cast takes nothing returns nothing set gg_trg_Assasinate_Cast = CreateTrigger( ) call TriggerRegisterAnyUnitEventBJ( gg_trg_Assasinate_Cast, EVENT_PLAYER_UNIT_SPELL_EFFECT ) call TriggerAddCondition( gg_trg_Assasinate_Cast, Condition( function Trig_Assasinate_Cast_Conditions ) ) call TriggerAddAction( gg_trg_Assasinate_Cast, function Trig_Assasinate_Cast_Actions ) endfunction |
| 10-24-2006, 04:32 PM | #2 |
if (GetUnitAbilityLevel(GetFilterUnit(), 'B000') > 0) == true then
instead of GetFilterUnit() use your local variable target |
| 10-24-2006, 04:33 PM | #3 |
Oh.. Thanks... Wait, that fixed the damage, but apparently, something is wrong with my texttag? |
| 10-24-2006, 04:39 PM | #4 |
i guess it isnt showing at all? call SetTextTagColor(damageText, 100, 0, 0, 0) try setting the alpha value to 255 (100% visible) |
| 10-24-2006, 05:02 PM | #5 |
Yep, not showing at all, changing the alpha doesnt help, 0 should be 100% visible, or 0% transparent or however you want to put it. I don't know whats wrong, anyone else has any ideas? |
| 10-24-2006, 05:11 PM | #6 |
Do not destroy the texttag. You must make it timed. I suggest you to use a func like this: JASS:function CreateFadingTextEx takes string message,integer r,integer g,integer b, real x, real y,real speed,real fadetime,real life returns nothing local texttag tex=CreateTextTag() call SetTextTagVisibility(tex,true) call SetTextTagText(tex,message,0.023) call SetTextTagPos(tex,x,y,0) call SetTextTagColor(tex,r,g,b,255) call SetTextTagVelocity(tex,0,speed) call SetTextTagFadepoint(tex,fadetime) call SetTextTagLifespan(tex,life) call SetTextTagPermanent(tex,false) set tex=null endfunction |
| 10-24-2006, 05:12 PM | #7 |
actually 255 is 100% visible. and thats the only reason i can find why it wouldn't work. |
| 10-24-2006, 05:14 PM | #8 |
JASS:if (GetUnitAbilityLevel(caster, 'B000') > 0) == true then uhmm, I'm not sure is this the same, I usually just put this : JASS:if GetUnitAbilityLevel(caster, 'B000') > 0 then if talking about TextTag, i think you forgetting this : JASS:call SetTextTagPermanentBJ( texttag, false ) |
| 10-24-2006, 05:18 PM | #9 |
Of course your fiirst statement is the same as the second. But the second just makes the code harder to read and increase filesize. 3rd statement I allready mention passivly |
| 10-24-2006, 05:20 PM | #10 |
Ok, thanks alot Bert, that did the trick! |
| 10-24-2006, 05:22 PM | #11 | |
Quote:
and i'm kinda slow in typing... so only realise that you posted before me when i clicked the post button hehe |
| 10-24-2006, 05:42 PM | #12 |
Oh, well .. does notmatter any ways, problem solved. |
