- Joined
- Mar 2, 2006
- Messages
- 36
Hi there,
Yesterday i noticed that my custom spell wasn't any good in triggers (well it would work perfectly if it wasn't for the two seconds wait, wich are unfortunally needed), so i have to make it jass, now the thing is i have been reading tutorials and stuff but this stays my first time with jass.
I have a c# knowledge so the syntax in general isn't any problem, but the problem is i don't see the link to triggers in wc III. So I've been tyring to make this thing with local variables because everyone keeps saying that, and i understand why.
But how do i start, do i have to put everything under one function instead of seperate? Becuase i tried to declare variables but then i need to 'take' them in the other functions, but u can't do that with arrays.
Also i can't declaire them in each function becuase that wouldn't help a thing. So do i have to make a main function that call's all seperate ones in a row and declare my variables there?
Anyway it would be nice if sombody could give me a push in the right direction. (these are two triggers btw the second one starts from the comment line //=====ACTIONS======)
EDIT: some quick info about the spell, its a target dummy summoned at the location a player clicks for his spell. It taunts units nearby (not using the taunt ability that seems to bug allot) by taking all units in a range that are enemy of casting unit and ordering them to attack the dummy. Then it waits two seconds and 'explodes' (meaning destroying the barrel of explosives and casting the tauren war stomp) dealing damage and stunning.
thx in advance
Hoplitespear
PS: u can find the triggers at these two links
http://users.telenet.be/hoplitespear/HIVE/main.bmp
http://users.telenet.be/hoplitespear/HIVE/actions.bmp
Yesterday i noticed that my custom spell wasn't any good in triggers (well it would work perfectly if it wasn't for the two seconds wait, wich are unfortunally needed), so i have to make it jass, now the thing is i have been reading tutorials and stuff but this stays my first time with jass.
I have a c# knowledge so the syntax in general isn't any problem, but the problem is i don't see the link to triggers in wc III. So I've been tyring to make this thing with local variables because everyone keeps saying that, and i understand why.
But how do i start, do i have to put everything under one function instead of seperate? Becuase i tried to declare variables but then i need to 'take' them in the other functions, but u can't do that with arrays.
Also i can't declaire them in each function becuase that wouldn't help a thing. So do i have to make a main function that call's all seperate ones in a row and declare my variables there?
Anyway it would be nice if sombody could give me a push in the right direction. (these are two triggers btw the second one starts from the comment line //=====ACTIONS======)
EDIT: some quick info about the spell, its a target dummy summoned at the location a player clicks for his spell. It taunts units nearby (not using the taunt ability that seems to bug allot) by taking all units in a range that are enemy of casting unit and ordering them to attack the dummy. Then it waits two seconds and 'explodes' (meaning destroying the barrel of explosives and casting the tauren war stomp) dealing damage and stunning.
thx in advance
Hoplitespear
PS: u can find the triggers at these two links
http://users.telenet.be/hoplitespear/HIVE/main.bmp
http://users.telenet.be/hoplitespear/HIVE/actions.bmp
Code:
function Trig_target_dummy_Conditions takes nothing returns boolean
if ( not ( GetSpellAbilityId() == 'A00K' ) ) then
return false
endif
return true
endfunction
function Trig_target_dummy_Func004001003 takes nothing returns boolean
return ( GetUnitTypeId(GetFilterUnit()) == 'o00K' )
endfunction
function Trig_target_dummy_Func004Func006001003 takes nothing returns boolean
return ( IsUnitEnemy(GetFilterUnit(), GetOwningPlayer(udg_TDCaster)) == true )
endfunction
function Trig_target_dummy_Func004Func006Func001C takes nothing returns boolean
if ( not ( IsUnitType(GetEnumUnit(), UNIT_TYPE_STRUCTURE) == false ) ) then
return false
endif
if ( not ( IsUnitAliveBJ(GetEnumUnit()) == true ) ) then
return false
endif
return true
endfunction
function Trig_target_dummy_Func004Func006A takes nothing returns nothing
if ( Trig_target_dummy_Func004Func006Func001C() ) then
set udg_TDX = ( udg_TDX + 1 )
set udg_TDTargets[udg_TDX] = GetEnumUnit()
else
call DoNothing( )
endif
endfunction
function Trig_target_dummy_Func004A takes nothing returns nothing
set udg_TDTaunter = GetEnumUnit()
call AddSpecialEffectLocBJ( GetUnitLoc(udg_TDTaunter), "Abilities\\Spells\\NightElf\\Taunt\\TauntCaster.mdl" )
call DestroyEffectBJ( GetLastCreatedEffectBJ() )
call AddSpecialEffectLocBJ( GetUnitLoc(udg_TDTaunter), "Units\\Other\\TNTBarrel\\TNTBarrel.mdl" )
set udg_bomb = GetLastCreatedEffectBJ()
call ForGroupBJ( GetUnitsInRangeOfLocMatching(udg_ZapSlamRange, GetUnitLoc(udg_TDCaster), Condition(function Trig_target_dummy_Func004Func006001003)), function Trig_target_dummy_Func004Func006A )
endfunction
function Trig_target_dummy_Actions takes nothing returns nothing
set udg_TDCaster = GetSpellAbilityUnit()
set udg_TDX = 0
set udg_TDY = 0
call ForGroupBJ( GetUnitsInRangeOfLocMatching(3000.00, GetUnitLoc(udg_TDCaster), Condition(function Trig_target_dummy_Func004001003)), function Trig_target_dummy_Func004A )
set udg_TDGroup = GetLastCreatedGroup()
call GroupClear( udg_TDGroup )
call EnableTrigger( gg_trg_TD_Actions )
endfunction
//===========================================================================
function InitTrig_target_dummy takes nothing returns nothing
set gg_trg_target_dummy = CreateTrigger( )
call TriggerRegisterAnyUnitEventBJ( gg_trg_target_dummy, EVENT_PLAYER_UNIT_SPELL_FINISH )
call TriggerAddCondition( gg_trg_target_dummy, Condition( function Trig_target_dummy_Conditions ) )
call TriggerAddAction( gg_trg_target_dummy, function Trig_target_dummy_Actions )
endfunction
//=================ACTIONS=====================================
function Trig_TD_Actions_Func003C takes nothing returns boolean
if ( not ( udg_TDY >= udg_TDX ) ) then
return false
endif
return true
endfunction
function Trig_TD_Actions_Actions takes nothing returns nothing
set udg_TDY = ( udg_TDY + 1 )
call IssueTargetOrderBJ( udg_TDTargets[udg_TDY], "attack", udg_TDTaunter )
if ( Trig_TD_Actions_Func003C() ) then
call CreateNUnitsAtLocFacingLocBJ( 1, 'n003', GetOwningPlayer(udg_TDCaster), GetUnitLoc(udg_TDTaunter), GetUnitLoc(udg_TDTaunter) )
call SetUnitAbilityLevelSwapped( 'A00M', GetLastCreatedUnit(), GetUnitAbilityLevelSwapped('A00K', udg_TDCaster) )
set udg_dummy = GetLastCreatedUnit()
call TriggerSleepAction( 2.00 )
call IssueImmediateOrderBJ( udg_dummy, "stomp" )
call DestroyEffectBJ( udg_bomb )
call ExplodeUnitBJ( udg_TDTaunter )
call RemoveUnit( udg_dummy )
call DisableTrigger( gg_trg_TD_Actions )
else
call DoNothing( )
endif
endfunction
//===========================================================================
function InitTrig_TD_Actions takes nothing returns nothing
set gg_trg_TD_Actions = CreateTrigger( )
call DisableTrigger( gg_trg_TD_Actions )
call TriggerRegisterTimerEventPeriodic( gg_trg_TD_Actions, 0.10 )
call TriggerAddAction( gg_trg_TD_Actions, function Trig_TD_Actions_Actions )
endfunction