I need help converting these ROBLOX Codes Into Buildism Codes
#1
Heal Pad:

Code:
local onColor = BrickColor.new(37)
local offColor = BrickColor.new(21)

local cooldown = 30
local connection = nil
local isOn = true

function turnOff()
    script.Parent.Pad.BrickColor = offColor
    isOn = false
end

function turnOn()
    script.Parent.Pad.BrickColor = onColor
    isOn = true
end

function onTouch(hit)
    if (isOn == false) then return end
    local human = hit.Parent:findFirstChild("Humanoid")
    if (human ~= nil) then
        human.Health = human.MaxHealth
        turnOff()
    end
end

connection = script.Parent.Pad.Touched:connect(onTouch)


while true do
    wait(cooldown)
    if (isOn == false) then turnOn() end
end



Deathplates:

Code:
local plates = {}
local states = {}
local colors = {}


-- plates and states!
function Init()
    local c = script.Parent:GetChildren()

    for i=1,#c do
        if (c[i].Name == "PhantomPlate") then
            plates[i] = c[i]
            states[i] = 0
            colors[i] = plates[i].BrickColor
        end
    end
end

function UpdatePlate(i)
    
    if (states[i] ~= 0) then states[i] = states[i] + 1 else
        if(math.random(1,75) == 5) then states[i] = 1 end
    end

    if (states[i] < 4) then
        plates[i].Transparency = 0
        plates[i].CanCollide = true
        plates[i].BrickColor = colors[i]
    end

    if (states[i] == 4) then
        plates[i].BrickColor = BrickColor.new(26)
    end
    if (states[i] == 5) then
        plates[i].Transparency = .2
    end
    if (states[i] == 10) then
        plates[i].Transparency = .4
    end
    if (states[i] == 15) then
        plates[i].Transparency = .6
    end
    if (states[i] == 20) then
        plates[i].Transparency = .8
    end
    if (states[i] == 25) then
        plates[i].Transparency = 1
        plates[i].CanCollide = false
    end

    if (states[i] == 50) then
        states[i] = 0
    end
end


function Update()
    for i=1,#plates do
        UpdatePlate(i)
    end
end


function onChildAdded(child)
    if (child.Name == "Trigger") then
        child.Parent = nil
        for i=1,#plates do
            states[i] = 3
        end
    end
end

Init()

script.Parent.ChildAdded:connect(onChildAdded)

while true do
    Update()
    wait(.2)
end
Reply
#2
Read this, should help.

http://buildism.net/wiki/Converting_from...ildism_Lua
Hello
Reply
#3
hmmmm..
Reply
#4
Health pad:
[lua]enabled = true
local cooldown = 1 -- time until it reactivates
function waitFor(time)
local waittime = os.time()
while os.time() - waittime < time do
sleep(0.001)
end end


function OnCollided(hit)
if hit.Parent.Type == "Character" and enabled then
hit.Parent.Health = hit.Parent.MaximumHealth
script.Parent.Color = Color(255, 0, 0)
enabled = false
waitFor(cooldown)
script.Parent.Color = Color(0, 192, 0)
enabled = true
end
end

link(script.Parent.Collided, OnCollided)[/lua]

Deathplates:
[lua]enabled = true
local reappear = 5 --how many seconds until it becomes visible
function waitFor(time)
local waittime = os.time()
while os.time() - waittime < time do
sleep(0.001)
end end

function OnCollided(hit)
if hit.Parent.Type == "Character" and enabled then
enabled = false
script.Parent.Transparency = 0.2
waitFor(0.2)
script.Parent.Transparency = 0.4
waitFor(0.2)
script.Parent.Transparency = 0.6
waitFor(0.2)
script.Parent.Transparency = 0.8
waitFor(0.2)
script.Parent.Transparency = 1
script.Parent.Collidable = false
script.Parent.CharacterCollide = false
waitFor(reappear)
script.Parent.Transparency = 0
script.Parent.Collidable = true
script.Parent.CharacterCollide = true
enabled = true
end
end

link(script.Parent.Collided, OnCollided)[/lua]

[Image: AmZJnA9.png]
Reply
#5
(08-07-2011, 02:37 PM)Glome Wrote: Health pad:
[lua]enabled = true
local cooldown = 1 -- time until it reactivates
function waitFor(time)
local waittime = os.time()
while os.time() - waittime < time do
sleep(0.001)
end end


function OnCollided(hit)
if hit.Parent.Type == "Character" and enabled then
hit.Parent.Health = hit.Parent.MaximumHealth
script.Parent.Color = Color(255, 0, 0)
enabled = false
waitFor(cooldown)
script.Parent.Color = Color(0, 192, 0)
enabled = true
end
end

link(script.Parent.Collided, OnCollided)[/lua]

Deathplates:
[lua]enabled = true
local reappear = 5 --how many seconds until it becomes visible
function waitFor(time)
local waittime = os.time()
while os.time() - waittime < time do
sleep(0.001)
end end

function OnCollided(hit)
if hit.Parent.Type == "Character" and enabled then
enabled = false
script.Parent.Transparency = 0.2
waitFor(0.2)
script.Parent.Transparency = 0.4
waitFor(0.2)
script.Parent.Transparency = 0.6
waitFor(0.2)
script.Parent.Transparency = 0.8
waitFor(0.2)
script.Parent.Transparency = 1
script.Parent.Collidable = false
script.Parent.CharacterCollide = false
waitFor(reappear)
script.Parent.Transparency = 0
script.Parent.Collidable = true
script.Parent.CharacterCollide = true
enabled = true
end
end

link(script.Parent.Collided, OnCollided)[/lua]

Thanks so much! :> Dis will be epic fo mah place :>
Reply


Forum Jump:


Users browsing this thread: 3 Guest(s)