| 03-19-2009, 05:43 PM | #1 |
So I've been working on this AoS. It spawns units from the barracks, which trains them normally, like so: Trigger: JASS:function Trig_Blue_Units_Actions takes nothing returns nothing local unit first = GetTrainedUnit() local integer SpawnTypez = GetUnitTypeId(first) local location red = GetRectCenter(gg_rct_Blue_Return) local location grey = GetRectCenter(gg_rct_Orange_Barracks) local location brown = GetRectCenter(gg_rct_Blue_Return) local unit second = CreateUnitAtLoc( Player(4), SpawnTypez, grey, 0 ) call SetUnitOwner( first, Player(4), true ) call IssuePointOrderLoc( first, "attack", brown ) call SetUnitUserData( first, 2 ) call IssuePointOrderLoc( second, "attack", red ) call SetUnitUserData( second, 3 ) call RemoveLocation(brown) call RemoveLocation(grey) call RemoveLocation(red) set first = null set red = null set grey = null set brown = null set second = null endfunction //=========================================================================== function InitTrig_Blue_Units takes nothing returns nothing set gg_trg_Blue_Units = CreateTrigger( ) call TriggerRegisterUnitEvent( gg_trg_Blue_Units, gg_unit_h001_0021, EVENT_UNIT_TRAIN_FINISH ) call TriggerRegisterUnitEvent( gg_trg_Blue_Units, gg_unit_h001_0022, EVENT_UNIT_TRAIN_FINISH ) call TriggerRegisterUnitEvent( gg_trg_Blue_Units, gg_unit_h001_0023, EVENT_UNIT_TRAIN_FINISH ) call TriggerAddAction( gg_trg_Blue_Units, function Trig_Blue_Units_Actions ) endfunction But the problem is, a lot of the units keep running back to the spawn points. The rally is off somewhere else, so I don't think it's that, and I think it's only the units that are actually trained, but I'm not sure. They'll attack enemies that get near them, but they won't actually follow their path. It's really irritating, and I think it increases in frequency as the game goes on. Here's some more triggers that I made to help deal with the problem (They don't do a very good job), in case that helps. JASS:function Trig_Follow_Path_Conditions takes nothing returns boolean return (GetPlayerController(GetOwningPlayer(GetTriggerUnit())) == MAP_CONTROL_COMPUTER) endfunction function Trig_Follow_Path_Actions takes nothing returns nothing local unit u = GetTriggerUnit() local location loc if GetUnitUserData(u) == 1 then // Attacking Blue Team set loc = Location(GetRectCenterX(gg_rct_Blue_Return), GetRectCenterY(gg_rct_Blue_Return)) call IssuePointOrderLoc(u, "attack", loc) endif if GetUnitUserData(u) == 2 then // Attacking Green Team set loc = Location(GetRectCenterX(gg_rct_Green_Return), GetRectCenterY(gg_rct_Green_Return)) call IssuePointOrderLoc(u, "attack", loc) endif if GetUnitUserData(u) == 3 then //Attacking Red Team set loc = Location(GetRectCenterX(gg_rct_Pink_attack_move), GetRectCenterY(gg_rct_Pink_attack_move)) call IssuePointOrderLoc(u, "attack", loc) endif call RemoveLocation(loc) set loc = null set u = null endfunction //=========================================================================== function InitTrig_Follow_Path takes nothing returns nothing set gg_trg_Follow_Path = CreateTrigger( ) call TriggerRegisterEnterRectSimple( gg_trg_Follow_Path, gg_rct_Pink_Return ) call TriggerAddCondition( gg_trg_Follow_Path, Condition( function Trig_Follow_Path_Conditions ) ) call TriggerAddAction( gg_trg_Follow_Path, function Trig_Follow_Path_Actions ) endfunction Can someone help? It really messes with the balance. |
