A factory worker is an AI that moves to factory objects and frobs them to create copies of an object, usually a hammer. The script should be in a metaproperty named M-FactoryWorker. When the AI is alerted, it will stop work by removing the metaproperty. The model for the AI should not be carrying a hammer. An alternate model that shows the hammer is set in the metaproperty M-WithHammer. Actually, the normal model for the AI should be with a hammer, and the M-FactoryWorker metaproperty sets the model without a hammer. Otherwise, the AI will not be able to hit anything it tries to attack. If the AI is alerted while it isn’t holding a hammer, it will go to the marker where the hammers are dropped then pick one up. A different hammer-holding metaproperty can be used by linking to the metaproperty with a ScriptParams link that has the data set to WithHammer. This link can be set on the archetype of the AI. The AI will play motions when it does an action. If you are using custom motions, you can set which to use with parameters. The frobmotion parameter is played when the AI frobs a lever. Pickupmotion and dropmotion are played when the AI gets or drops a hammer.
Create a TrolPt that the worker will return to after completing an action. Link to the marker with Owns. Create another TrolPt that the worker will place the hammer at. Link from the first marker to the second with Route. Link the worker to the mold and the cauldron with Owns.
|Messages||ObjActResult, MotionEnd, Alertness, AIModeChange, Slain, Report|
|Links||Owns, Route, ScriptParams(WithHammer)|
|Objects||TrolPt, Molds, Hammers, SmeltingCauldr|
|Parameters||frobmotion (string), pickupmotion (string), dropmotion (string)|