Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

How would i build up damage just like A bizarre day TimeStop?

Asked by 4 years ago

I was going through the old abd scripts, i was trying to figure out how would i integrate the part where they built up damage

here is an example of the damage build up part i think?


elseif chr.Dodge.Value == true and game.Lighting.TS.Value == true and chr.RTZ.Value == false then 
repeat
    wait()
until game.Lighting.TS.Value == false    
hum:TakeDamage(dmg)
lol(dmg)
elseif chr.RTZ.Value == true then
    rtzevent:FireClient(plr, player)
    negate()
    return  
end

here this is my TS script, trying to figure out how i would integrate it into my TS script


local rp = game:GetService("ReplicatedStorage") local World = rp:WaitForChild("ZaWarudoRemotes"):WaitForChild("World") local RunService = game:GetService("RunService")

local TweenService = game:GetService("TweenService") local Debris = game:GetService("Debris")

local range = 100000000000000 local duration = 10

World.OnServerEvent:Connect(function(Player)

game.ServerStorage.TSValue.Value = "true" 
local Stand = workspace:FindFirstChild(Player.Name.." Stand"):WaitForChild("ZaWarudo")

if Stand then
    local Character = Player.Character
    local Humanoid = Character:WaitForChild("Humanoid")
    local HumanoidRP = Character:WaitForChild("HumanoidRootPart")

    local prevWeld = Stand:WaitForChild("HumanoidRootPart"):WaitForChild("Stand Weld")
    prevWeld:Destroy()


    Stand:WaitForChild("HumanoidRootPart").CFrame = HumanoidRP.CFrame * CFrame.new(0,0,0)

    local weld = Instance.new("ManualWeld")
    weld.Name = "Stand Weld"
    weld.Part0 = Stand:WaitForChild("HumanoidRootPart")
    weld.Part1 = HumanoidRP
    weld.C0 = Stand:WaitForChild("HumanoidRootPart").CFrame:inverse() * HumanoidRP.CFrame
    weld.Parent = weld.Part0

    local animControl = Stand:WaitForChild("AnimControl")
    for i, track in pairs(animControl:GetPlayingAnimationTracks()) do
        track:Stop()
    end

    local playerSpread = Humanoid:LoadAnimation(script.stance)
    playerSpread:Play()

    local Spread = animControl:LoadAnimation(script.Spread)
    Spread:Play()

    Humanoid.WalkSpeed = 0
    Humanoid.JumpPower = 0

    local Folder = Instance.new("Folder",workspace)
    Folder.Name = Player.Name.." The World"

    wait(1.75)

    local Orb = script.Orb:Clone()
    Orb.CFrame = Stand:WaitForChild("HumanoidRootPart").CFrame
    Orb.Orientation = Character:WaitForChild("HumanoidRootPart").Orientation
    Orb.Parent = Folder

    local Orb2 = script.Orb2:Clone()
    Orb2.CFrame = Stand:WaitForChild("HumanoidRootPart").CFrame
    Orb2.Orientation = Character:WaitForChild("HumanoidRootPart").Orientation
    Orb2.Parent = Folder

    game.Lighting.ColorCorrection.Saturation = -2.4
    game.Lighting.ColorCorrection.Contrast = 1
    game.Lighting.ColorCorrection.Contrast = 0
    game.Lighting.Blur.Size = 7
    game.Lighting.Blur.Size = 24


    local goal = {}
    goal.Size = Orb.Size + Vector3.new(100,100,100)
    local info = TweenInfo.new(1,Enum.EasingStyle.Linear,Enum.EasingDirection.Out,0,false,.25)
    local tween = TweenService:Create(Orb,info,goal)
    tween:Play()

    wait(0.5)

    local goal2 = {}
    goal2.Size = Orb2.Size + Vector3.new(99,99,99)
    local info2 = TweenInfo.new(1,Enum.EasingStyle.Linear,Enum.EasingDirection.Out,0,false,.25)
    local tween2 = TweenService:Create(Orb2,info2,goal2)
    tween2:Play()

    game.Lighting.ColorCorrection.Contrast = 1

    wait(1)

        local goal3 = {}
    goal3.Size = Orb.Size - Orb.Size
    local info3 = TweenInfo.new(1,Enum.EasingStyle.Linear,Enum.EasingDirection.Out,0,false,.25)
    local tween3 = TweenService:Create(Orb,info3,goal3)
    tween3:Play()

    local goal4 = {}
    goal4.Size = Orb2.Size - Orb2.Size
    local info4 = TweenInfo.new(1,Enum.EasingStyle.Linear,Enum.EasingDirection.Out,0,false,.25)
    local tween4 = TweenService:Create(Orb2,info4,goal4)
    tween4:Play()

    game.Lighting.ColorCorrection.Contrast = 0
    game.Lighting.Blur.Size = 0

    Humanoid.WalkSpeed = 16
    Humanoid.JumpPower = 50

    spawn(function()
        wait(.5)
        for i, chars in pairs(workspace:GetChildren()) do
            if chars:FindFirstChild("Humanoid") then
                if chars ~= Character then

    workspace.StandsSounds.Countdown:Play()

                    local EhumanoidRP = chars:FindFirstChild("HumanoidRootPart")

                if EhumanoidRP then
                    local distance = (HumanoidRP.CFrame.p - EhumanoidRP.CFrame.p).magnitude
                    if distance <= range then
                        spawn(function()
                            for j, k in pairs(chars:GetChildren()) do
                                if k:IsA("MeshPart") or k:IsA("Part") then
                                        spawn(function()

                                            k.Anchored = true
                                    wait(10)
                                            k.Anchored = false

                                            game.Lighting.ColorCorrection.Saturation = .1

                                end)
                            end
                        end
                    end)
                            local enemy = game.Players:GetPlayerFromCharacter(chars)
                            if enemy then
                                local BackPack = enemy:FindFirstChild("Backpack")
                                if BackPack then
                                    spawn(function()
                                        for j, fold in pairs(BackPack:GetChildren()) do 
                                            if fold:IsA("Folder") then 
                                                local enable = fold:FindFirstChild("Enable")
                                                if enable then 
                                                    spawn(function()
                                                        enable.Value = true
                                                        wait(10)
                                                        enable.Value = false
                                                    end)
                                                end

                                            end
                                        end

                                    end)

                                end
                            end
                end
            end
        end
            elseif chars:IsA("Folder") then
                if chars.Name ~= Player.Name.." Stand" then
                local substand
                for j, stand in pairs(chars:GetChildren()) do
                    if stand:IsA("Model") then
                        local AnimControl = stand:FindFirstChild("AnimControl")
                        if AnimControl then
                            substand = stand
                        end

                    end

                end

                if substand then
                for j, stuff in pairs(substand:GetChildren()) do
                    if stuff:IsA("BasePart") then
                        spawn(function()
                        stuff.Anchored = true
                        wait(10)
                        stuff.Anchored = false
                             end)
                          end
                       end
                    end
                end
            end 
        end
    end)

    spawn(function()
        wait(1)
        local prevWeld = Stand:WaitForChild("HumanoidRootPart"):WaitForChild("Stand Weld")
        prevWeld:Destroy()

        Stand:WaitForChild("HumanoidRootPart").CFrame = HumanoidRP.CFrame * CFrame.new(0,0,0)

        local weld = Instance.new("ManualWeld")
        weld.Name = "Stand Weld"
        weld.Part0 = Stand:WaitForChild("HumanoidRootPart")
        weld.Part1 = HumanoidRP
        weld.C0 = Stand:WaitForChild("HumanoidRootPart").CFrame:inverse() * HumanoidRP.CFrame
        weld.Parent = weld.Part0

        for i, track in pairs(animControl:GetPlayingAnimationTracks()) do
            track:Stop()
        end

        local Idle = animControl:LoadAnimation(script.Idle)
        Idle:Play()
    end)

    wait(duration)
    Debris:AddItem(Orb,1)

    game.ServerStorage.TSValue.Value = "false"
    World:FireClient(Player)
end

end)


0
By build up damage I mean like, how would I make the damage only like take damage after the TS value is false ShrynxTube 7 — 4y

1 answer

Log in to vote
0
Answered by
Optikk 499 Donator Moderation Voter
4 years ago

Building up damage is a matter of determining when damage should build up, and then figuring out how to unload all of that damage at the same time.

The first concept that comes to mind is to have one universal damage function for all stands in your game to use. This is to make sure they're all following the same rules about damaging (such as build-up) (This is a great opportunity to start using module scripts). Then you could put a BoolValue in ReplicatedStorage named "TimeStopped." This will make the value easy to access across all of the 900 scripts and localscripts usually found in jojo games.

This code is nothing perfect, but here's what the idea is. If TimeStopped.Value is true, then time is stopped. Instead of damaging the humanoid, store it in the DamageBuildUp table. Then, when TimeStopped.Value changes to false (meaning time is no longer stopped) unload all of the damage buildup and clear the table.

local DamageBuildUp = {}
local TimeStopped = game.ReplicatedStorage.TimeStopped

local function damageFunction(humanoid, damage)
    if TimeStopped.Value == true then
        table.insert(DamageBuildUp, {humanoid, damage})
    else
        humanoid:TakeDamage(damage)
    end
end

TimeStopped.Changed:Connect(function()
    if TimeStopped.Value == false then
        for _, argPair in pairs(DamageBuildUp) do
            damageFunction(argPair[1], argPair[2])
        end
        DamageBuildUp = {}
    end
end)

Any questions?

0
uh so I have to implement it into my scripts that deals the damage? ShrynxTube 7 — 4y
Ad

Answer this question