Hello,
im fairly new to this programming thing and im working on a converted GUI script.
The big idea is to create redlightning from a caster to a target and damaging it.
the script:
function Trig_StormofPain_Conditions takes nothing returns boolean
if ( not ( GetSpellAbilityId() == 'AEim' ) ) then
return false
endif
return true
endfunction
function Trig_StormofPain_Func004002003001001 takes nothing returns boolean
return ( IsUnitAliveBJ(GetFilterUnit()) == true )
endfunction
function Trig_StormofPain_Func004002003001002 takes nothing returns boolean
return ( GetFilterUnit() != udg_caster )
endfunction
function Trig_StormofPain_Func004002003001 takes nothing returns boolean
return GetBooleanAnd( Trig_StormofPain_Func004002003001001(), Trig_StormofPain_Func004002003001002() )
endfunction
function Trig_StormofPain_Func004002003002 takes nothing returns boolean
return ( IsUnitEnemy(GetFilterUnit(), udg_Mistressplayer) == true )
endfunction
function Trig_StormofPain_Func004002003 takes nothing returns boolean
return GetBooleanAnd( Trig_StormofPain_Func004002003001(), Trig_StormofPain_Func004002003002() )
endfunction
function Trig_StormofPain_Actions takes nothing returns nothing
local unit target
local location point
local location pointmax
local timer time
local effect E
local lightning L
local group G
local integer I
set udg_caster = gg_unit_Edem_0001
call StartTimerBJ( time, false, 30 )
loop
exitwhen I==30
set point = GetUnitLoc(udg_caster)
set G = GetUnitsInRangeOfLocMatching(500.00, point, Condition(function Trig_StormofPain_Func004002003))
set target = GroupPickRandomUnit(G)
set pointmax = GetUnitLoc(target)
call AddSpecialEffectLocBJ( pointmax, "Abilities\\Spells\\Demon\\DemonBoltImpact\\DemonBoltImpact.mdl" )
set E = GetLastCreatedEffectBJ()
call AddLightningLoc( "AFOD", point, pointmax )
set L = GetLastCreatedLightningBJ()
call TriggerSleepAction( 0.30 )
call DestroyLightningBJ( L )
call DestroyEffectBJ( E )
call UnitDamageTargetBJ( udg_caster, target, 500.00, ATTACK_TYPE_CHAOS, DAMAGE_TYPE_NORMAL )
set I = R2I(TimerGetElapsed(time))
set G = null
set target = null
set point = null
set pointmax = null
set E = null
set L = null
endloop
call DestroyTimer( time )
set time = null
endfunction
//===========================================================================
function InitTrig_StormofPain takes nothing returns nothing
set gg_trg_StormofPain = CreateTrigger( )
call TriggerRegisterUnitEvent( gg_trg_StormofPain, gg_unit_Edem_0001, EVENT_UNIT_SPELL_EFFECT )
call TriggerAddCondition( gg_trg_StormofPain, Condition( function Trig_StormofPain_Conditions ) )
call TriggerAddAction( gg_trg_StormofPain, function Trig_StormofPain_Actions )
endfunction
I've copied it to the trigger editor but it wont run. The WE doenst give any errors when i save the map with this, so i cant get any help from that.
Can someone help me out with this because im clueless at this point.
(oh, how do i get the colors for the code that the editor uses?)
Thanks,
frenksel
im fairly new to this programming thing and im working on a converted GUI script.
The big idea is to create redlightning from a caster to a target and damaging it.
the script:
function Trig_StormofPain_Conditions takes nothing returns boolean
if ( not ( GetSpellAbilityId() == 'AEim' ) ) then
return false
endif
return true
endfunction
function Trig_StormofPain_Func004002003001001 takes nothing returns boolean
return ( IsUnitAliveBJ(GetFilterUnit()) == true )
endfunction
function Trig_StormofPain_Func004002003001002 takes nothing returns boolean
return ( GetFilterUnit() != udg_caster )
endfunction
function Trig_StormofPain_Func004002003001 takes nothing returns boolean
return GetBooleanAnd( Trig_StormofPain_Func004002003001001(), Trig_StormofPain_Func004002003001002() )
endfunction
function Trig_StormofPain_Func004002003002 takes nothing returns boolean
return ( IsUnitEnemy(GetFilterUnit(), udg_Mistressplayer) == true )
endfunction
function Trig_StormofPain_Func004002003 takes nothing returns boolean
return GetBooleanAnd( Trig_StormofPain_Func004002003001(), Trig_StormofPain_Func004002003002() )
endfunction
function Trig_StormofPain_Actions takes nothing returns nothing
local unit target
local location point
local location pointmax
local timer time
local effect E
local lightning L
local group G
local integer I
set udg_caster = gg_unit_Edem_0001
call StartTimerBJ( time, false, 30 )
loop
exitwhen I==30
set point = GetUnitLoc(udg_caster)
set G = GetUnitsInRangeOfLocMatching(500.00, point, Condition(function Trig_StormofPain_Func004002003))
set target = GroupPickRandomUnit(G)
set pointmax = GetUnitLoc(target)
call AddSpecialEffectLocBJ( pointmax, "Abilities\\Spells\\Demon\\DemonBoltImpact\\DemonBoltImpact.mdl" )
set E = GetLastCreatedEffectBJ()
call AddLightningLoc( "AFOD", point, pointmax )
set L = GetLastCreatedLightningBJ()
call TriggerSleepAction( 0.30 )
call DestroyLightningBJ( L )
call DestroyEffectBJ( E )
call UnitDamageTargetBJ( udg_caster, target, 500.00, ATTACK_TYPE_CHAOS, DAMAGE_TYPE_NORMAL )
set I = R2I(TimerGetElapsed(time))
set G = null
set target = null
set point = null
set pointmax = null
set E = null
set L = null
endloop
call DestroyTimer( time )
set time = null
endfunction
//===========================================================================
function InitTrig_StormofPain takes nothing returns nothing
set gg_trg_StormofPain = CreateTrigger( )
call TriggerRegisterUnitEvent( gg_trg_StormofPain, gg_unit_Edem_0001, EVENT_UNIT_SPELL_EFFECT )
call TriggerAddCondition( gg_trg_StormofPain, Condition( function Trig_StormofPain_Conditions ) )
call TriggerAddAction( gg_trg_StormofPain, function Trig_StormofPain_Actions )
endfunction
I've copied it to the trigger editor but it wont run. The WE doenst give any errors when i save the map with this, so i cant get any help from that.
Can someone help me out with this because im clueless at this point.
(oh, how do i get the colors for the code that the editor uses?)
Thanks,
frenksel