Xtreme101
|
  |
| Joined: 03 Jan 2009 |
| Total Posts: 4385 |
|
|
| 23 Jul 2013 03:41 PM |
I tried, but failed, to make my own "Zombie" (follows and attacks a Character), but failed miserably. I wanted it to walk like a Character would, so I disected what makes a player walk and made my own for my infected. The scripts functions properly, but the limbs move in the wrong direction: side to side, parallel with the torso! Could anyone assist?
for index, child in pairs(script.Parent:GetChildren()) do if child.ClassName == "Part" then if child.Name ~= "Crystal" and child.Name ~= "Torso" then motor, cframe = Instance.new("Motor6D"), child.CFrame:toObjectSpace(script.Parent.Torso.CFrame) motor.Part0 = script.Parent.Torso motor.Part1 = child motor.C1 = cframe if child.Name == "Head" then motor.Name, motor.MaxVelocity = "Neck", 0.1 elseif child.Name == "LeftArm" then motor.Name, motor.MaxVelocity = "LeftShoulder", 0.75 elseif child.Name == "RightArm" then motor.Name, motor.MaxVelocity = "RightShoulder", 0.75 elseif child.Name == "LeftLeg" then motor.Name, motor.MaxVelocity = "LeftHip", 0.1 elseif child.Name == "RightLeg" then motor.Name, motor.MaxVelocity = "RightHip", 0.1 end motor.Parent = script.Parent.Torso elseif child.Name == "Crystal" then weld, cframe = Instance.new("Weld"), child.CFrame:toObjectSpace(script.Parent:findFirstChild(child.Link.Value).CFrame) weld.Name = "CrystalWeld" weld.Part0 = script.Parent:findFirstChild(child.Link.Value) weld.Part1 = child weld.C1 = cframe weld.Parent = script.Parent:findFirstChild(child.Link.Value) end child.CanCollide, child.Anchored = true, false end end weld = {} weld[1], weld[2], weld[3], weld[4] = script.Parent.Torso.LeftShoulder, script.Parent.Torso.RightShoulder, script.Parent.Torso.LeftHip, script.Parent.Torso.RightHip
coroutine.wrap(function() while true do local _, time = wait(0.1) desiredAngle = 1*math.sin(time*9) weld[1].DesiredAngle, weld[2].DesiredAngle, weld[3].DesiredAngle, weld[4].DesiredAngle = desiredAngle, desiredAngle, -desiredAngle, -desiredAngle wait() end end)()
|
|
|
| Report Abuse |
|
|
Absurdism
|
  |
| Joined: 18 Jul 2013 |
| Total Posts: 2568 |
|
|
| 23 Jul 2013 03:44 PM |
| That's strange. Are you sure the directions of every part are correct inside of the AI? |
|
|
| Report Abuse |
|
|
grantox
|
  |
| Joined: 26 Nov 2010 |
| Total Posts: 2314 |
|
|
| 23 Jul 2013 03:45 PM |
| Just rotate the bodyparts. |
|
|
| Report Abuse |
|
|
Xtreme101
|
  |
| Joined: 03 Jan 2009 |
| Total Posts: 4385 |
|
|
| 23 Jul 2013 03:46 PM |
| That was my first thought. Yes, they are correct. As funny as watching my humanoid dance is, it's not very threatening... |
|
|
| Report Abuse |
|
|
Xtreme101
|
  |
| Joined: 03 Jan 2009 |
| Total Posts: 4385 |
|
|
| 23 Jul 2013 03:51 PM |
| The wiki says "Do not use for new work". Nevermind! I think I'll start from scratch. |
|
|
| Report Abuse |
|
|
Xtreme101
|
  |
| Joined: 03 Jan 2009 |
| Total Posts: 4385 |
|
|
| 23 Jul 2013 03:56 PM |
| Okay, let's disregard that last post. Normal welds do the same thing. It must be where the weld connects the two parts. |
|
|
| Report Abuse |
|
|
Xtreme101
|
  |
| Joined: 03 Jan 2009 |
| Total Posts: 4385 |
|
|
| 23 Jul 2013 03:59 PM |
| I meant motors. Gah, my posts are a mess. Okay, they're not turning the right way and I still need help. |
|
|
| Report Abuse |
|
|
Absurdism
|
  |
| Joined: 18 Jul 2013 |
| Total Posts: 2568 |
|
|
| 23 Jul 2013 04:01 PM |
| Mess around with the angles. I'm not sure why it wouldn't be working... |
|
|
| Report Abuse |
|
|
Xtreme101
|
  |
| Joined: 03 Jan 2009 |
| Total Posts: 4385 |
|
|
| 23 Jul 2013 04:08 PM |
| I have a feeling ROBLOX uses both C0 and C1. I'm going to find out. |
|
|
| Report Abuse |
|
|
Xtreme101
|
  |
| Joined: 03 Jan 2009 |
| Total Posts: 4385 |
|
|
| 23 Jul 2013 04:15 PM |
I just found the problem. Look at this output.
> print(game.Workspace.Player1.Torso["Left Hip"].C1) -0.5, 1, 0, -0, -0, -1, 0, 1, 0, 1, 0, 0
> print(game.Workspace.Infected.Torso["LeftHip"].C1) 0.49999994, 2, 0, 0.999999881, 0, 1.78813934e-007, 0, 1, 0, -1.78813934e-007, 0, 0.999999881
Those are the motor's C1 values. The next part is I am COMPLETELY stumped on how to take that first value and set my own motor with it. I'm sure this is the problem. Can anyone help me? |
|
|
| Report Abuse |
|
|
blocco
|
  |
| Joined: 14 Aug 2008 |
| Total Posts: 29474 |
|
|
| 23 Jul 2013 04:21 PM |
| set the C1 of your left hip to the C1 of the player's character's left hip |
|
|
| Report Abuse |
|
|
Xtreme101
|
  |
| Joined: 03 Jan 2009 |
| Total Posts: 4385 |
|
|
| 23 Jul 2013 04:25 PM |
| Too late Blocco! That's what I did. I cloned the Player's motors, put them in lighting, and worked from there. I as this works perfectly, I would like to know how to take that long long number value thing and use that instead of unnecessary motors in my lighting. Anyone? |
|
|
| Report Abuse |
|
|
Xtreme101
|
  |
| Joined: 03 Jan 2009 |
| Total Posts: 4385 |
|
|
| 23 Jul 2013 04:37 PM |
| Hm. Okay, one more problem: the humanoid doesn't stay alive. |
|
|
| Report Abuse |
|
|
Xtreme101
|
  |
| Joined: 03 Jan 2009 |
| Total Posts: 4385 |
|
|
| 23 Jul 2013 04:49 PM |
| Okay, I'll just create a humanoid after the welds. I think I just solved this entire thing by myself, so I never actually needed this thread. |
|
|
| Report Abuse |
|
|
grantox
|
  |
| Joined: 26 Nov 2010 |
| Total Posts: 2314 |
|
|
| 24 Jul 2013 04:37 AM |
| That's why I don't post unIess I tried to do some extensive de-bugging and I can't get anywhere. |
|
|
| Report Abuse |
|
|