- Joined
- Aug 9, 2006
- Messages
- 2,384
This is a Script which should shoot a lightning on the target, set it on fire for 10 seconds. But i dunno how to use Handle Vars correctly sry, can someone please help me?
By the way, the 3,1,2 textmessage where to test what runs correctly and what not.
JASS:
scope FireChain
globals
constant integer FRCH_AbillID = 'A000'
constant string FRCH_lightningModel = "AFOD" // The model path of the lightning
real FRCH_damageUnCalculated = 25 // The Damage done, gets multiplied with the level
integer FRCH_BurnDur = 10 // Duration of the Burn
endglobals
function Trig_Fire_Chain_Conditions takes nothing returns boolean
if ( GetSpellAbilityId() == FRCH_AbillID ) then
return true
endif
return false
endfunction
function Chain takes real X1, real Y1, real X2, real Y2 returns nothing
local lightning lightning1 = AddLightning(FRCH_lightningModel, true, X1, Y1, X2, Y2)
call DisplayTextToForce( GetPlayersAll(), "3" )
call PolledWait(1.00)
call DestroyLightning(lightning1)
endfunction
function DamageUnitFire takes nothing returns nothing
local unit target
local unit caster
call GetHandleUnit(target, "target")
call GetHandleUnit(caster, "caster")
call UnitDamageTarget (caster, target, FRCH_damageUnCalculated*GetUnitAbilityLevel(caster, FRCH_AbillID), false, false, ATTACK_TYPE_NORMAL, DAMAGE_TYPE_NORMAL, WEAPON_TYPE_WHOKNOWS)
call DisplayTextToForce( GetPlayersAll(), "2" )
set target = null
set caster = null
endfunction
function ChainDamage takes unit target, unit caster returns nothing
local effect FireBurn = AddSpecialEffectTarget("Abilities\\Spells\\Other\\ImmolationRed\\ImmolationRedDamage", target, "head")
local timer FireDamage = CreateTimer()
call DisplayTextToForce( GetPlayersAll(), "1" )
call TimerStart(FireDamage, 1.00, true, function DamageUnitFire )
call PolledWait(10.00)
call PauseTimer(FireDamage)
call DestroyEffect(FireBurn)
endfunction
function KeepOrNoKeep takes unit target2, player Cowner returns boolean
if ( IsUnitType(target2, UNIT_TYPE_STRUCTURE) == false ) and ( IsUnitType(target2, UNIT_TYPE_MAGIC_IMMUNE) == false ) and ( IsUnitAliveBJ(target2) == true ) and ( IsUnitEnemy(target2, Cowner) == true ) and target2 != null then
return true
endif
return false
endfunction
function Trig_Fire_Chain_Actions takes nothing returns nothing
local unit caster
local unit target
local unit target2
local real X1
local real Y1
local real X2
local real Y2
local player Cowner
local integer arcs = 3 //number of arcs after the first jump
local location locationFC
local group DamagedUnits
call SetHandleHandle(GetSpellTargetUnit(), "target", null)
call SetHandleHandle(GetSpellAbilityUnit(), "caster", null)
call GetHandleUnit(caster, "caster")
call GetHandleUnit(target, "target")
set Cowner = GetOwningPlayer(caster)
set X1 = GetUnitX(caster)
set Y1 = GetUnitY(caster)
set X2 = GetUnitX(target)
set Y2 = GetUnitY(target)
set locationFC = Location(X2,Y2)
call Chain(X1, Y1, X2, Y2)
call ChainDamage(target, caster)
call PolledWait(0.25)
call RemoveLocation(locationFC)
call GroupClear(DamagedUnits)
set caster = null
set target = null
set target2 = null
call DestroyGroup(DamagedUnits)
call PolledWait(10.00)
call FlushHandleLocals(target)
call FlushHandleLocals(caster)
endfunction
//===========================================================================
function InitTrig_FireChain takes nothing returns nothing
set gg_trg_FireChain = CreateTrigger( )
call TriggerRegisterAnyUnitEventBJ( gg_trg_FireChain, EVENT_PLAYER_UNIT_SPELL_EFFECT )
call TriggerAddCondition( gg_trg_FireChain, Condition( function Trig_Fire_Chain_Conditions ) )
call TriggerAddAction( gg_trg_FireChain, function Trig_Fire_Chain_Actions )
endfunction
endscope
By the way, the 3,1,2 textmessage where to test what runs correctly and what not.