- Joined
- Aug 15, 2007
- Messages
- 145
Having trouble making units in a wall, this trigger bugs on the left side is made, is there a simpler way to make this? Please help me fix
JASS:
scope FIREWALL initializer Init
globals
private constant integer SPELL_ID = 'A044'
private constant integer SPELLLEVEL = 'A031'
private constant integer DUMMY = 'o001'
private constant integer DUMMY2 = 'h00U'
private constant integer DUMMY_SPELL = 'A03X'
private constant integer DUMMY_SPELL2 = 'A00X'
endglobals
private function Conditions takes nothing returns boolean
return GetSpellAbilityId() == SPELL_ID
endfunction
private function Actions takes nothing returns nothing
local location t = GetSpellTargetLoc()
local unit u = GetTriggerUnit()
local player p = GetOwningPlayer(u)
local real f = GetUnitFacing(u)
local real dur = (4 * I2R(GetUnitAbilityLevel(u, SPELL_ID)))
local real x = GetWidgetX( u )
local real y = GetWidgetY( u )
local unit d
local unit c
local unit b
local unit m
local integer FirewallLeft
local integer FirewallRight
set d = CreateUnitAtLoc( p, DUMMY, t, f)
call RemoveLocation( t)
call SetUnitAbilityLevel(d, DUMMY_SPELL, SPELL_ID)
call UnitApplyTimedLife( d, 'BTLF', dur )
set FirewallRight = 1
loop
exitwhen FirewallRight > 3
set t = GetSpellTargetLoc()
set c= CreateUnitAtLoc( p, DUMMY, PolarProjectionBJ(t, ( I2R(FirewallRight) * 150.00 ),(f + 90 )), f)
call RemoveLocation( t)
call SetUnitAbilityLevel(c, DUMMY_SPELL, SPELL_ID)
call UnitApplyTimedLife( c, 'BTLF', dur )
set FirewallRight = FirewallRight+ 1
endloop
set FirewallLeft = 1
loop
exitwhen FirewallLeft > 3
set t = GetSpellTargetLoc()
set m= CreateUnitAtLoc( p, DUMMY, PolarProjectionBJ(t, ( I2R(FirewallRight) * 150.00 ),(f - 90 )), f)
call RemoveLocation( t)
call SetUnitAbilityLevel(m, DUMMY_SPELL, SPELL_ID)
call UnitApplyTimedLife( m, 'BTLF', dur )
set FirewallLeft = FirewallLeft + 1
endloop
if GetUnitAbilityLevel(u, SPELLLEVEL ) > 0 then
set b = CreateUnit( p, DUMMY2, x, y, x)
call SetUnitInvulnerable( b, true )
call UnitAddAbility(b, DUMMY_SPELL2)
call SetUnitAbilityLevel(b , DUMMY_SPELL2, SPELLLEVEL)
call UnitApplyTimedLife( b, 'BTLF', dur )
endif
set c= null
set d= null
set m= null
set p = null
set b= null
endfunction
//===========================================================================
private function Init takes nothing returns nothing
local trigger t = CreateTrigger( )
local integer i = 0
loop
exitwhen i > 11
call TriggerRegisterPlayerUnitEvent(t, Player(i), EVENT_PLAYER_UNIT_SPELL_EFFECT, null)
set i = i + 1
endloop
call TriggerAddCondition( t, Condition( function Conditions ) )
call TriggerAddAction( t, function Actions )
set t = null
endfunction
endscope