require("PGStateMachine") function Definitions() DebugMessage("%s -- In definitions", tostring(Script)) ServiceRate = 1 Define_State("State_Init", State_Init); ability_range = 100 ability_name = "DRAIN_LIFE" end function State_Init(message) if message == OnEnter then -- Bail out if this is a human player if Object.Get_Owner().Is_Human() then ScriptExit() end -- prevent this from doing anything in galactic mode if Get_Game_Mode() ~= "Land" then ScriptExit() end Register_Prox(Object, Unit_Prox, ability_range) end end -- If an enemy enters the prox, zap them function Unit_Prox(self_obj, trigger_obj) if trigger_obj.Is_Category("Structure") then return end if not trigger_obj.Get_Owner().Is_Enemy(Object.Get_Owner()) then return end if trigger_obj.Get_Owner().Is_Enemy(Object.Get_Owner()) then if Object.Is_Ability_Ready(ability_name) then Object.Activate_Ability(ability_name, true) end end end