#1
Arrow Spells
Is there a way to make arrow spells (autocast spells who can used instead o attack (flaming arrows and such)) in GUI?if so please say it
PurplePootShouldnt you be able to detect on cast? Or do autocasts not fire A Unit xxxs an Ability?
donut3.5Couldn't you just attach a buff to the autocast effect, and do
A unit is attacked
Wait 1 seconds
If triggering unit has buff then do blah blah else do nothing?
paskovich...
As I said, JASS would do it.
//======================================================================
//This catches the turn on/off order
//======================================================================
function Trig_ArrowSpellsOrder_Conditions takes nothing returns boolean
return GetIssuedOrderId() == OrderId("flamingarrows") or GetIssuedOrderId() == OrderId("unflamingarrows")
endfunction
function Trig_ArrowSpellsOrder_Actions takes nothing returns nothing
local unit flamer = GetTriggerUnit()
if GetIssuedOrderId() == OrderId("flamingarrows") then
call SetHandleInt(flamer,"arrowon",1)
else
call SetHandleInt(flamer,"arrowon",0)
endif
set flamer = null
endfunction
//======================================================================
//This is the "projectile hit detection" trigger - this makes the effect
//======================================================================
function Trig_ArrowSpells_Hit_Conditions takes nothing returns boolean
return GetEventDamageSource() == GetHandleUnit(GetTriggeringTrigger(), "DamageSource")
endfunction
function Trig_ArrowSpells_Hit_Actions takes nothing returns nothing
local unit flamer = GetEventDamageSource()
local unit target = GetTriggerUnit()
local trigger dmgtrig = GetTriggeringTrigger()
//
//All the effects go here...
//Here, it creates a special effect on the target:
call DestroyEffect(AddSpecialEffectTarget("abilities\\weapons\\DemolisherMissile\\DemolisherMissile.mdl",target,"origin"))
//
call SetHandleHandle(flamer, "DamageTrigger", null)
call FlushHandleLocals(dmgtrig)
call DestroyTrigger(dmgtrig)
set target = null
set flamer = null
set dmgtrig = null
endfunction
//======================================================================
//This is the 'unit is attacked' trigger
//======================================================================
function Trig_ArrowSpellsAttack_Conditions takes nothing returns boolean
return GetHandleInt(GetAttacker(),"arrowon") == 1 and GetHandleTrigger(GetAttacker(), "DamageTrigger") == null
endfunction
function Trig_ArrowSpellsAttack_Actions takes nothing returns nothing
local unit flamer = GetAttacker()
local unit target = GetTriggerUnit()
local trigger dmgtrig = CreateTrigger()
call SetHandleHandle(flamer, "DamageTrigger", dmgtrig)
call SetHandleHandle(dmgtrig, "DamageSource", flamer)
call TriggerRegisterUnitEvent(dmgtrig, target, EVENT_UNIT_DAMAGED)
call TriggerAddCondition(dmgtrig, Condition(function Trig_ArrowSpells_Hit_Conditions))
call TriggerAddAction(dmgtrig, function Trig_ArrowSpells_Hit_Actions)
call TriggerSleepAction(2)
call FlushHandleLocals(dmgtrig)
call DestroyTrigger(dmgtrig)
call SetHandleHandle(flamer, "DamageTrigger", null)
set target = null
set flamer = null
set dmgtrig = null
endfunction
//======================================================================
//This is the 'spell effect' trigger
//======================================================================
function Trig_ArrowSpellsCast_Conditions takes nothing returns boolean
return GetSpellAbilityId() == 'AHfa'
endfunction
function Trig_ArrowSpellsCast_Actions takes nothing returns nothing
local unit flamer = GetTriggerUnit()
local unit target = GetSpellTargetUnit()
local trigger dmgtrig = CreateTrigger()
call SetHandleHandle(flamer, "DamageTrigger", dmgtrig)
call SetHandleHandle(dmgtrig, "DamageSource", flamer)
call TriggerRegisterUnitEvent(dmgtrig, target, EVENT_UNIT_DAMAGED)
call TriggerAddCondition(dmgtrig, Condition(function Trig_ArrowSpells_Hit_Conditions))
call TriggerAddAction(dmgtrig, function Trig_ArrowSpells_Hit_Actions)
call TriggerSleepAction(2)
call FlushHandleLocals(dmgtrig)
call DestroyTrigger(dmgtrig)
call SetHandleHandle(flamer, "DamageTrigger", null)
set target = null
set flamer = null
set dmgtrig = null
endfunction
//===========================================================================
function InitTrig_ArrowSpells takes nothing returns nothing
local trigger ArrowSpellsOrder = CreateTrigger()
local trigger ArrowSpellsAttack = CreateTrigger()
local trigger ArrowSpellsCast = CreateTrigger()
call TriggerRegisterAnyUnitEventBJ(ArrowSpellsOrder, EVENT_PLAYER_UNIT_ISSUED_ORDER )
call TriggerAddCondition(ArrowSpellsOrder, Condition( function Trig_ArrowSpellsOrder_Conditions ) )
call TriggerAddAction(ArrowSpellsOrder, function Trig_ArrowSpellsOrder_Actions )
call TriggerRegisterAnyUnitEventBJ(ArrowSpellsAttack, EVENT_PLAYER_UNIT_ATTACKED )
call TriggerAddCondition(ArrowSpellsAttack, Condition( function Trig_ArrowSpellsAttack_Conditions ) )
call TriggerAddAction(ArrowSpellsAttack, function Trig_ArrowSpellsAttack_Actions )
call TriggerRegisterAnyUnitEventBJ(ArrowSpellsCast, EVENT_PLAYER_UNIT_SPELL_EFFECT )
call TriggerAddCondition(ArrowSpellsCast, Condition( function Trig_ArrowSpellsCast_Conditions ) )
call TriggerAddAction(ArrowSpellsCast, function Trig_ArrowSpellsCast_Actions )
endfunction//======================================================================
//This is the "projectile hit detection" trigger - this makes the effect
//======================================================================
function **** takes nothing returns boolean
return GetHandleInt(GetEventDamageSource(),"arrowon") == 1
endfunction
function **** takes nothing returns nothing
//local unit flamer = GetEventDamageSource()
local unit target = GetTriggerUnit()
local trigger dmgtrig = GetTriggeringTrigger()
//All the effects go here...
//Here, it creates a special effect on the target:
call DestroyEffect(AddSpecialEffectTarget("abilities\\weapons\\DemolisherMissile\\DemolisherMissile.mdl",target,"origin"))
//call SetHandleHandle(flamer, "DamageTrigger", null)
//call FlushHandleLocals(dmgtrig)
call DestroyTrigger(dmgtrig)
set target = null
//set flamer = null
set dmgtrig = null
endfunction
...Paskovitch's ScriptEVENT_UNIT_DAMAGED