![]() |
How to Rebuild Something with Scripting - Printable Version +- 2DWorlds Forums (http://2dworlds.buildism.net/forum) +-- Forum: 2DWorlds (http://2dworlds.buildism.net/forum/forumdisplay.php?fid=4) +--- Forum: 2DWorlds Discussion (http://2dworlds.buildism.net/forum/forumdisplay.php?fid=10) +---- Forum: Tutorials and Guides (http://2dworlds.buildism.net/forum/forumdisplay.php?fid=20) +---- Thread: How to Rebuild Something with Scripting (/showthread.php?tid=1254) |
How to Rebuild Something with Scripting - Jacob__mybb_import1 - 02-03-2011 When something is exploded or otherwise destroyed, it isn't going to go back together! This can be a problem, and will be even more important once multiplayer is released. But don't worry, using Lua scripting (especially the clone() function) you can backup and restore anything you'd like! First, you should add the parts you want to backup to a model (Buildism's way of grouping similar items.) This can be accomplished by using the Group button in the toolbar. Once you have your model, rename it to give it a more descriptive name: select it in the navigator, then change the Name property in the properties panel (lower left corner.) If you want to make a rebuild button, make a box (preferably fixed and noncollidable) and insert a script into it. To insert a script, select the box then click Edit>Insert Object, select Script, and click OK. Double click the script to edit it, then copy and paste the following code: Code: model = game.World.YourModelName --Path to the model With some modifications, you can use the same kind of script to make a model rebuild every few minutes, or when a player types something in the chat box. |