jig7c
Stop reading me...-statement
- Reaction score
- 123
i need help cleaning out this code...
what i need is this ability (Illusion) to give the Hero, 10/15/20% chance to create an illusion of the attacked unit at the attacked unit's location... the Clone function is working fine(thanks to Sevion) i just need help setting up the chance and the globals... please help
what i need is this ability (Illusion) to give the Hero, 10/15/20% chance to create an illusion of the attacked unit at the attacked unit's location... the Clone function is working fine(thanks to Sevion) i just need help setting up the chance and the globals... please help
Code:
scope Illusion initializer Init
globals
unit hero = GetAttacker()
unit target = GetTriggerUnit()
location l = GetUnitLoc(target)
endglobals
private function Conditions takes nothing returns boolean
local boolean b = false
local unit u = GetTriggerUnit()
set b = GetUnitTypeId(GetAttacker()) == 'Ekgg' and not (IsUnitType(u, UNIT_TYPE_HERO) and IsUnitType(u, UNIT_TYPE_PEON) and IsUnitType(u, UNIT_TYPE_STRUCTURE) and IsUnitType(u, UNIT_TYPE_MECHANICAL))
set u = null
return b
endfunction
function Level1 takes nothing returns boolean
return (GetUnitAbilityLevel(hero, 'A028') ==1) and (GetRandomInt(1, 100) <= 10 )
endfunction
function Level2 takes nothing returns boolean
return (GetUnitAbilityLevel(hero, 'A028') ==2) and (GetRandomInt(1, 100) <= 15 )
endfunction
function Level3 takes nothing returns boolean
return (GetUnitAbilityLevel(hero, 'A028') ==3) and (GetRandomInt(1, 100) <= 20 )
endfunction
function Actions takes nothing returns nothing
local unit u
local real r = GetUnitState(target, UNIT_STATE_LIFE)
if ( Level1() ) then
call CloneUnit( target, l )
set u = GetLastCreatedUnit ()
call SetUnitState( u, UNIT_STATE_LIFE,r )
call SetUnitOwner( u, GetOwningPlayer(hero), true )
call SetUnitVertexColor( u, GetRandomInt(0, 100), GetRandomInt(0, 100), GetRandomInt(0, 100), 50 )
call IssueTargetOrder ( u, "attack", target )
call UnitApplyTimedLife (u,'BFig' ,5.00)
call CreateTextTagManaBurn( GetUnitName(target), l )
call RemoveLocation(l)
else
endif
if ( Level2() ) then
call CloneUnit( target, l )
set u = GetLastCreatedUnit()
call SetUnitState ( u,UNIT_STATE_LIFE, r )
call SetUnitOwner( u, GetOwningPlayer(hero), true )
call SetUnitVertexColor( u, GetRandomInt(0, 100), GetRandomInt(0, 100), GetRandomInt(0, 100), 50 )
call IssueTargetOrder( u, "attack", target )
call UnitApplyTimedLife (u,'BFig' ,7.00)
call CreateTextTagManaBurn( GetUnitName(target), l )
call RemoveLocation(l)
else
endif
if ( Level3() )then
call CloneUnit( target, l )
set u = GetLastCreatedUnit()
call SetUnitState( u, UNIT_STATE_LIFE, r)
call SetUnitOwner( u, GetOwningPlayer(hero), true )
call SetUnitVertexColor( u, GetRandomInt(0, 100), GetRandomInt(0, 100), GetRandomInt(0, 100), 50 )
call IssueTargetOrder (u, "attack", target )
call UnitApplyTimedLife (u,'BFig', 9.00)
call CreateTextTagManaBurn( GetUnitName(target), l )
call RemoveLocation(l)
else
endif
endfunction
//===========================================================================
private function Init takes nothing returns nothing
local trigger i = CreateTrigger()
call TriggerRegisterAnyUnitEventBJ( i, EVENT_PLAYER_UNIT_ATTACKED )
call TriggerAddCondition( i, Condition( function Conditions ) )
call TriggerAddAction( i, function Actions )
endfunction
endscope