Follow along with the video below to see how to install our site as a web app on your home screen.
Note: This feature may not be available in some browsers.
defend

Events


Unit - A unit is issued order with no target

Conditions


(Issued order) Equal to (Order(undefend))


(Unit-type of (Triggering unit)) Equal to Footman

Actions


Unit - Pause (Triggering unit)


Unit - Order (Triggering unit) to Human - Footman: Defend


Unit - Unpause (Triggering unit)
// Define globals
globals
constant integer unitId = 'hfoo'
constant integer defendId= 852055
constant integer undefendId = 852056
endglobals
// Conditions
function Conditions takes nothing returns boolean
return GetIssuedOrderId() == undefendId and GetUnitTypeId(GetTriggerUnit()) == unitId
endfunction
// Actions
function Permanent_defend takes nothing returns nothing
call PauseUnit( GetTriggerUnit(), true )
call IssueImmediateOrderById( GetTriggerUnit(), defendId )
call PauseUnit( GetTriggerUnit(), false )
endfunction
//===========================================================================
function InitTrig_Permanent_Defend takes nothing returns nothing
local trigger t = CreateTrigger( )
call TriggerRegisterAnyUnitEventBJ( t, EVENT_PLAYER_UNIT_ISSUED_ORDER )
call TriggerAddCondition( t, Condition( function Conditions ) )
call TriggerAddAction( t, function Permanent_defend )
set t = null
endfunction
Dr Super Good - Could you explain 1. in a more detailed way I'm not sure I understand all of it!
if GetRandomInt(0,4) < 2 then
//your 40% chance code goes here
endif
No one has bothered to write a tutorial on integers as they are so simple. You learn about them in math class (like at primary school).And could someone point me a Tutorial about Integers(how they work and how to use them)?!
Dr Super Good said:They are 32 bit signed (with two's compliment) giving them a range of possible values of -2^31 to +2^31-1.
)native RemoveLocation takes location whichLocation returns nothing
see this?Yeah, sorry about that, forgot the caps