Welcome, Guest |
You have to register before you can post on our site.
|
Forum Statistics |
» Members: 8,079
» Latest member: seanac11
» Forum threads: 10,350
» Forum posts: 91,276
Full Statistics
|
Online Users |
There are currently 218 online users. » 0 Member(s) | 216 Guest(s) Bing, Google
|
Latest Threads |
I'm leaving the site too....
Forum: 2DWorlds Discussion
Last Post: Jacob_
07-03-2023, 04:59 AM
» Replies: 12
» Views: 5,971
|
hi there.
Forum: 2DWorlds Discussion
Last Post: Jacob_
01-03-2020, 04:30 AM
» Replies: 1
» Views: 684
|
obroke
Forum: Current Games
Last Post: FrancisSah
09-06-2017, 10:11 AM
» Replies: 0
» Views: 20,497
|
fcouldn't
Forum: Current Games
Last Post: FrancisSah
09-06-2017, 09:02 AM
» Replies: 0
» Views: 8,204
|
qhow
Forum: Current Games
Last Post: PhilipShums
09-06-2017, 07:25 AM
» Replies: 0
» Views: 2,068
|
zstone
Forum: Current Games
Last Post: TimothyTox
09-06-2017, 07:03 AM
» Replies: 0
» Views: 947
|
vbit
Forum: Current Games
Last Post: FrancisSah
09-06-2017, 03:00 AM
» Replies: 0
» Views: 927
|
sildenafil 100 mg sandoz
Forum: Current Games
Last Post: RichardLen
09-06-2017, 12:28 AM
» Replies: 0
» Views: 1,136
|
mhis
Forum: Current Games
Last Post: TimothyTox
09-05-2017, 04:09 PM
» Replies: 0
» Views: 949
|
sildenafil citrate 100mg ...
Forum: Current Games
Last Post: Waltertog
09-05-2017, 12:27 PM
» Replies: 0
» Views: 907
|
|
|
How to Rebuild Something with Scripting |
Posted by: Jacob__mybb_import1 - 02-03-2011, 11:05 PM - Forum: Tutorials and Guides
- No Replies
|
 |
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
message = "Rebuilding..." --Message to show while rebuilding
backup = model:clone() --Make a backup
enabled = true
link(script.Parent.Clicked, function(player, btn) --Called when the box is clicked
if not enabled then return end
enabled = false
script.Parent.Color = Color(127, 127, 127)
local copy = backup:clone() --Make a copy of the backup
model:remove() --Remove original
game:message(message)
sleep(2) --Wait for 2 seconds
game.TaskScheduler:schedule(function() --Using TaskScheduler ensures that nothing moves in the middle of the script
copy.Parent = game.World --Add the copy we created to the world
copy:makeJoints() --Recreate any welds or hinges that were in the original
end)
model = copy --Change our variable to point to the new model
game:message() --Clear the message
sleep(3)
enabled = true --Make the button clickable again
script.Parent.Color = Color(0, 102, 255)
end)
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.
|
|
|
2/2/11 |
Posted by: Jacob__mybb_import1 - 02-03-2011, 12:42 AM - Forum: News
- Replies (3)
|
 |
- Fragmenting parts no longer violate the law of conservation of matter
- _G now has the same behavior as in standard Lua
- Copying and pasting a model now also copies the welds/hinges between any parts in the model
- Fixed a bug that would rarely cause the game to crash when loading a game containing welds or hinges from a file
|
|
|
I'm trying to make a gun.... |
Posted by: sckum555 - 02-02-2011, 06:37 PM - Forum: Scripting
- Replies (1)
|
 |
Code: function mouseDown()
local bullet = create("Cirle")
c.Radius = 2
c.Position = script.Parent.Handle.Position
c.Name = "Bullet"
c.Parent = game.World
local rocket = create("Rocket")
rocket.Parent = bullet
end
link(script.Parent.MouseDown, mouseDown)
It doesn't work... It's my first time scripting in Buildism. Can anyone fix this for me?
|
|
|
2/1/11 |
Posted by: Jacob__mybb_import1 - 02-01-2011, 11:39 PM - Forum: News
- Replies (1)
|
 |
- Fixed the help button
- Split the resources into a separate file, this will make updating faster in the future
- Day and night! Change the Time property of Environment to see what I mean; there is a simple sunrise/sunset animation. You can make time move forward one minute by using the step() member function of Environment.
|
|
|
Jacob,this is a suggestion for you. |
Posted by: Tyler - 02-01-2011, 11:05 PM - Forum: Suggestions
- Replies (5)
|
 |
I think we you should start a thread for applying to have moderator's,and then you have a poll to vote for who is gonna be a moderator,and I think their should be 3 moderator's,just a suggestion.[/php]
|
|
|
|