I have a Knockback spell And I wish to convert it to JASS. I want to use local variables to make it MUI.
heres my triggers
And here it is converted to JASS
How would I change them to use local variables?
heres my triggers
Code:
Bloodwind
Events
Unit - A unit Starts the effect of an ability
Conditions
(Ability being cast) Equal to Bloodwind I
Actions
Set Caster = (Casting unit)
Unit Group - Pick every unit in (Units within 512.00 of (Position of Caster) matching (((Owner of (Matching unit)) controller) Equal to Computer)) and do (Actions)
Loop - Actions
Unit - Create 1 Dummy for Player 1 (Red) at (Position of (Picked unit)) facing (Position of (Casting unit))
Unit - Add a 1.50 second Generic expiration timer to (Last created unit)
Unit - Cause (Last created unit) to damage (Picked unit), dealing 800.00 damage of attack type Spells and damage type Lightning
Set target = (Units within 512.00 of (Position of Caster) matching (((Owner of (Matching unit)) controller) Equal to Computer))
Set BloodwindTimer = 0.00
Trigger - Turn on BloodwindKnockback <gen>
BloodwindKnockback
Events
Time - Every 0.01 seconds of game time
Conditions
Actions
Set BloodwindTimer = (BloodwindTimer + 1.00)
Unit Group - Pick every unit in (Units in (Playable map area) matching (((Matching unit) is in target) Equal to True)) and do (Actions)
Loop - Actions
Unit - Move (Picked unit) instantly to ((Position of (Picked unit)) offset by 10.00 towards (Angle from (Position of Caster) to (Position of (Picked unit))) degrees)
If (BloodwindTimer Greater than or equal to 51.00) then do (Trigger - Turn off (This trigger)) else do (Do nothing)
And here it is converted to JASS
JASS:
function Trig_Bloodwind_Conditions takes nothing returns boolean
if ( not ( GetSpellAbilityId() == 'A009' ) ) then
return false
endif
return true
endfunction
function Trig_Bloodwind_Func002001003 takes nothing returns boolean
return ( GetPlayerController(GetOwningPlayer(GetFilterUnit())) == MAP_CONTROL_COMPUTER )
endfunction
function Trig_Bloodwind_Func002Func004002003 takes nothing returns boolean
return ( GetPlayerController(GetOwningPlayer(GetFilterUnit())) == MAP_CONTROL_COMPUTER )
endfunction
function Trig_Bloodwind_Func002A takes nothing returns nothing
call CreateNUnitsAtLocFacingLocBJ( 1, 'h000', Player(0), GetUnitLoc(GetEnumUnit()), GetUnitLoc(GetSpellAbilityUnit()) )
call UnitApplyTimedLifeBJ( 1.50, 'BTLF', GetLastCreatedUnit() )
call UnitDamageTargetBJ( GetLastCreatedUnit(), GetEnumUnit(), 800.00, ATTACK_TYPE_NORMAL, DAMAGE_TYPE_LIGHTNING )
set udg_target = GetUnitsInRangeOfLocMatching(512, GetUnitLoc(udg_Caster), Condition(function Trig_Bloodwind_Func002Func004002003))
endfunction
function Trig_Bloodwind_Actions takes nothing returns nothing
set udg_Caster = GetSpellAbilityUnit()
call ForGroupBJ( GetUnitsInRangeOfLocMatching(512, GetUnitLoc(udg_Caster), Condition(function Trig_Bloodwind_Func002001003)), function Trig_Bloodwind_Func002A )
set udg_BloodwindTimer = 0.00
call EnableTrigger( gg_trg_BloodwindKnockback )
endfunction
//===========================================================================
function InitTrig_Bloodwind takes nothing returns nothing
set gg_trg_Bloodwind = CreateTrigger( )
call TriggerRegisterAnyUnitEventBJ( gg_trg_Bloodwind, EVENT_PLAYER_UNIT_SPELL_EFFECT )
call TriggerAddCondition( gg_trg_Bloodwind, Condition( function Trig_Bloodwind_Conditions ) )
call TriggerAddAction( gg_trg_Bloodwind, function Trig_Bloodwind_Actions )
endfunction
JASS:
function Trig_BloodwindKnockback_Func002001002 takes nothing returns boolean
return ( IsUnitInGroup(GetFilterUnit(), udg_target) == true )
endfunction
function Trig_BloodwindKnockback_Func002Func002001 takes nothing returns boolean
return ( udg_BloodwindTimer >= 51.00 )
endfunction
function Trig_BloodwindKnockback_Func002A takes nothing returns nothing
call SetUnitPositionLoc( GetEnumUnit(), PolarProjectionBJ(GetUnitLoc(GetEnumUnit()), 10.00, AngleBetweenPoints(GetUnitLoc(udg_Caster), GetUnitLoc(GetEnumUnit()))) )
if ( Trig_BloodwindKnockback_Func002Func002001() ) then
call DisableTrigger( GetTriggeringTrigger() )
else
call DoNothing( )
endif
endfunction
function Trig_BloodwindKnockback_Actions takes nothing returns nothing
set udg_BloodwindTimer = ( udg_BloodwindTimer + 1 )
call ForGroupBJ( GetUnitsInRectMatching(GetPlayableMapRect(), Condition(function Trig_BloodwindKnockback_Func002001002)), function Trig_BloodwindKnockback_Func002A )
endfunction
//===========================================================================
function InitTrig_BloodwindKnockback takes nothing returns nothing
set gg_trg_BloodwindKnockback = CreateTrigger( )
call DisableTrigger( gg_trg_BloodwindKnockback )
call TriggerRegisterTimerEventPeriodic( gg_trg_BloodwindKnockback, 0.01 )
call TriggerAddAction( gg_trg_BloodwindKnockback, function Trig_BloodwindKnockback_Actions )
endfunction