Main Search
Delta Corp Forum Index
 
 
FAQ Members Groups Profile Private Messages

Important Notice: We regret to inform you that our free phpBB forum hosting service will be discontinued by the end of June 30, 2024. If you wish to migrate to our paid hosting service, please contact [email protected].
Drop Gold

 
Post new topic   Reply to topic    Delta Corp Forum Index -> Script Requests
View previous topic :: View next topic  
Author Message
Nasadaws
Delta Corp Moderator


Joined: 27 Mar 2008
Posts: 484
Location: Under you bed Where else?

PostPosted: Sat May 24, 2008 9:18 pm    Post subject: Drop Gold Reply with quote

Could someone make me a script that will drop a random amount of gold in an IntValue (I mean like gold and then you step on it and it will give you that much to a IntValue in you Head)
_________________
Nasadaws Attack Spammer: Hits 100 Damage with his Ban Hama.
Spammer: Flees.


I R NOE WELDIN ME BAN HAMAR.
Back to top
View user's profile Send private message Send e-mail
SirGelatina
Site Admin


Joined: 01 Mar 2008
Posts: 116
Location: Behind you

PostPosted: Sun May 25, 2008 6:56 pm    Post subject: Reply with quote

Take a little time to make it

Code:
cycles = false -- Leaving as it is, will make it run once. Else, will run in cycles
pause = 10 -- If cycles is true, how long will be the pause between cycles ?
minGoldDropped = 3 -- How many golds will it drop ( At minimum ) ?
maxGoldDropped = 10 -- How many golds will it drop ( At maximum ) ?
goldGiven = 100 -- How much gold will be given for the head ?
basePlatePos = game.Workspace.PrimaryPart.Position
basePlateSize = game.Workspace.PrimaryPart.Size

gold = Instance.new("Part")
gold.BrickColor = BrickColor.new("Bright yellow")
gold.formFactor = 0
gold.Size = Vector3.new(3, 3, 3)
gold.Reflectance = 0.3

scr = Instance.new("Script")
scr.Source = ( "goldGiven = " .. goldGiven .. [[
debounce = false

function onTouched(Toucher)
   local head = Toucher.Parent:findFirstChild("Head")
   if head ~= nil and debounce == false then
      local gold = head:findFirstChild("Gold")
      if gold ~= nil and  then
         debounce = true
         gold.Value = gold.Value + goldGiven
         script.Parent:remove()
      end
   end
end

script.Parent.Touched:connect(onTouched) ]] )
scr.Parent = script

function randomizePos()
   local x = basePlatePos.x + math.random(-1 * (basePlateSize.x / 2), basePlateSize.x / 2)
   local y = basePlatePos.y + math.random(50, 150)
   local z = basePlatePos.z + math.random(-1 * (basePlateSize.z / 2), basePlateSize.z / 2)
   return Vector3.new(x, y, z)
end

while true do
   local amount = math.random(minGoldDropped, maxGoldDropped)
   for x=1, amount do
      local drop = gold:clone()
      drop.Position = randomizePos()
      drop.Parent = game.Workspace
   end
   if cycles == false then break end
   wait(pause)
end
Back to top
View user's profile Send private message Send e-mail MSN Messenger
Display posts from previous:   
Post new topic   Reply to topic    Delta Corp Forum Index -> Script Requests All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
Back to Top              
Jenova Template © digital-delusion.com
Powered by phpBB © 2001, 2002 phpBB Group



For Support - http://forums.BizHat.com

Free Web Hosting | Free Forum Hosting | FlashWebHost.com | Image Hosting | Photo Gallery | FreeMarriage.com

Powered by PhpBBweb.com, setup your forum now!