- Joined
- May 4, 2007
- Messages
- 2,260
Guys i am making an amour that gives 7% chance to root an melle attacker. However i don't know what i am doing (lol) ...
I did it in GUI and converted to JASS but i think my JASS modifications don't work .. can you help me ?
GUI converted Script:
And here is my script, 100 smaller and i think it doesn't work ... and it has BJ's i don't know how to remove ... and DOES IT LEAK ? very important i need to know plz ... =s _:
Any help ? plz ?
I did it in GUI and converted to JASS but i think my JASS modifications don't work .. can you help me ?
GUI converted Script:
JASS:
function Trig_Jungle_armor_Func002C takes nothing returns boolean
if ( not ( IsUnitType(GetAttackedUnitBJ(), UNIT_TYPE_HERO) == true ) ) then
return false
endif
if ( not ( UnitHasItemOfTypeBJ(GetAttackedUnitBJ(), 'I013') == true ) ) then
return false
endif
if ( not ( IsUnitType(GetAttacker(), UNIT_TYPE_MELEE_ATTACKER) == true ) ) then
return false
endif
return true
endfunction
function Trig_Jungle_armor_Conditions takes nothing returns boolean
if ( not Trig_Jungle_armor_Func002C() ) then
return false
endif
return true
endfunction
function Trig_Jungle_armor_Func001C takes nothing returns boolean
if ( not ( 7 >= GetRandomInt(1, 100) ) ) then
return false
endif
return true
endfunction
function Trig_Jungle_armor_Actions takes nothing returns nothing
if ( Trig_Jungle_armor_Func001C() ) then
call CreateNUnitsAtLoc( 1, 'h01H', GetOwningPlayer(GetAttackedUnitBJ()), GetUnitLoc(GetAttacker()), bj_UNIT_FACING )
call UnitApplyTimedLifeBJ( 2.50, 'BTLF', GetLastCreatedUnit() )
call UnitAddAbilityBJ( 'A00P', GetLastCreatedUnit() )
call SetUnitAbilityLevelSwapped( 'A00P', GetLastCreatedUnit(), 2 )
call IssueTargetOrderBJ( GetLastCreatedUnit(), "entanglingroots", GetAttacker() )
else
endif
endfunction
//===========================================================================
function InitTrig_Jungle_armor takes nothing returns nothing
set gg_trg_Jungle_armor = CreateTrigger( )
call TriggerRegisterAnyUnitEventBJ( gg_trg_Jungle_armor, EVENT_PLAYER_UNIT_ATTACKED )
call TriggerAddCondition( gg_trg_Jungle_armor, Condition( function Trig_Jungle_armor_Conditions ) )
call TriggerAddAction( gg_trg_Jungle_armor, function Trig_Jungle_armor_Actions )
endfunction
And here is my script, 100 smaller and i think it doesn't work ... and it has BJ's i don't know how to remove ... and DOES IT LEAK ? very important i need to know plz ... =s _:
JASS:
function JungleArmor_Conds takes nothing returns boolean
local integer rootchance = 7
return GetRandomInt(1, 100) <= rootchance and IsUnitType(GetTriggerUnit(), UNIT_TYPE_HERO) and UnitHasItemOfTypeBJ(GetTriggerUnit(), 'I013') and IsUnitType(GetAttacker(), UNIT_TYPE_MELEE_ATTACKER)
endfunction
//======================================================================================================================================================================================================================
function JungleArmor_Acts takes nothing returns nothing
local unit victim = GetTriggerUnit()
local unit attacker = GetAttacker()
local unit dummy = CreateUnit( GetOwningPlayer(victim), 'h01H', GetUnitX(attacker), GetUnitY(attacker), 0)
call UnitApplyTimedLife(dummy, 'BTLF', 2.5)
call UnitAddAbility(dummy, 'A00P')
call SetUnitAbilityLevel(dummy, 'A00P', 2)
call IssueTargetOrder(dummy, "entanglingroots", attacker)
set victim = null
set attacker = null
set dummy = null
endfunction
//===========================================================================
function InitTrig_Jungle_armour takes nothing returns nothing
local trigger JungleArmor = CreateTrigger( )
call TriggerRegisterAnyUnitEventBJ( JungleArmor, EVENT_PLAYER_UNIT_ATTACKED )
call TriggerAddCondition( JungleArmor, Condition( function JungleArmor_Conds ) )
call TriggerAddAction( JungleArmor, function JungleArmor_Acts )
endfunction
Any help ? plz ?