1. Is there a way to enable a trigger inside the same script?
Example triggers:
But i can only do that is they are in diferent triggers(CTRL + T)
There is a way to do it in the same trigger?
2. GetUnitsInRangeOfLocMatching, CountUnitsInGroup, GroupPickRandomUnit, GetUnitsInRangeOfLocMatching inline or use them?
3. What is a boolexpr? And a pooledwait?
4. Why those trigger don't work?
My bet is that there is no TriggerUnit so Caster = null.
But if its realy this i don't know how to make it. i.i
I was tinking if i make it a loop with wait will be better than a periodic event but not sure.
Sorry if i am asking to much. =/
Example triggers:
JASS:
scope lol initializer Initial
private function Actions takes nothing returns nothing
call EnableTrigger( gg_trg_Untitled_Trigger_002 )
endfunction
private function Initial takes nothing returns nothing
local trigger trig = CreateTrigger()
call TriggerAddAction( trig, function Actions )
set trig = null
endfunction
endscope
JASS:
scope lol2 initializer Initial
private function Actions takes nothing returns nothing
call EnableTrigger( gg_trg_Untitled_Trigger_003 )
endfunction
private function Initial takes nothing returns nothing
local trigger trig = CreateTrigger()
call TriggerAddAction( trig, function Actions )
set trig = null
endfunction
endscope
But i can only do that is they are in diferent triggers(CTRL + T)
There is a way to do it in the same trigger?
2. GetUnitsInRangeOfLocMatching, CountUnitsInGroup, GroupPickRandomUnit, GetUnitsInRangeOfLocMatching inline or use them?
3. What is a boolexpr? And a pooledwait?
4. Why those trigger don't work?
JASS:
scope DarkRageInitial initializer Initial
globals
integer AttacksNumberCounter = 0
unit Caster = GetTriggerUnit()
endglobals
private function Conditions takes nothing returns boolean
return GetSpellAbilityId() == 039;A007039;
endfunction
private function Actions takes nothing returns nothing
call EnableTrigger( gg_trg_Untitled_Trigger_002 )
endfunction
private function Initial takes nothing returns nothing
local trigger trig = CreateTrigger()
call TriggerRegisterAnyUnitEventBJ( trig, EVENT_PLAYER_UNIT_SPELL_EFFECT )
call TriggerAddCondition( trig, Condition( function Conditions ) )
call TriggerAddAction( trig, function Actions )
set trig = null
endfunction
endscope
JASS:
scope DarkRageAttacks initializer Initial
private function TargetAndGroupConditions takes nothing returns boolean
return IsUnitEnemy( GetFilterUnit(), GetOwningPlayer( Caster ) ) == true and IsUnitType(GetFilterUnit(), UNIT_TYPE_STRUCTURE ) == false and GetUnitState( GetFilterUnit(), UNIT_STATE_LIFE ) <= 0
endfunction
private function DarkRageAttack takes nothing returns nothing
local location CasterLoc = GetUnitLoc( Caster )
local group PossibleTargets = GetUnitsInRangeOfLocMatching(500.00, CasterLoc, Condition( function TargetAndGroupConditions ) )
local integer NOfPossibleTargets = CountUnitsInGroup(PossibleTargets)
local unit Target = GroupPickRandomUnit( GetUnitsInRangeOfLocMatching(500.00, CasterLoc, Condition( function TargetAndGroupConditions ) ) )
local location TargetLoc = GetUnitLoc( Target )
local real x = GetLocationX( TargetLoc ) + 50.00 * Cos(GetRandomReal(0, 360) * bj_DEGTORAD)
local real y = GetLocationY( TargetLoc ) + 50.00 * Sin(GetRandomReal(0, 360) * bj_DEGTORAD)
local location AttackLandingLoc = Location(x,y)
set AttacksNumberCounter = ( AttacksNumberCounter + 1 )
if ( NOfPossibleTargets == 0 ) then
else
call UnitDamageTarget( Caster, Target, 300.00, true, false, ATTACK_TYPE_HERO, DAMAGE_TYPE_NORMAL, WEAPON_TYPE_METAL_LIGHT_CHOP )
call SetUnitPositionLoc( Caster, AttackLandingLoc )
endif
endfunction
private function DarkSlamUse takes nothing returns nothing
local real x = GetUnitX( Caster )
local real y = GetUnitY( Caster )
local unit Dummy = CreateUnit( GetOwningPlayer( Caster ), 039;u001039;, x, y, 0.00 )
call UnitApplyTimedLife( Dummy, 039;BTLF039;, 5.00 )
call UnitAddAbility( Dummy, 039;A006039; )
call SetUnitAbilityLevel( Dummy, 039;A006039;, 2 )
call IssueImmediateOrder( Dummy, "thundercalp" )
call DestroyEffect( AddSpecialEffectLoc( "Abilities\\Spells\\Human\\Thunderclap\\ThunderClapCaster.mdl", GetUnitLoc( Dummy ) ) )
set Dummy = null
endfunction
private function ZeroAttacksNumberCounter takes nothing returns nothing
set AttacksNumberCounter = 0
endfunction
private function Actions takes nothing returns nothing
if (AttacksNumberCounter == ( 1 + ( 2 * GetUnitAbilityLevel( Caster, 039;A007039; ) ) ) ) then
call ZeroAttacksNumberCounter()
if ( GetUnitAbilityLevel( Caster, 039;B004039; ) > 0 ) then
call EnableTrigger( gg_trg_Untitled_Trigger_003 )
endif
call DarkSlamUse()
else
call DarkRageAttack()
endif
endfunction
private function Initial takes nothing returns nothing
local trigger trig = CreateTrigger()
call TriggerRegisterTimerEvent( trig, 0.45, true )
call TriggerAddAction( trig, function Actions )
set trig = null
endfunction
endscope
JASS:
scope DarkRageInsanityShout initializer Initial
private function Actions takes nothing returns nothing
local real x = GetUnitX( Caster )
local real y = GetUnitY( Caster )
local unit Dummy = CreateUnit( GetOwningPlayer( Caster ), 039;u001039;, x, y, 0.00 )
if ( GetUnitAbilityLevel( Caster, 039;B004039; ) > 0 ) then
call UnitApplyTimedLife( Dummy, 039;BTLF039;, 5.00 )
call UnitAddAbility( Dummy, 039;A006039; )
call SetUnitAbilityLevel( Dummy, 039;A006039;, 2 )
call IssueImmediateOrder( Dummy, "stomp" )
call DestroyEffect( AddSpecialEffectLoc( "Abilities\\Spells\\Other\\HowlOfTerror\\HowlCaster.mdl", GetUnitLoc( Dummy ) ) )
endif
set Dummy = null
endfunction
private function Initial takes nothing returns nothing
local trigger trig = CreateTrigger()
call TriggerRegisterTimerEvent( trig, 0.45, false )
call TriggerAddAction( trig, function Actions )
set trig = null
endfunction
endscope
My bet is that there is no TriggerUnit so Caster = null.
But if its realy this i don't know how to make it. i.i
I was tinking if i make it a loop with wait will be better than a periodic event but not sure.
Sorry if i am asking to much. =/