1.
I've got a trigger that forces a unit to stop whenever it's given any order and it has a specific buff on it. For whatever reason though, it crashes WC3 when you just right click. Here's the code;
2.
The trigger below sets four points to random points on the map, unless the random points picked are in any of four specific regions. The coordinates are being randomised properly, but the global array variable () for those four points aren't being set to the randomised coordinates.
(yes, this trigger does get enabled)
I've done quite a bit of experimenting, and I really can't find the problem in my code. Could anyone shed some light on this?
Thanks in advance.
I've got a trigger that forces a unit to stop whenever it's given any order and it has a specific buff on it. For whatever reason though, it crashes WC3 when you just right click. Here's the code;
JASS:
function Trig_SPfrozen_Conditions takes nothing returns boolean
return((GetIssuedOrderId()!=852090)and(GetIssuedOrderId()!=852091)and(GetIssuedOrderId()!=852529)) //except magic shell and counterspell
endfunction
function Trig_SPfrozen_Actions takes nothing returns nothing
if ((GetUnitAbilityLevel(GetTriggerUnit(),039;B006039;) > 0)or(GetUnitAbilityLevel(GetTriggerUnit(),039;B007039;) > 0)) then
call IssueImmediateOrder(GetTriggerUnit(),"stop") //stop
endif
endfunction
function InitTrig_SPfrozen takes nothing returns nothing
set gg_trg_SPfrozen = CreateTrigger( )
call TriggerRegisterAnyUnitEventBJ( gg_trg_SPfrozen, EVENT_PLAYER_UNIT_ISSUED_TARGET_ORDER )
call TriggerRegisterAnyUnitEventBJ( gg_trg_SPfrozen, EVENT_PLAYER_UNIT_ISSUED_POINT_ORDER )
call TriggerRegisterAnyUnitEventBJ( gg_trg_SPfrozen, EVENT_PLAYER_UNIT_ISSUED_ORDER )
call TriggerAddCondition( gg_trg_SPfrozen, Condition( function Trig_SPfrozen_Conditions ) )
call TriggerAddAction( gg_trg_SPfrozen, function Trig_SPfrozen_Actions )
endfunction
2.
The trigger below sets four points to random points on the map, unless the random points picked are in any of four specific regions. The coordinates are being randomised properly, but the global array variable () for those four points aren't being set to the randomised coordinates.
JASS:
function Trig_UNITSPAWNffarandoms_Actions takes nothing returns nothing
local integer i = 1
local real x
local real y
local boolean b = false
loop
exitwhen i == 4
loop
exitwhen b == true
set x = GetRandomReal(-2650.,2650.)
set y = GetRandomReal(-3050.,2600.)
if ((RectContainsCoords(gg_rct_Region_000,x,y)==false)and(RectContainsCoords(gg_rct_Region_001,x,y)==false)and(RectContainsCoords(gg_rct_Region_002,x,y)==false)and(RectContainsCoords(gg_rct_Region_003,x,y)==false)) then
set b = true
endif
endloop
set udg_GAMEINIT_spawnpoint<i> = Location(x,y)
set i = i+1
endloop
endfunction
function InitTrig_UNITSPAWNffarandoms takes nothing returns nothing
set gg_trg_UNITSPAWNffarandoms = CreateTrigger( )
call DisableTrigger( gg_trg_UNITSPAWNffarandoms )
call TriggerRegisterTimerEventPeriodic( gg_trg_UNITSPAWNffarandoms, 0.50 )
call TriggerAddAction( gg_trg_UNITSPAWNffarandoms, function Trig_UNITSPAWNffarandoms_Actions )
endfunction</i>
(yes, this trigger does get enabled)
I've done quite a bit of experimenting, and I really can't find the problem in my code. Could anyone shed some light on this?
Thanks in advance.