/********************************************************
* *
* gg_unit_hfoo_0000 = Footman placed in the editor. *
* *
*********************************************************/
scope S initializer sInit
globals
private trigger trgMakeIgnore = CreateTrigger() // This trigger makes the Footman run to the center of the map, making it ignore user input. "1" in chat runs it.
private trigger trgMakeObey = CreateTrigger() // This trigger gives control over the Footman again. "2" in chat runs it.
endglobals
private function TrgMakeIgnoreActions takes nothing returns nothing
local rect r = GetWorldBounds()
local location loc = Location(GetRectCenterX(r), GetRectCenterY(r))
call IssuePointOrderLoc(gg_unit_hfoo_0000, "move", loc)
call RemoveLocation(loc)
call BlzUnitDisableAbility(gg_unit_hfoo_0000, 'Amov', false, true) // This one hides Move, Hold Position, and Patrol.
call BlzUnitDisableAbility(gg_unit_hfoo_0000, 'Aatk', false, true) // This one hides Stop, and Attack.
call BlzUnitDisableAbility(gg_unit_hfoo_0000, 'Adef', false, true) // This one hides Defend. Any additional ability the unit has should be added in the same fashion.
endfunction
private function TrgMakeObeyActions takes nothing returns nothing
call BlzUnitDisableAbility(gg_unit_hfoo_0000, 'Amov', false, false) // Giving abilities back once more... Move, Hold Position, Patrol
call BlzUnitDisableAbility(gg_unit_hfoo_0000, 'Aatk', false, false) // Stop, Attack
call BlzUnitDisableAbility(gg_unit_hfoo_0000, 'Adef', false, false) // Defend
endfunction
private function sInit takes nothing returns nothing
local fogmodifier allVision = CreateFogModifierRect(Player(0), FOG_OF_WAR_VISIBLE, GetWorldBounds(), true, false) // This line and the next just gives vision across the map.
call FogModifierStart(allVision)
call SetPlayerTechResearched(Player(0), 'Rhde', 1) // Researching Defend for the Footman.
call TriggerRegisterPlayerChatEvent(trgMakeIgnore, Player(0), "1", true) // Setting up triggers from here on.
call TriggerAddAction(trgMakeIgnore, function TrgMakeIgnoreActions)
call TriggerRegisterPlayerChatEvent(trgMakeObey, Player(0), "2", true)
call TriggerAddAction(trgMakeObey, function TrgMakeObeyActions)
endfunction
endscope