Advertisement
booNeibmoZ

"Realistic Fire/Special Effects" Roblox Scripting Tutorial

Jun 28th, 2011
1,533
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.95 KB | None | 0 0
  1. ==Introduction==
  2. In this article, you will find ways to use Roblox's fire[[File:Fire_and_Smoke_Brick.PNG|thumb|90px|Fire brick]]
  3.  
  4. to your fun advantage! Don't forget to open the game in Studio or have Advanced Tools open!
  5.  
  6. ==Realistic Fire==
  7. First off, you need to insert a brick. Go to Tools and then Click Insert>Object>Part. Select the part then click Insert>Object>Fire. Now you have a brick with fire in it. Roblox's fire is already very convincing, but it doesn't have smoke. To do this, select the part and click Insert>Object>Smoke. Currently, you should have a brick with fire and smoke in it to make it look like a real fire.
  8. ==Editing Fire and Smoke Effects==
  9. OK, the fire already has some good looking color, but I would change the color of the smoke to a darker grey, because it looks like a broken fog machine. Also lowering the opacity and raising the RiseVelocity makes it look better.
  10. ==Time to Light This Thing==
  11. Well, this header says it all. We are going to add a script that will make this fire act like real fire. Ready? OK. Select the brick and go to Insert>Object>Script. We are going to make an onTouched script so when someone touches the fire brick, something happens. Name this script whatever you want, as long as you know it's a script. Got it? Now for the scripting...
  12. ===Newbie Script===
  13.  
  14. '''''function onTouched(hit)'''''
  15.  
  16. '''''if hit.Parent.Humanoid ~= nil then'''''
  17.  
  18. '''''print(hit.Parent.Name.. " has touched the fire!")'''''
  19.  
  20. '''''local infect = script.Parent.Fire:Clone()'''''
  21.  
  22. '''''infect.Parent = hit.Parent.Torso'''''
  23.  
  24. '''''local burn = script.Parent.Smoke:Clone()'''''
  25.  
  26. '''''burn.Parent = hit.Parent.Torso'''''
  27.  
  28. '''''while true do'''''
  29.  
  30. '''''wait(0.1)'''''
  31.  
  32. '''''hit.Parent.Humanoid.Health = hit.Parent.Humanoid.Health - 1'''''
  33.  
  34. '''''end'''''
  35.  
  36. '''''end'''''
  37.  
  38. '''''end'''''
  39.  
  40. '''''script.Parent.Touched:connect(onTouched)'''''
  41.  
  42.  
  43.  
  44. ===Advanced Script (and over complicated)===
  45.  
  46. '''''function onTouched(hit)'''''
  47.  
  48. '''''if hit.Parent.Humanoid ~= nil then'''''
  49.  
  50. '''''print(hit.Parent.Name.. " has touched the fire!")'''''
  51.  
  52. '''''local infect = script.Parent.Fire:Clone()'''''
  53.  
  54. '''''infect.Parent = hit.Parent.Torso'''''
  55.  
  56. '''''local burn = script.Parent.Smoke:Clone()'''''
  57.  
  58. '''''burn.Parent = hit.Parent.Torso'''''
  59.  
  60. '''''coroutine.resume(coroutine.create(function()'''''
  61.  
  62. '''''local HIT = hit'''''
  63.  
  64. '''''while true do'''''
  65.  
  66. '''''wait(0.1)'''''
  67.  
  68. '''''HIT.Parent.Humanoid.Health = HIT.Parent.Humanoid.Health - 1'''''
  69.  
  70. '''''end'''''
  71.  
  72. '''''end))'''''
  73.  
  74. '''''end'''''
  75.  
  76. '''''end'''''
  77.  
  78.  
  79.  
  80.  
  81. '''''script.Parent.Touched:connect(onTouched)'''''
  82.  
  83.  
  84.  
  85.  
  86.  
  87. Now this script will not just light them on fire, but take away damage every 0.1 seconds. You have finished, congratulations. What you need to do now is publish, and test! Have fun! P.S. Blow some noob heads off with this thing!
  88.  
  89. [[User:ZombieDeath101|ZombieDeath101]] 20:57, December 5, 2010 (UTC)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement