Factory scripts

From Spring
Revision as of 21:17, 10 November 2012 by Emmanuel (talk | contribs) (exemple of factory)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigationJump to search

FACTORY SCRIPT Factory are totally diferent synthax from mobile builder due to engine design:

local pad = piece "pad" --piece where the unit build is landed 

local nano = piece "nano" --piece where the nano particule come from

function script.QueryBuildInfo ( ) return pad end
function script.QueryNanoPiece ( ) return nano end
function script.Activate()
StartThread( product )
end
function product()
Signal(1)
SetSignalMask(1)
SetUnitValue ( 19,1)--ask evacuate area
SetUnitValue ( 18,1)--switch the UnitDef Yardmap to open
SetUnitValue ( 5,1)--start nano
return 1
end
function script.Deactivate() 
StartThread( endproduct )
end
function endproduct()
Signal(1)
SetSignalMask(1)
SetUnitValue ( 5,0)--end nano
SetUnitValue ( 18,0)--switch the UnitDef Yardmap to close
SetUnitValue ( 19,0)--stop to ask evacuate area
return 0
end

note: if the pad piece is more high than ground then the unit will fall when completed