Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- --Converted with ttyyuu12345's model to script plugin v4
- function sandbox(var,func)
- local env = getfenv(func)
- local newenv = setmetatable({},{
- __index = function(self,k)
- if k=="script" then
- return var
- else
- return env[k]
- end
- end,
- })
- setfenv(func,newenv)
- return func
- end
- cors = {}
- mas = Instance.new("Model",game:GetService("Lighting"))
- Model0 = Instance.new("Model")
- Part1 = Instance.new("Part")
- SpecialMesh2 = Instance.new("SpecialMesh")
- Sound3 = Instance.new("Sound")
- Sound4 = Instance.new("Sound")
- Sound5 = Instance.new("Sound")
- Sound6 = Instance.new("Sound")
- Sound7 = Instance.new("Sound")
- Sound8 = Instance.new("Sound")
- Sound9 = Instance.new("Sound")
- Sound10 = Instance.new("Sound")
- Sound11 = Instance.new("Sound")
- Sound12 = Instance.new("Sound")
- Sound13 = Instance.new("Sound")
- Script14 = Instance.new("Script")
- Weld15 = Instance.new("Weld")
- Weld16 = Instance.new("Weld")
- Weld17 = Instance.new("Weld")
- Weld18 = Instance.new("Weld")
- Part19 = Instance.new("Part")
- Motor20 = Instance.new("Motor")
- Motor21 = Instance.new("Motor")
- Motor22 = Instance.new("Motor")
- Motor23 = Instance.new("Motor")
- Motor24 = Instance.new("Motor")
- Part25 = Instance.new("Part")
- Part26 = Instance.new("Part")
- Part27 = Instance.new("Part")
- Part28 = Instance.new("Part")
- Humanoid29 = Instance.new("Humanoid")
- Script30 = Instance.new("Script")
- Script31 = Instance.new("Script")
- Script32 = Instance.new("Script")
- BoolValue33 = Instance.new("BoolValue")
- Script34 = Instance.new("Script")
- Hat35 = Instance.new("Hat")
- Part36 = Instance.new("Part")
- SpecialMesh37 = Instance.new("SpecialMesh")
- Hat38 = Instance.new("Hat")
- Part39 = Instance.new("Part")
- SpecialMesh40 = Instance.new("SpecialMesh")
- Hat41 = Instance.new("Hat")
- Part42 = Instance.new("Part")
- SpecialMesh43 = Instance.new("SpecialMesh")
- Hat44 = Instance.new("Hat")
- Part45 = Instance.new("Part")
- SpecialMesh46 = Instance.new("SpecialMesh")
- Animation47 = Instance.new("Animation")
- CharacterMesh48 = Instance.new("CharacterMesh")
- CharacterMesh49 = Instance.new("CharacterMesh")
- CharacterMesh50 = Instance.new("CharacterMesh")
- CharacterMesh51 = Instance.new("CharacterMesh")
- CharacterMesh52 = Instance.new("CharacterMesh")
- Animation53 = Instance.new("Animation")
- Script54 = Instance.new("Script")
- Model0.Name = "SCP-049"
- Model0.Parent = mas
- Model0.PrimaryPart = Part1
- Part1.Name = "Head"
- Part1.Parent = Model0
- Part1.Material = Enum.Material.Fabric
- Part1.BrickColor = BrickColor.new("Black")
- Part1.Rotation = Vector3.new(0, -0.25, 0)
- Part1.FormFactor = Enum.FormFactor.Symmetric
- Part1.Friction = 0
- Part1.Size = Vector3.new(2, 1, 1)
- Part1.CFrame = CFrame.new(-38.2495918, 15.3000097, -181.684647, 0.999990344, 0, -0.00439172285, 0, 1, 0, 0.00439172285, 0, 0.999990344)
- Part1.TopSurface = Enum.SurfaceType.Smooth
- Part1.Color = Color3.new(0.105882, 0.164706, 0.207843)
- Part1.Position = Vector3.new(-38.2495918, 15.3000097, -181.684647)
- Part1.Orientation = Vector3.new(0, -0.25, 0)
- Part1.Color = Color3.new(0.105882, 0.164706, 0.207843)
- SpecialMesh2.Parent = Part1
- SpecialMesh2.Scale = Vector3.new(1.25, 1.25, 1.25)
- SpecialMesh2.Scale = Vector3.new(1.25, 1.25, 1.25)
- Sound3.Name = "1"
- Sound3.Parent = Part1
- Sound3.SoundId = "rbxassetid://189035323"
- Sound3.Volume = 1
- Sound4.Name = "10"
- Sound4.Parent = Part1
- Sound4.SoundId = "rbxassetid://528044348"
- Sound4.Volume = 1
- Sound5.Name = "2"
- Sound5.Parent = Part1
- Sound5.SoundId = "rbxassetid://189035381"
- Sound5.Volume = 1
- Sound6.Name = "3"
- Sound6.Parent = Part1
- Sound6.SoundId = "rbxassetid://189035450"
- Sound6.Volume = 1
- Sound7.Name = "4"
- Sound7.Parent = Part1
- Sound7.SoundId = "rbxassetid://189035504"
- Sound7.Volume = 1
- Sound8.Name = "5"
- Sound8.Parent = Part1
- Sound8.SoundId = "rbxassetid://189035671"
- Sound8.Volume = 1
- Sound9.Name = "6"
- Sound9.Parent = Part1
- Sound9.SoundId = "rbxassetid://189035728"
- Sound9.Volume = 1
- Sound10.Name = "7"
- Sound10.Parent = Part1
- Sound10.SoundId = "rbxassetid://189035763"
- Sound10.Volume = 1
- Sound11.Name = "8"
- Sound11.Parent = Part1
- Sound11.SoundId = "rbxassetid://189035803"
- Sound11.Volume = 1
- Sound12.Name = "9"
- Sound12.Parent = Part1
- Sound12.SoundId = "rbxassetid://487003745"
- Sound12.Volume = 1
- Sound13.Name = "breath"
- Sound13.Parent = Part1
- Sound13.SoundId = "rbxassetid://483810543"
- Sound13.Looped = true
- Script14.Name = "Breathingsound"
- Script14.Parent = Part1
- table.insert(cors,sandbox(Script14,function()
- while true do
- script.Parent.breath:Play()
- wait(28)
- end
- end))
- Weld15.Name = "HeadWeld"
- Weld15.Parent = Part1
- Weld15.C0 = CFrame.new(0, 0.5, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1)
- Weld15.C1 = CFrame.new(0, 0.400000006, 0.639999986, 1, 0, 0, 0, 1, 0, 0, 0, 1)
- Weld15.Part0 = Part1
- Weld15.Part1 = Part36
- Weld16.Name = "HeadWeld"
- Weld16.Parent = Part1
- Weld16.C0 = CFrame.new(0, 0.5, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1)
- Weld16.C1 = CFrame.new(0, 0.200000003, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1)
- Weld16.Part0 = Part1
- Weld16.Part1 = Part39
- Weld17.Name = "HeadWeld"
- Weld17.Parent = Part1
- Weld17.C0 = CFrame.new(0, 0.5, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1)
- Weld17.C1 = CFrame.new(0.180000007, 0.449999988, 0.49000001, 1, 0, 0, 0, 1, 0, 0, 0, 1)
- Weld17.Part0 = Part1
- Weld17.Part1 = Part42
- Weld18.Name = "HeadWeld"
- Weld18.Parent = Part1
- Weld18.C0 = CFrame.new(0, 0.5, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1)
- Weld18.C1 = CFrame.new(-0.180000007, 0.449999988, 0.49000001, 1, -0, 0, 0, 1, -0, 0, 0, 0.99999994)
- Weld18.Part0 = Part1
- Weld18.Part1 = Part45
- Part19.Name = "Torso"
- Part19.Parent = Model0
- Part19.Material = Enum.Material.Fabric
- Part19.BrickColor = BrickColor.new("Black")
- Part19.Rotation = Vector3.new(0, -0.25, 0)
- Part19.FormFactor = Enum.FormFactor.Symmetric
- Part19.Friction = 0
- Part19.Size = Vector3.new(2, 2, 1)
- Part19.CFrame = CFrame.new(-38.2495918, 13.8000097, -181.684647, 0.999990344, 0, -0.00439172285, 0, 1, 0, 0.00439172285, 0, 0.999990344)
- Part19.LeftSurface = Enum.SurfaceType.Weld
- Part19.RightSurface = Enum.SurfaceType.Weld
- Part19.Color = Color3.new(0.105882, 0.164706, 0.207843)
- Part19.Position = Vector3.new(-38.2495918, 13.8000097, -181.684647)
- Part19.Orientation = Vector3.new(0, -0.25, 0)
- Part19.Color = Color3.new(0.105882, 0.164706, 0.207843)
- Motor20.Name = "Right Shoulder"
- Motor20.Parent = Part19
- Motor20.C0 = CFrame.new(-2, 0.5, 0, 0, 0, 1, 0, 1, -0, -1, 0, 0)
- Motor20.C1 = CFrame.new(-0.5, 0.5, 0, 0, 0, 1, 0, 1, -0, -1, 0, 0)
- Motor20.Part0 = Part26
- Motor20.Part1 = Part19
- Motor20.DesiredAngle = -0.59882825613022
- Motor20.MaxVelocity = 0.15000000596046
- Motor21.Name = "Left Shoulder"
- Motor21.Parent = Part19
- Motor21.C0 = CFrame.new(2, 0.5, 0, 0, 0, -1, 0, 1, 0, 1, 0, 0)
- Motor21.C1 = CFrame.new(0.5, 0.5, 0, 0, 0, -1, 0, 1, 0, 1, 0, 0)
- Motor21.Part0 = Part25
- Motor21.Part1 = Part19
- Motor21.DesiredAngle = -0.59882825613022
- Motor21.MaxVelocity = 0.15000000596046
- Motor22.Name = "Right Hip"
- Motor22.Parent = Part19
- Motor22.C0 = CFrame.new(1, -1, 0, 0, 0, 1, 0, 1, -0, -1, 0, 0)
- Motor22.C1 = CFrame.new(0.5, 1, 0, 0, 0, 1, 0, 1, -0, -1, 0, 0)
- Motor22.Part0 = Part19
- Motor22.Part1 = Part28
- Motor22.DesiredAngle = 0.14970706403255
- Motor22.MaxVelocity = 0.10000000149012
- Motor23.Name = "Left Hip"
- Motor23.Parent = Part19
- Motor23.C0 = CFrame.new(-1, -1, 0, 0, 0, -1, 0, 1, 0, 1, 0, 0)
- Motor23.C1 = CFrame.new(-0.5, 1, 0, 0, 0, -1, 0, 1, 0, 1, 0, 0)
- Motor23.Part0 = Part19
- Motor23.Part1 = Part27
- Motor23.DesiredAngle = 0.14970706403255
- Motor23.MaxVelocity = 0.10000000149012
- Motor24.Name = "Neck"
- Motor24.Parent = Part19
- Motor24.C0 = CFrame.new(0, 1, 0, -1, 0, 0, 0, 0, 1, 0, 1, -0)
- Motor24.C1 = CFrame.new(0, -0.5, 0, -1, 0, 0, 0, 0, 1, 0, 1, -0)
- Motor24.Part0 = Part19
- Motor24.Part1 = Part1
- Motor24.MaxVelocity = 0.10000000149012
- Part25.Name = "Left Arm"
- Part25.Parent = Model0
- Part25.Material = Enum.Material.Fabric
- Part25.BrickColor = BrickColor.new("Black")
- Part25.Rotation = Vector3.new(0, -0.25, 0)
- Part25.CanCollide = false
- Part25.FormFactor = Enum.FormFactor.Symmetric
- Part25.Size = Vector3.new(1, 2, 1)
- Part25.CFrame = CFrame.new(-39.7495766, 13.8000097, -181.691238, 0.999990344, 0, -0.00439172285, 0, 1, 0, 0.00439172285, 0, 0.999990344)
- Part25.Color = Color3.new(0.105882, 0.164706, 0.207843)
- Part25.Position = Vector3.new(-39.7495766, 13.8000097, -181.691238)
- Part25.Orientation = Vector3.new(0, -0.25, 0)
- Part25.Color = Color3.new(0.105882, 0.164706, 0.207843)
- Part26.Name = "Right Arm"
- Part26.Parent = Model0
- Part26.Material = Enum.Material.Fabric
- Part26.BrickColor = BrickColor.new("Black")
- Part26.Rotation = Vector3.new(0, -0.25, 0)
- Part26.CanCollide = false
- Part26.FormFactor = Enum.FormFactor.Symmetric
- Part26.Size = Vector3.new(1, 2, 1)
- Part26.CFrame = CFrame.new(-36.7496071, 13.8000097, -181.678055, 0.999990344, 0, -0.00439172285, 0, 1, 0, 0.00439172285, 0, 0.999990344)
- Part26.Color = Color3.new(0.105882, 0.164706, 0.207843)
- Part26.Position = Vector3.new(-36.7496071, 13.8000097, -181.678055)
- Part26.Orientation = Vector3.new(0, -0.25, 0)
- Part26.Color = Color3.new(0.105882, 0.164706, 0.207843)
- Part27.Name = "Left Leg"
- Part27.Parent = Model0
- Part27.Material = Enum.Material.Fabric
- Part27.BrickColor = BrickColor.new("Black")
- Part27.Rotation = Vector3.new(0, -0.25, 0)
- Part27.CanCollide = false
- Part27.FormFactor = Enum.FormFactor.Symmetric
- Part27.Size = Vector3.new(1, 2, 1)
- Part27.CFrame = CFrame.new(-38.749588, 11.8000097, -181.686844, 0.999990344, 0, -0.00439172285, 0, 1, 0, 0.00439172285, 0, 0.999990344)
- Part27.BottomSurface = Enum.SurfaceType.Smooth
- Part27.Color = Color3.new(0.105882, 0.164706, 0.207843)
- Part27.Position = Vector3.new(-38.749588, 11.8000097, -181.686844)
- Part27.Orientation = Vector3.new(0, -0.25, 0)
- Part27.Color = Color3.new(0.105882, 0.164706, 0.207843)
- Part28.Name = "Right Leg"
- Part28.Parent = Model0
- Part28.Material = Enum.Material.Fabric
- Part28.BrickColor = BrickColor.new("Black")
- Part28.Rotation = Vector3.new(0, -0.25, 0)
- Part28.CanCollide = false
- Part28.FormFactor = Enum.FormFactor.Symmetric
- Part28.Size = Vector3.new(1, 2, 1)
- Part28.CFrame = CFrame.new(-37.7495956, 11.8000097, -181.682449, 0.999990344, 0, -0.00439172285, 0, 1, 0, 0.00439172285, 0, 0.999990344)
- Part28.BottomSurface = Enum.SurfaceType.Smooth
- Part28.Color = Color3.new(0.105882, 0.164706, 0.207843)
- Part28.Position = Vector3.new(-37.7495956, 11.8000097, -181.682449)
- Part28.Orientation = Vector3.new(0, -0.25, 0)
- Part28.Color = Color3.new(0.105882, 0.164706, 0.207843)
- Humanoid29.Name = "SCP"
- Humanoid29.Parent = Model0
- Humanoid29.NameOcclusion = Enum.NameOcclusion.NoOcclusion
- Humanoid29.RightLeg = Part28
- Humanoid29.LeftLeg = Part27
- Humanoid29.Torso = Part19
- Humanoid29.Health = 9999
- Humanoid29.MaxHealth = 9999
- Humanoid29.WalkSpeed = 10
- Script30.Parent = Model0
- table.insert(cors,sandbox(Script30,function()
- local larm = script.Parent:FindFirstChild("Left Arm")
- local rarm = script.Parent:FindFirstChild("Right Arm")
- sound = script.Parent.Head.Sound3
- function findNearestTorso(pos)
- local list = game.Workspace:children()
- local torso = nil
- local dist = 1000
- local temp = nil
- local human = nil
- local temp2 = nil
- for x = 1, #list do
- temp2 = list[x]
- if (temp2.className == "Model") and (temp2 ~= script.Parent) then
- temp = temp2:findFirstChild("Torso")
- human = temp2:findFirstChild("Humanoid")
- if (temp ~= nil) and (human ~= nil) and (human.Health > 0) then
- if (temp.Position - pos).magnitude < dist then
- torso = temp
- dist = (temp.Position - pos).magnitude
- end
- end
- end
- end
- return torso
- end
- function Hit(hit)
- local human = hit.Parent:FindFirstChild("Humanoid")
- if human ~= nil then
- human.Health = human.Health -4
- sound:play()
- end
- end
- larm.Touched:connect(Hit)
- rarm.Touched:connect(Hit)
- while true do
- wait(0.1)
- local target = findNearestTorso(script.Parent.Torso.Position)
- if target ~= nil then
- script.Parent.Zombie:MoveTo(target.Position, target)
- end
- end
- end))
- Script31.Name = "Respawn"
- Script31.Parent = Model0
- table.insert(cors,sandbox(Script31,function()
- wait(1)
- human = script.Parent:findFirstChild("Humanoid")
- if human == nil then human = script.Parent:findFirstChild("Zombie") end
- if script.Parent.archivable == false then script.Parent.archivable = true end
- robo=script.Parent:clone()
- robo.Parent = game.Lighting
- player = game.Players:playerFromCharacter(script.Parent)
- if player ~= nil then robo:findFirstChild(script.Name):remove() end
- while true do
- wait(1)
- if human.Health<1 then
- robot=robo:clone()
- robot.Parent=script.Parent.Parent
- robot:makeJoints()
- wait(.1)
- robo:remove()
- script.Parent:remove()
- end
- end
- end))
- Script32.Name = "AIScript"
- Script32.Parent = Model0
- table.insert(cors,sandbox(Script32,function()
- --Beta SpeedAI June 2012 -- Still has logic bugs - Look for updates..
- -- Kill added.
- -- co-operate/other "AI"s
- -- Climb "Truss" Parts
- -- Offset Ray
- -- Swim - Does not work. Don't know why.
- -- Adjusted Jump Ray
- -- Ray Graphics On/Off - flip line 90
- -- Delay next cycle, if Falling.
- -- Diagonal movement - I should add right-hand logic as well...
- local number = 1 + math.random()
- local BRAINWave = .6 -- AND line 38: Wait() between cycles of main loop
- local hum = nil -- Will be a pointer to the Humanoid of our AI.
- wait(number) -- hold on a sec. and spread multiple instances.
- --Globals
- local AI = script.Parent
- local AIName = AI.Name
- local AItorso = AI.Torso
- if true then -- if your torso doesn't have a Humanoid; flip this to false
- local HumanoidType = nil -- find-a-HumanoidObject -- make sure
- local list = AI:GetChildren() -- temp var.
- for x = 1, #list do
- local temp = list[x]
- if (temp.className == "Humanoid") then
- HumanoidType = temp.Name
- end -- found Humanoid
- end -- AI Parts
- if HumanoidType then
- number = math.floor(number*100) -- serial# of AI
- hum = AI[HumanoidType]
- BRAINWave = 7/hum.WalkSpeed -- For extreme speeds, this may have to be adjusted.
- print (script, ": Humanoid = ", hum, AI:GetFullName(), number, "- Think Speed = ", BRAINWave)
- end
- end -- set speed
- --Constants;
- local RAYLength = 100 -- Not really. A point, off in space.
- --Declarations
- local target = AItorso -- is of type torso
- local torsoPos = AItorso.Position
- local targpos = target.Position
- --local Oldtargpos = targpos
- local OldPos = torsoPos * 2
- local origin = CFrame.new(torsoPos)
- local Logic = 0
- local OldX = 100
- local OldZ = 0
- local Xdir = 100
- local Zdir = 0
- local ClimbingLadder = false
- local FreeFalling = false
- local GraphicsOn = script.GraphicsToggle.Value -- Only set at start
- --functions
- -- Are we falling?
- hum.FreeFalling:connect(function()
- FreeFalling = true
- end)
- -- Find Player (& who else not to find).
- function findNearestTorso(pos) -- declare pos a local vector3
- local list = game.Workspace:children()
- local torso = nil
- local dist = 560 -- Area to search
- local temp = nil
- local human = nil
- local temp2 = nil
- for x = 1, #list do
- temp2 = list[x]
- if temp2.className == "Model" then
- temp = temp2:findFirstChild("Torso")
- if temp ~= nil then
- human = temp2:findFirstChild("Humanoid")
- if human ~= nil and (human.Health > 0) and (temp2.Name ~= AIName) then -- not named the same as us.
- if (temp.Position - pos).magnitude < dist then
- torso = temp
- dist = (temp.Position - pos).magnitude
- end -- closer?
- end -- human? Not us.
- end -- Has torso?
- end -- Model?
- end -- For. Loop thru parts in Workplace
- return torso
- end -- findNearest
- function DrawRay(origin, point) -- 7 studs long
- local Ray = Ray.new(origin, (point).unit * 7) --Make the ray.
- local Hit,Position = game.Workspace:FindPartOnRay(Ray,AI) --Check for collisions along the ray, ignoring any Parts of us.
- if GraphicsOn then --Graphics
- local RayPart = Instance.new("Part",AI)
- if Hit then
- if Logic == 1 then
- RayPart.BrickColor = BrickColor.new("Black") --Set its color.
- else
- RayPart.BrickColor = BrickColor.new("Bright red") --Set its color.
- end
- else
- if Logic == 1 then
- RayPart.BrickColor = BrickColor.new("White") --Set its color.
- else
- RayPart.BrickColor = BrickColor.new("Olive") --Set its color.
- end
- end
- RayPart.Transparency = 0.2 --Set its transparency.
- RayPart.Anchored = true --Set whether it will fall or not.
- RayPart.CanCollide = false --Set whether people can walk though it or not.
- RayPart.formFactor = Enum.FormFactor.Custom --Make it so it can be small.
- local Distance = (Position-origin).magnitude --Find the distance between the hit and the torso.
- RayPart.Size = Vector3.new(0.4,.2,Distance) --Set its size to the distance.
- RayPart.CFrame = CFrame.new(Position, origin) * CFrame.new(0,0,-Distance/2) --Move it halfway.
- game.Debris:AddItem(RayPart,2) --Add it to the debris.
- end -- Graphics
- return Hit
- end -- DrawRay
- function FireRayToward() -- possible path, and read the Part we hit, if any.
- ClimbingLadder = false
- local originPrime = origin * Vector3.new(.8,0,0) - Vector3.new(0,.4,0) -- Offset Right + OffY
- local offset = origin * Vector3.new(.8,0,0) - origin * Vector3.new(-.8,0,0) -- left (I guess this is increment. I didn't WANT to do it this way)
- local point = origin.lookVector * 7 -- dir
- local pointPrime = point - offset + Vector3.new(0,2,0) -- dir + OffsetLeft + OffsetY = direction of Ray
- local Hit = DrawRay(originPrime, pointPrime) -- see if we hit anything
- if Hit then
- if target.Parent == Hit.Parent then
- -- AI.Head:BreakJoints()
- if Hit.Name ~= "Head" and Hit.Name ~= "Torso" then
- else
- Hit.Parent.Humanoid:TakeDamage(100)
- end -- kill
- Logic = 0
- Hit = nil
- elseif Hit.Parent.Name == AIName then
- -- if Xdir > 0 then -- if going ?North? then ignore, else (?South?); Jump
- -- Hit = nil -- ignore
- -- elseif Xdir == 0 then -- else swerve (only while in logic).
- if Xdir == 0 then
- Hit = Aitorso-- this should result in Hit = true-but-don't-attemp-a-jump, so swerve; doesn't check floor!
- -- return hit -- Swerve, without checking to jump.
- elseif Hit.Velocity.y > 1 then
- Hit = nil -- ignore, if other AI is already jumping; else check to Jump
- end -- East -West collisions - swerve. North/South, check-to-jump.
- end -- endifs
- end -- read hit
- -- Climb or Jump
- if Hit and Hit ~= AItorso then
- if (Hit.Name == "Truss" and target.Position.y > torsoPos.y - 3) or target.Parent == Hit.Parent then -- ignore parts called "Ladder", if AI is level or below CURRENT Targ pos.
- Hit = nil
- ClimbingLadder = true -- Climb and don't check floor
- else
- --print(Hit, Hit.Name)
- if Hit.Name == "Terrain" or Hit.CanCollide == false then -- In front is Water or a steep hill made of Terrain.
- Hit = nil -- swim or climb, or Ray hit a Non-colliding Part; and don't check for floor. This will not do, as we do not get a Hit when under-water, so we will check for floor. We must check Swimming event.
- else -- Jump?
- Hit = DrawRay(originPrime + Vector3.new(0,4.8,0), pointPrime)
- if Hit == nil then -- (Does NOT check CanCollide of Part blocking Jump)
- hum.Jump = true -- we do NOT check for "Floor", if jumping, but it might be a good idea.
- end -- Room to jump?
- end --Terrain? Water?
- end -- Ladder?
- else -- path is clear. Check for cliff... or OK to drop
- local Level = torsoPos.y
- if target then
- Level = target.Position.y -- get Target's current position.
- else -- Target is dead. Abandon all logic...
- Logic = 0 -- but still check for floor
- end
- if torsoPos.y - 2 < Level then -- if Player is not well below us...
- Hit = DrawRay(torsoPos + point * .8 + Vector3.new(0,1,0), Vector3.new(0,-7,0)) -- check for floor 85% of dir ahead
- if Hit == nil then -- There is no floor
- Hit = true -- Force a hit; we may not be able to get back up here.
- else
- Hit = nil -- Force a false to hit, 'cause everything is OK. (Does NOT check CanCollide of Floor!)
- end -- cliff check
- end -- Player Hieght
- end -- path ok?
- return Hit
- end -- FireRayToward
- function FireAtPlayer()
- origin = CFrame.new(torsoPos, Vector3.new(targpos.x, torsoPos.y, targpos.z)) -- This contains Origin & Direction
- local hit = FireRayToward()
- return hit
- end
- function FireRayAhead()
- origin = CFrame.new(torsoPos, torsoPos + Vector3.new(Xdir, 0, Zdir))
- local hit = FireRayToward()
- targpos = torsoPos + Vector3.new(Xdir,0,Zdir)
- return hit
- end
- function FireRay() -- Fire Ahead and diagonaly
- origin = CFrame.new(torsoPos, torsoPos + Vector3.new(Xdag, 0, Zdag))
- local hit = FireRayToward()
- if hit then
- origin = CFrame.new(torsoPos, torsoPos + Vector3.new(Xdir, 0, Zdir))
- hit = FireRayToward()
- if not hit then
- targpos = torsoPos + Vector3.new(Xdir,0,Zdir)
- end
- else
- targpos = torsoPos + Vector3.new(Xdag,0,Zdag)
- end
- return hit
- end -- Fire Ray
- function FireDag()
- origin = CFrame.new(torsoPos, torsoPos + Vector3.new(Xdag, 0, Zdag))
- local hit = FireRayToward()
- return hit
- end -- Fire Diagonaly
- function TurnRight()
- if Xdir == 0 then
- Xdir = -Zdir
- Zdir = 0
- else
- Zdir = Xdir
- Xdir = 0
- end
- if Xdag == Zdag then Xdag = -Xdag else Zdag = -Zdag end
- end -- Left
- function TurnLeft()
- if Xdir == 0 then
- Xdir = Zdir
- Zdir = 0
- else
- Zdir = -Xdir
- Xdir = 0
- end
- if Xdag == Zdag then Zdag = -Zdag else Xdag = -Xdag end
- end -- Left
- function GetDir()
- Xdir = (targpos.x - torsoPos.x) -- Which way are we going?
- Zdir = (targpos.z - torsoPos.z)
- -- if Zdir < 0 then -- Get closest 45 degree angle. Diagonal.
- -- Zdag = -RAYLength
- -- else
- -- Zdag = RAYLength
- -- end
- -- if Xdir < 0 then
- -- Xdag = -RAYLength
- -- else
- -- Xdag = RAYLength
- -- end
- if math.abs(Xdir) > math.abs(Zdir) then -- Ordinal.
- if Xdir < 0 then
- Xdir = -RAYLength
- -- convert to our direction indicator.
- else
- Xdir = RAYLength
- end
- Zdag = Xdir -- Diagonal Right.
- Xdag = Xdir
- Zdir = 0
- else -- abs
- if Zdir < 0 then
- Zdir = -RAYLength
- else
- Zdir = RAYLength
- end
- Zdag = Zdir
- Xdag = -Zdir
- Xdir = 0
- end -- abs
- end -- GetDir
- while AItorso do -- while I still have a body; search.
- torsoPos = AItorso.Position
- local targ = Workspace.Terrain -- Temp targ
- local Distance =(torsoPos - OldPos).magnitude -- Distance traveled, since last loop
- --local Distance =10
- if target == nil then Logic = 0
- -- Distance = 10
- end -- Player died.
- if Logic == 0 then -- Defalt logic
- target = findNearestTorso(torsoPos) --- target is some Player. FindNearest and get xdir, ydir.
- if target ~= nil then
- targ = target
- -- if ClimbingLadder and Distance >= 1 then
- -- targpos = torsoPos + AItorso.CFrame.lookVector * 9
- -- else
- targpos = target.Position
- -- end
- if Distance < 1 and (torsoPos - targpos).magnitude > 4 then -- Check if we are stuck.
- GetDir()
- OldX = Xdir -- Goal direction.
- OldZ = Zdir
- Logic = 1 -- Impeded
- else
- if FireAtPlayer() then -- hit
- GetDir()
- OldX = Xdir -- Goal direction.
- OldZ = Zdir
- if FireDag() then
- Logic = 1 -- Go Left; Look Right.
- ClimbingLadder = true -- first time thru logic 1 indicator
- else
- targpos = torsoPos + Vector3.new(Xdag,0,Zdag) -- go Right
- end -- dagRight
- end -- hit?
- end -- impeded?
- else
- print(AIName, number, ": No target. - ", target)
- -- torsoPos = torsoPos * 2 -- Turn Impeded?, off
- -- Distance = 10
- end -- if no target?
- end -- Logic 0
- -- 1 - Look Right or Go left
- if Logic == 1 then
- if Distance >= 1 then
- if ClimbingLadder == false then -- or target.Position.y < torsoPos.y + 4 then
- TurnRight()
- end -- else go straight or go up
- else
- TurnLeft()
- end
- if FireRayAhead() then -- Check straight first. (And Diagonaly left)
- TurnLeft()
- if FireRay() then -- Check left (And Diagonaly left & back)
- TurnLeft()
- if FireRay() then
- TurnLeft()
- if FireRay() then
- targpos = torsoPos + Vector3.new(Xdir,0,Zdir)
- hum.Jump = true
- end -- right
- end -- Back
- end -- Left
- else -- If succesful Ahead then... (We only check RightTurns for a get-out-of-jail-Free card)
- if Xdir == OldX and OldZ == Zdir then -- Gracefully exiting Logic 1
- Logic = 0
- end -- check Goal dir?
- end -- Ahead
- end -- Logic 1
- -- go
- OldPos = torsoPos
- hum:MoveTo(targpos, targ) -- MoveToward Target
- --wait
- wait(BRAINWave)
- while FreeFalling do
- FreeFalling = false
- wait(.2)
- end
- end -- Main
- end))
- BoolValue33.Name = "GraphicsToggle"
- BoolValue33.Parent = Script32
- Script34.Name = "SCP049HeadSoundScript"
- Script34.Parent = Model0
- table.insert(cors,sandbox(Script34,function()
- --[[ By: Brutez ]]--
- local SCP049 = script.Parent;
- local SCP049Head = SCP049:FindFirstChild("Head");
- local SelectedSoundID = {187645728, 187645755, 187645778};
- local SelectedSounds = {};
- local HurtEnable = true;
- while true do
- Wait(0)
- SCP049RandomSound=math.random(1,1000)
- if SCP049RandomSound==10 or SCP049RandomSound==20 or SCP049RandomSound==30 then
- if HurtEnable==false then return end
- HurtEnable = false;
- local SCP049HurtSoundList = {"049_1", "049_2", "049_3", "049_4", "049_5", "049_6", "049_7", "049_8", "049_9","049_10"};
- local SelectedHurtSound = SCP049Head[math.random(1, #SCP049HurtSoundList)];
- SelectedHurtSound:Play()
- Wait(4)
- HurtEnable = true;
- end
- end
- end))
- Hat35.Name = "Mask"
- Hat35.Parent = Model0
- Hat35.AttachmentPos = Vector3.new(0, 0.400000006, 0.639999986)
- Part36.Name = "Handle"
- Part36.Parent = Hat35
- Part36.Material = Enum.Material.Fabric
- Part36.BrickColor = BrickColor.new("Black")
- Part36.Rotation = Vector3.new(0, -0.25, 0)
- Part36.CanCollide = false
- Part36.FormFactor = Enum.FormFactor.Symmetric
- Part36.Size = Vector3.new(1, 1, 2)
- Part36.CFrame = CFrame.new(-38.2467804, 15.4000101, -182.324646, 0.999990344, 0, -0.00439172285, 0, 1, 0, 0.00439172285, 0, 0.999990344)
- Part36.BottomSurface = Enum.SurfaceType.Smooth
- Part36.TopSurface = Enum.SurfaceType.Smooth
- Part36.Color = Color3.new(0.105882, 0.164706, 0.207843)
- Part36.Position = Vector3.new(-38.2467804, 15.4000101, -182.324646)
- Part36.Orientation = Vector3.new(0, -0.25, 0)
- Part36.Color = Color3.new(0.105882, 0.164706, 0.207843)
- SpecialMesh37.Parent = Part36
- SpecialMesh37.MeshId = "http://www.roblox.com/asset/?id=12472639"
- SpecialMesh37.Scale = Vector3.new(1.20000005, 1.20000005, 1.5)
- SpecialMesh37.TextureId = "http://www.roblox.com/asset/?id=189029251"
- SpecialMesh37.MeshType = Enum.MeshType.FileMesh
- SpecialMesh37.Scale = Vector3.new(1.20000005, 1.20000005, 1.5)
- Hat38.Name = "Hood"
- Hat38.Parent = Model0
- Hat38.AttachmentPos = Vector3.new(0, 0.200000003, 0)
- Part39.Name = "Handle"
- Part39.Parent = Hat38
- Part39.Material = Enum.Material.Fabric
- Part39.BrickColor = BrickColor.new("Black")
- Part39.Rotation = Vector3.new(0, -0.25, 0)
- Part39.CanCollide = false
- Part39.FormFactor = Enum.FormFactor.Symmetric
- Part39.Size = Vector3.new(1, 1, 2)
- Part39.CFrame = CFrame.new(-38.2495918, 15.6000099, -181.684647, 0.999990344, 0, -0.00439172285, 0, 1, 0, 0.00439172285, 0, 0.999990344)
- Part39.BottomSurface = Enum.SurfaceType.Smooth
- Part39.TopSurface = Enum.SurfaceType.Smooth
- Part39.Color = Color3.new(0.105882, 0.164706, 0.207843)
- Part39.Position = Vector3.new(-38.2495918, 15.6000099, -181.684647)
- Part39.Orientation = Vector3.new(0, -0.25, 0)
- Part39.Color = Color3.new(0.105882, 0.164706, 0.207843)
- SpecialMesh40.Parent = Part39
- SpecialMesh40.MeshId = "http://www.roblox.com/asset/?id=16952952"
- SpecialMesh40.Scale = Vector3.new(1, 1.14999998, 1.29999995)
- SpecialMesh40.TextureId = "http://www.roblox.com/asset/?id=189029867"
- SpecialMesh40.MeshType = Enum.MeshType.FileMesh
- SpecialMesh40.Scale = Vector3.new(1, 1.14999998, 1.29999995)
- Hat41.Name = "Eye"
- Hat41.Parent = Model0
- Hat41.AttachmentPos = Vector3.new(0.180000007, 0.449999988, 0.49000001)
- Part42.Name = "Handle"
- Part42.Parent = Hat41
- Part42.Material = Enum.Material.Fabric
- Part42.BrickColor = BrickColor.new("Black")
- Part42.Rotation = Vector3.new(0, -0.25, 0)
- Part42.CanCollide = false
- Part42.FormFactor = Enum.FormFactor.Custom
- Part42.Size = Vector3.new(0.5, 0.5, 0.5)
- Part42.CFrame = CFrame.new(-38.4274368, 15.3500099, -182.17543, 0.999990344, 0, -0.00439172285, 0, 1, 0, 0.00439172285, 0, 0.999990344)
- Part42.BottomSurface = Enum.SurfaceType.Smooth
- Part42.TopSurface = Enum.SurfaceType.Smooth
- Part42.Color = Color3.new(0.105882, 0.164706, 0.207843)
- Part42.Position = Vector3.new(-38.4274368, 15.3500099, -182.17543)
- Part42.Orientation = Vector3.new(0, -0.25, 0)
- Part42.Color = Color3.new(0.105882, 0.164706, 0.207843)
- SpecialMesh43.Parent = Part42
- SpecialMesh43.MeshId = "http://www.roblox.com/asset/?id=1185246"
- SpecialMesh43.Scale = Vector3.new(0.300000012, 0.300000012, 0.300000012)
- SpecialMesh43.TextureId = "http://www.roblox.com/asset/?id=189023804"
- SpecialMesh43.MeshType = Enum.MeshType.FileMesh
- SpecialMesh43.Scale = Vector3.new(0.300000012, 0.300000012, 0.300000012)
- Hat44.Name = "Eye"
- Hat44.Parent = Model0
- Hat44.AttachmentForward = Vector3.new(-0, 0, -0.99999994)
- Hat44.AttachmentPos = Vector3.new(-0.180000007, 0.449999988, 0.49000001)
- Part45.Name = "Handle"
- Part45.Parent = Hat44
- Part45.Material = Enum.Material.Fabric
- Part45.BrickColor = BrickColor.new("Black")
- Part45.Rotation = Vector3.new(0, -0.25, 0)
- Part45.CanCollide = false
- Part45.FormFactor = Enum.FormFactor.Custom
- Part45.Size = Vector3.new(0.5, 0.5, 0.5)
- Part45.CFrame = CFrame.new(-38.06744, 15.3500099, -182.173859, 0.999990344, 0, -0.00439172238, 0, 1, 0, 0.00439172285, 0, 0.999990284)
- Part45.BottomSurface = Enum.SurfaceType.Smooth
- Part45.TopSurface = Enum.SurfaceType.Smooth
- Part45.Color = Color3.new(0.105882, 0.164706, 0.207843)
- Part45.Position = Vector3.new(-38.06744, 15.3500099, -182.173859)
- Part45.Orientation = Vector3.new(0, -0.25, 0)
- Part45.Color = Color3.new(0.105882, 0.164706, 0.207843)
- SpecialMesh46.Parent = Part45
- SpecialMesh46.MeshId = "http://www.roblox.com/asset/?id=1185246"
- SpecialMesh46.Scale = Vector3.new(0.300000012, 0.300000012, 0.300000012)
- SpecialMesh46.TextureId = "http://www.roblox.com/asset/?id=189023804"
- SpecialMesh46.MeshType = Enum.MeshType.FileMesh
- SpecialMesh46.Scale = Vector3.new(0.300000012, 0.300000012, 0.300000012)
- Animation47.Name = "ArmOutAnim"
- Animation47.Parent = Model0
- Animation47.AnimationId = "rbxassetid://89134792"
- CharacterMesh48.Name = "Pilgrim Left Arm"
- CharacterMesh48.Parent = Model0
- CharacterMesh48.MeshId = 66229897
- CharacterMesh48.BodyPart = Enum.BodyPart.LeftArm
- CharacterMesh48.OverlayTextureId = 189033450
- CharacterMesh49.Name = "Pilgrim Right Arm"
- CharacterMesh49.Parent = Model0
- CharacterMesh49.MeshId = 66229924
- CharacterMesh49.BodyPart = Enum.BodyPart.RightArm
- CharacterMesh49.OverlayTextureId = 189033450
- CharacterMesh50.Name = "Pilgrim Torso"
- CharacterMesh50.Parent = Model0
- CharacterMesh50.MeshId = 66230010
- CharacterMesh50.BodyPart = Enum.BodyPart.Torso
- CharacterMesh50.OverlayTextureId = 189033450
- CharacterMesh51.Name = "WAI Left Leg"
- CharacterMesh51.Parent = Model0
- CharacterMesh51.MeshId = 106703213
- CharacterMesh51.BodyPart = Enum.BodyPart.LeftLeg
- CharacterMesh51.OverlayTextureId = 189033450
- CharacterMesh52.Name = "WAI RightLeg"
- CharacterMesh52.Parent = Model0
- CharacterMesh52.MeshId = 106703301
- CharacterMesh52.BodyPart = Enum.BodyPart.RightLeg
- CharacterMesh52.OverlayTextureId = 189033450
- Animation53.Name = "WalkAnim"
- Animation53.Parent = Model0
- Animation53.AnimationId = "rbxassetid://180426354"
- Script54.Name = "AnimateAny"
- Script54.Parent = Model0
- table.insert(cors,sandbox(Script54,function()
- -- Enemy by RangeMeludE --
- function waitForChild(parent, childName)
- while true do
- local child = parent:findFirstChild(childName)
- if child then
- return child
- end
- parent.ChildAdded:wait()
- end
- end
- ----------------------------- TEAM COLORS
- ----------------------------- ANIMATION
- -- declarations
- local Figure = script.Parent
- local Torso = waitForChild(Figure, "Torso")
- local RightShoulder = waitForChild(Torso, "Right Shoulder")
- local LeftShoulder = waitForChild(Torso, "Left Shoulder")
- local RightHip = waitForChild(Torso, "Right Hip")
- local LeftHip = waitForChild(Torso, "Left Hip")
- local Neck = waitForChild(Torso, "Neck")
- local Humanoid = nil -- Hack to Animate a Humanoid, no mateer what Humanoid is .Named.
- if true then
- local list = Figure:GetChildren() -- temp var.
- for x = 1, #list do
- local temp = list[x]
- if (temp.className == "Humanoid") then
- Humanoid = temp.Name
- end -- found Humanoid
- end -- Parts
- end -- Discard list
- local Humanoid = Figure[Humanoid]
- --local Humanoid = waitForChild(Figure, "Humanoid")
- local pose = "Standing"
- local toolAnim = "None"
- local toolAnimTime = 0
- local isSeated = false
- -- functions
- function onRunning(speed)
- if isSeated then return end
- if speed>0 then
- pose = "Running"
- else
- pose = "Standing"
- end
- end
- function onDied()
- pose = "Dead"
- end
- function onJumping()
- isSeated = false
- pose = "Jumping"
- end
- function onClimbing()
- pose = "Climbing"
- end
- function onGettingUp()
- pose = "GettingUp"
- end
- function onFreeFall()
- pose = "FreeFall"
- end
- function onFallingDown()
- pose = "FallingDown"
- end
- function onSeated()
- isSeated = true
- pose = "Seated"
- print("Seated")
- end
- function moveJump()
- RightShoulder.MaxVelocity = 0.5
- LeftShoulder.MaxVelocity = 0.5
- RightShoulder.DesiredAngle = 3.14
- LeftShoulder.DesiredAngle = -3.14
- RightHip.DesiredAngle = 0
- LeftHip.DesiredAngle = 0
- end
- function moveFreeFall()
- RightShoulder.MaxVelocity = 0.5
- LeftShoulder.MaxVelocity = 0.5
- RightShoulder.DesiredAngle = 1
- LeftShoulder.DesiredAngle = -1
- RightHip.DesiredAngle = 0
- LeftHip.DesiredAngle = 0
- end
- function moveClimb()
- RightShoulder.MaxVelocity = 0.5
- LeftShoulder.MaxVelocity = 0.5
- RightShoulder.DesiredAngle = -3.14
- LeftShoulder.DesiredAngle = 3.14
- RightHip.DesiredAngle = 0
- LeftHip.DesiredAngle = 0
- end
- function moveSit()
- print("Move Sit")
- RightShoulder.MaxVelocity = 0.15
- LeftShoulder.MaxVelocity = 0.15
- RightShoulder.DesiredAngle = 3.14 /2
- LeftShoulder.DesiredAngle = -3.14 /2
- RightHip.DesiredAngle = 3.14 /2
- LeftHip.DesiredAngle = -3.14 /2
- end
- function getTool()
- kidTable = Figure:children()
- if (kidTable ~= nil) then
- numKids = #kidTable
- for i=1,numKids do
- if (kidTable[i].className == "Tool") then return kidTable[i] end
- end
- end
- return nil
- end
- function getToolAnim(tool)
- c = tool:children()
- for i=1,#c do
- if (c[i].Name == "toolanim" and c[i].className == "StringValue") then
- return c[i]
- end
- end
- return nil
- end
- function animateTool()
- if (toolAnim == "None") then
- RightShoulder.DesiredAngle = 1.57
- return
- end
- if (toolAnim == "Slash") then
- RightShoulder.MaxVelocity = 0.5
- RightShoulder.DesiredAngle = 0
- return
- end
- if (toolAnim == "Lunge") then
- RightShoulder.MaxVelocity = 0.5
- LeftShoulder.MaxVelocity = 0.5
- RightHip.MaxVelocity = 0.5
- LeftHip.MaxVelocity = 0.5
- RightShoulder.DesiredAngle = 1.57
- LeftShoulder.DesiredAngle = 1.0
- RightHip.DesiredAngle = 1.57
- LeftHip.DesiredAngle = 1.0
- return
- end
- end
- function move(time)
- local amplitude
- local frequency
- if (pose == "Jumping") then
- moveJump()
- return
- end
- if (pose == "FreeFall") then
- moveFreeFall()
- return
- end
- if (pose == "Climbing") then
- moveClimb()
- return
- end
- if (pose == "Seated") then
- moveSit()
- return
- end
- RightShoulder.MaxVelocity = 0.15
- LeftShoulder.MaxVelocity = 0.15
- if (pose == "Running") then
- amplitude = 1
- frequency = 9
- else
- amplitude = 0.1
- frequency = 1
- end
- desiredAngle = amplitude * math.sin(time*frequency)
- RightShoulder.DesiredAngle = desiredAngle
- LeftShoulder.DesiredAngle = desiredAngle
- RightHip.DesiredAngle = -desiredAngle/4
- LeftHip.DesiredAngle = -desiredAngle/4
- local tool = getTool()
- if tool ~= nil then
- animStringValueObject = getToolAnim(tool)
- if animStringValueObject ~= nil then
- toolAnim = animStringValueObject.Value
- -- message recieved, delete StringValue
- animStringValueObject.Parent = nil
- toolAnimTime = time + .3
- end
- if time > toolAnimTime then
- toolAnimTime = 0
- toolAnim = "None"
- end
- animateTool()
- else
- toolAnim = "None"
- toolAnimTime = 0
- end
- end
- -- connect events
- Humanoid.Died:connect(onDied)
- Humanoid.Running:connect(onRunning)
- Humanoid.Jumping:connect(onJumping)
- Humanoid.Climbing:connect(onClimbing)
- Humanoid.GettingUp:connect(onGettingUp)
- Humanoid.FreeFalling:connect(onFreeFall)
- Humanoid.FallingDown:connect(onFallingDown)
- Humanoid.Seated:connect(onSeated)
- -- main program
- local nextTime = 0
- local runService = game:service("RunService");
- while Figure.Parent~=nil do
- time = runService.Stepped:wait()
- if time > nextTime then
- move(time)
- nextTime = time + .1
- end
- end
- end))
- for i,v in pairs(mas:GetChildren()) do
- v.Parent = workspace
- pcall(function() v:MakeJoints() end)
- end
- mas:Destroy()
- for i,v in pairs(cors) do
- spawn(function()
- pcall(v)
- end)
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement