Factory scripts: Difference between revisions
From Spring
Jump to navigationJump to search
exemple of factory |
|||
| (One intermediate revision by one other user not shown) | |||
| Line 1: | Line 1: | ||
<big>FACTORY SCRIPT</big> | <big>FACTORY SCRIPT</big> | ||
Factory are totally diferent synthax from mobile builder due to engine design: | :<sub>Factory are totally diferent synthax from mobile builder due to engine design:</sub> | ||
==Basic code== | |||
<code> | <code> | ||
: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 | |||
</code> | |||
note: if the pad piece is more high than ground then the unit will fall when completed | |||
===advanced script=== | |||
*can have arms with multiple nao emiter moving pad and checking the unit completion | |||
--UnitDef tag involvd in the factory :-- | |||
:Builder = 1,--the unit build some static or mobile units | |||
:WorkerTime = 999,--amount per second can be spent in build of metal & energy max | |||
:CanBeAssisted=1, | |||
:buildoptions = {product1,product2} | |||
[[Category:Emmanuel]] | |||
Latest revision as of 17:16, 8 March 2013
FACTORY SCRIPT
- Factory are totally diferent synthax from mobile builder due to engine design:
Basic code
- 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
advanced script
- can have arms with multiple nao emiter moving pad and checking the unit completion
--UnitDef tag involvd in the factory :--
- Builder = 1,--the unit build some static or mobile units
- WorkerTime = 999,--amount per second can be spent in build of metal & energy max
- CanBeAssisted=1,
- buildoptions = {product1,product2}