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].
Bomb Plant

 
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: Thu May 29, 2008 5:44 pm    Post subject: Bomb Plant Reply with quote

Could someone make me a tool that you can pick up and when you get over to a model called "Stinger" You have to hold the mouse down for 5 seconds to plant it?


Could someone make me a tool that will defuse it too?


Thanks.
_________________
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: Thu May 29, 2008 6:25 pm    Post subject: Reply with quote

Planting Bomb:

Code:
stingerParent = script.Parent.Stinger -- Remember to edit this!
isMouseDown = false

function onButton1Down(mouse)
    isMouseDown = true
    local hint = Instance.new("Hint")
    hint.Text = "Planting Bomb..."
    hint.Parent = script.Parent.Parent.Parent
    wait(5)
    if isMouseDown == true then
        local bomb = stingerParent:clone()
        bomb.Parent = game.Workspace
        bomb:MoveTo(Vector3.new(mouse.Hit.x, mouse.Hit.y, mouse.Hit.z))
    end
    hint:remove()
end

function onButton1Up()
    isMouseDown = false
end

function onSelected(mouse)
    mouse.Button1Up:connect(onButton1Up)
    mouse.Button1Down:connect(function() onButton1Down(mouse) end)
end

script.Parent.Selected:connect(onSelected)


To defuse:

Code:
timeTakenToDefuseBomb = 2 -- In Seconds
isMouseDown = false

function onButton1Down(mouse)
    isMouseDown = true
    if mouse.Target.Parent.Name ~= "Stinger" then return end
    local hint = Instance.new("Hint")
    hint.Text = "Defusing bomb..."
    hint.Parent = script.Parent.Parent.Parent
    local bomb = mouse.Target.Parent
    wait(timeTakenToDefuseBomb)
    if isMouseDown == true and bomb ~= nil then
        local list = bomb:getChildren()
        for x=1, #list do
            if list[x].className == "Script" then list[x]:remove() end
        end
        wait()
        bomb:remove(timeTakenToDefuseBomb * 2)
    end
    hint:remove()
end

function onButton1Up()
    isMouseDown = false
end

function onSelected(mouse)
    mouse.Button1Up:connect(onButton1Up)
    mouse.Button1Down:connect(function() onButton1Down(mouse) end)
end

script.Parent.Selected:connect(onSelected)
Back to top
View user's profile Send private message Send e-mail MSN Messenger
lah30303
Beginner Poster


Joined: 10 May 2008
Posts: 11

PostPosted: Thu May 29, 2008 8:08 pm    Post subject: Reply with quote

In the planting script you made, right here :
wait(5)
if isMouseDown == true then

wouldn't it be better if you made it something like
wait(1)
if isMouseDown == true then
wait(1)
if isMouseDown == true then
wait(1)
if isMouseDown == true then
wait(1)
if isMouseDown == true then
wait(1)
if isMouseDown == true then
so you have to hold you mouse and you can't just click it once and again after 5 seconds?
You can probably see from this that I don't know how to script at all, but I have a general understanding of it, so I was just wondering, so If I am entirely off, just let me know.
_________________
_-lah30303-_
On a quest to
learn scripting
||||||||||||||||
Back to top
View user's profile Send private message
SirGelatina
Site Admin


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

PostPosted: Thu May 29, 2008 8:54 pm    Post subject: Reply with quote

Connection lines on roblox, when fired, create coroutines automatically, which means two or mone function scripts can be running in the same time.
Back to top
View user's profile Send private message Send e-mail MSN Messenger
lah30303
Beginner Poster


Joined: 10 May 2008
Posts: 11

PostPosted: Thu May 29, 2008 9:03 pm    Post subject: Reply with quote

Intresting, thx for the info.
_________________
_-lah30303-_
On a quest to
learn scripting
||||||||||||||||
Back to top
View user's profile Send private message
Nasadaws
Delta Corp Moderator


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

PostPosted: Fri May 30, 2008 7:46 am    Post subject: Reply with quote

It says "Planting Bomb..." and then nothing happeneds.
_________________
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
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!