On off scripts
From Spring
---know and change the on off button state---
(from player or from script action)
- detect the switching of on/off button
local starton startoff
function script.Activate ( )
starton=1
end
function script.Deactivate ( )
startoff=1
end
- know the state of on/off
local isactive
isactive=GetUnitValue(1)
- change the on/off state(1=on,0=off)
local something
if something==true
then SetUnitValue (20,1)
else SetUnitValue (20,0)
end