HomeUser Control Panel (unavailable in archive)ForumsTutorialsArt GalleryResourcesMaps

2 spell triggers mixing

03-12-2006, 05:47 PM#1
The_AwaKening
OK, i seriously need some help with these 2. For some reason they are interferring with each other. If I cast omin, it will do blink strike unless blink strike is cooling down. Blink Strike however never casts omni.
Collapse JASS:
function Omni2_Conditions takes nothing returns boolean
    return GetSpellAbilityId() == 'A01Z'
endfunction

function OmniBool takes nothing returns boolean
local unit u=GetFilterUnit()
local player p=GetOwningPlayer(bj_groupRandomCurrentPick)
    if IsUnitType(u,UNIT_TYPE_STRUCTURE) then
        return false
    elseif not IsUnitEnemy(u,p) then
        return false
    elseif GetUnitState(u,UNIT_STATE_LIFE)<=0 then
        return false
        elseif IsUnitType(u,UNIT_TYPE_ETHEREAL) then
                return false
        elseif UnitHasBuffBJ(u,'BHds') then
                return false
        elseif UnitHasBuffBJ(u,'Bvul') then
                return false
    elseif IsUnitInvisible(u, p) then
        return false
     endif
    set u=null
    set p=null
    return true
endfunction

function Omni2_Actions takes nothing returns nothing
local integer it=1093677402
local integer id=GetSpellAbilityId()
local unit u=GetSpellAbilityUnit()
local unit t=GetSpellTargetUnit()
local real range
local real dist
local integer count
local real dmg2
local real dmg
local integer regroup
local real delay
local attacktype atype
local damagetype dtype
local weapontype wtype
local string sfx
local string sfxloc
local player p
local unit v
local group g
local boolexpr b
local real x
local real y
local integer i=1
        loop
        exitwhen id!=it or GetUnitState(u,UNIT_STATE_LIFE)<=0
        call TriggerSleepAction(.01)
        set range=600            // Range to make a unit group from target
        set dist=50            // Distance to move caster to from target
        set count=9            // Amount of times for the hero to slash
        set dmg2=I2R(GetRandomInt(150,200))
        set dmg=60+((.75)*(GetHeroStr(u,true)+GetHeroAgi(u,true)+GetHeroInt(u,true)))
        if R2I(dmg2)>R2I(dmg) then    // Checks if stats or random damage is higher. Sets to highest
            set dmg=dmg2
        endif
        set delay=0.25            // Time between slashes
        set atype=ATTACK_TYPE_HERO    // Sets the attack type to be used
        set dtype=DAMAGE_TYPE_NORMAL    // Sets the damage type to be used
        set wtype=WEAPON_TYPE_WHOKNOWS    // Sets the weapon type to be used
        set p=GetOwningPlayer(u)
        set b=Condition(function OmniBool)
        set g=CreateGroup()
        set x=GetUnitX(t)
        set y=GetUnitY(t)
        set sfx="Abilities\\Spells\\NightElf\\Blink\\BlinkCaster.mdl"
        set sfxloc="chest"
        call SetUnitPathing(u,false)
                call SetUnitInvulnerable(u,true)
                call SetUnitVertexColorBJ(u,100,100,100,50)
        set bj_groupRandomCurrentPick=u
        call GroupEnumUnitsInRange(g,x,y,range,b)
        loop
            exitwhen i>count
            if i>1 then
                call TriggerSleepAction(delay)
                set v=t
                call GroupRemoveUnit(g,v)
                if GetUnitState(v,UNIT_STATE_LIFE)>0 then
                    call GroupAddUnit(g,v)
                endif
                set t=GroupPickRandomUnit(g)
                set x=GetUnitX(t)
                set y=GetUnitY(t)
                if t!=null then
                    call GroupClear(g)
                    set bj_groupRandomCurrentPick=u
                    call GroupEnumUnitsInRange(g,x,y,range,b)
                endif
            endif
            exitwhen IsUnitGroupEmptyBJ(g)
                           call DestroyEffect(AddSpecialEffectTarget(sfx,u,sfxloc))
                           call SetUnitPositionLocFacingBJ(u,PolarProjectionBJ(GetUnitLoc(t),dist,GetRandomReal(0,360)),AngleBetweenPoints(GetUnitLoc(t),GetUnitLoc(u)))
                        call SetUnitAnimation(u,"Attack")
            call UnitDamageTarget(u,t,dmg,true,false,atype,dtype,wtype)
            set i=i+1
        endloop
                call SetUnitInvulnerable(u,false)
        call SetUnitPathing(u,true)
                call SetUnitVertexColorBJ(u,100,100,100,0)
        call DestroyGroup(g)
        call DestroyBoolExpr(b)
        exitwhen true
    endloop
    set b=null
    set v=null
    set g=null
    set u=null
    set p=null
    set t=null
    set sfx=null
    set sfxloc=null
endfunction

function InitTrig_Omni2 takes nothing returns nothing
    set gg_trg_Omni2 = CreateTrigger(  )
    call TriggerRegisterAnyUnitEventBJ( gg_trg_Omni2, EVENT_PLAYER_UNIT_SPELL_EFFECT )
    call TriggerAddCondition( gg_trg_Omni2, Condition( function Omni2_Conditions ) )
    call TriggerAddAction( gg_trg_Omni2, function Trig_Omni2_Actions )
endfunction
Collapse JASS:
function Trig_Blink_Strike_Conditions takes nothing returns boolean
    return GetSpellAbilityId() == 'A03D'
endfunction

function Trig_Blink_Strike_Actions takes nothing returns nothing
local real dist
local real dmg
local unit caster=GetSpellAbilityUnit()
local unit t=GetSpellTargetUnit()
local string sfx="Abilities\\Spells\\NightElf\\Blink\\BlinkCaster.mdl"
local string sfxloc="chest"
    call SetUnitInvulnerable(caster,true)
    set dmg=100.00*I2R(GetUnitAbilityLevelSwapped(GetSpellAbilityId(), caster))
    set dist=50
    call DestroyEffect(AddSpecialEffectTarget(sfx,caster,sfxloc))
    call SetUnitPositionLocFacingBJ(caster,PolarProjectionBJ(GetUnitLoc(t),dist,GetRandomReal(0,360)),AngleBetweenPoints(GetUnitLoc(t),GetUnitLoc(caster)))
    call SetUnitFacingToFaceUnitTimed( caster, t, 0 )
    call SetUnitAnimation( caster, "Attack" )
    call UnitDamageTarget(caster,t,dmg,true,false,ATTACK_TYPE_NORMAL,DAMAGE_TYPE_NORMAL,WEAPON_TYPE_WHOKNOWS)
    call SetUnitInvulnerable(caster,false)
    set caster=null
    set t=null
    set sfx=null
    set sfxloc=null
endfunction

function InitTrig_Blink_Strike takes nothing returns nothing
    set gg_trg_Blink_Strike = CreateTrigger(  )
    call TriggerRegisterAnyUnitEventBJ( gg_trg_Blink_Strike, EVENT_PLAYER_UNIT_SPELL_EFFECT )
    call TriggerAddCondition( gg_trg_Blink_Strike, Condition( function Trig_Blink_Strike_Conditions ) )
    call TriggerAddAction( gg_trg_Blink_Strike, function Trig_Blink_Strike_Actions )
endfunction
Both are based on channel ability, but I changed the order string on omni to web. If you need to see the ability setups, let me know.
03-12-2006, 06:23 PM#2
harel
Your mistake was you need to change the Base Order ID and not the order string in change the spell setting.
03-13-2006, 10:11 PM#3
The_AwaKening
Got that part of it fixed. One more question regarding both of these though.

Lets say that the unit I am targeting is wind walked or invisible, but the caster has a crystal eye "true sight". If I try casting on the invis unit, it cancels back out. The invis unit dissappears from my casting units site for just a second while it is trying to cast.

Ideas?
03-15-2006, 05:22 PM#4
The_AwaKening
Ok so no one knows the answer to that apparently. So how bout this one at least. I need a better way to show the attack graphic in blink strike. I can't usually see any attack graphics so it looks like the targeted unit is just taking damage for no reason. Would be nice if I could make it look like a critical strike.
03-15-2006, 07:42 PM#5
Moss
For floating text you do something like:
Trigger:
Actions
Set p = Position of Target of ability being cast
Floating Text - Create floating text that reads *damage amount + !* at p with Z offset -10.00, using font size 10.00, color (100.00%, 0.00%, 0.00%), and 0.00% transparency
Floating Text - Change (Last created floating text): Disable permanence
Floating Text - Set the velocity of (Last created floating text) to 64.00 towards 90.00 degrees
Floating Text - Change the lifespan of (Last created floating text) to 3.00 seconds
Floating Text - Change the fading age of (Last created floating text) to 1.00 seconds
Custom script: call RemoveLocation(udg_p)

That's not perfect, I just ripped that off of something similar I have made.

As for your invisibility question, I would try to help you if I could understand what you were saying. Are you saying that when you cast a triggered spell on a invis unit it becomes visible? What is the spell you are casting?
03-15-2006, 08:19 PM#6
emjlr3
just on a side note, writing these triggers in JASS hleps to optimize your trigger

your omni has lots of room for improvement, from bjs, to conditions, to just plain uneeded things

try working on that

and your blink strike still leaks, and strings dont need to be set to locals
03-15-2006, 09:43 PM#7
Moss
Apparently someone has figured out how to make perfect floating text.

http://www.wc3campaigns.net/showthread.php?t=73972
03-16-2006, 02:54 PM#8
The_AwaKening
Thanks for all the help. I just barely built these triggers and haven't cleaned up the bj's yet. Some of the bj's I have a hard time figuring out how to do the natives, but I'll get there.

The invis problem is actually opposite of what you mentioned. If the targeted unit is invisible, and I have an item that gives ability true sight, I can target the unit that is invis, but the trigger won't fire. The invis unit will actually dissappear from my my for a split second when it tries to cast.

In conversion process of bj's to natives, I run into some trbl.
Here are the natives
Code:
native CreateTextTag                takes nothing returns texttag
native DestroyTextTag               takes texttag t returns nothing
native SetTextTagText               takes texttag t, string s, real height returns nothing
native SetTextTagPos                takes texttag t, real x, real y, real heightOffset returns nothing
native SetTextTagPosUnit            takes texttag t, unit whichUnit, real heightOffset returns nothing
native SetTextTagColor              takes texttag t, integer red, integer green, integer blue, integer alpha returns nothing
native SetTextTagVelocity           takes texttag t, real xvel, real yvel returns nothing
native SetTextTagVisibility         takes texttag t, boolean flag returns nothing
native SetTextTagSuspended          takes texttag t, boolean flag returns nothing
native SetTextTagPermanent          takes texttag t, boolean flag returns nothing
native SetTextTagAge                takes texttag t, real age returns nothing
native SetTextTagLifespan           takes texttag t, real lifespan returns nothing
native SetTextTagFadepoint          takes texttag t, real fadepoint returns nothing
My bj's that work ok
Code:
	call CreateTextTagUnitBJ( R2S(dmg) + "!", t, 0, 10, 100, 0.00, 0.00, 0 )
	call SetTextTagVelocityBJ( GetLastCreatedTextTag(), 72.00, 90 )
	call SetTextTagPermanentBJ( GetLastCreatedTextTag(), false )
	call SetTextTagLifespanBJ( GetLastCreatedTextTag(), 5 )
	call SetTextTagFadepointBJ( GetLastCreatedTextTag(), 2.00 )
The last 4 are easy enough to convert since BJ just needs to be removed from the code. I just can't figure out how to Create the text tag using natives. Then also would it be necessary to add a 5 second wait and then call DestroyTextTag?