generic image
Processing...
  • Games
  • Catalog
  • Develop
  • Robux
  • Search in Players
  • Search in Games
  • Search in Catalog
  • Search in Groups
  • Search in Library
  • Log In
  • Sign Up
  • Games
  • Catalog
  • Develop
  • Robux
   
ROBLOX Forum » Game Creation and Development » Scripting Helpers
Home Search
 

Re: help with rpg

Previous Thread :: Next Thread 
greatestdan is not online. greatestdan
Joined: 08 Sep 2008
Total Posts: 504
17 Sep 2011 10:05 PM
Hey. I am working on anrpg but there is a problem. when a monster has a hat on then they fall down and can't get up. The hat isn't anchored and it isn't because of the weight of the hat. I tried with a normal hat that they are wearing. then I tried to make the hat 0.2x0.2x0.2, cancollide off, no hat (just the brick), cframed it inside the head, and welded it to the head. but they still fall down. I put this in scripting helpers because I believe scripters would understand problems better than builders.
Report Abuse
greatestdan is not online. greatestdan
Joined: 08 Sep 2008
Total Posts: 504
17 Sep 2011 10:07 PM
extra info: they walk fine in solo mode so would simply using a localscript instead of a regular script for the animate script work? but they have the same scripts as every other monster but the only difference is they have hats.
Report Abuse
MrGamer100 is not online. MrGamer100
Joined: 06 Jun 2008
Total Posts: 72
17 Sep 2011 10:25 PM
I've never heard of this kind of problem. Try a local script for the Animate portion and see if it works. The only thing I could guess that would be the problem is the weight of the hat, but you say that's not the issue.
Report Abuse
greatestdan is not online. greatestdan
Joined: 08 Sep 2008
Total Posts: 504
17 Sep 2011 10:37 PM
yea I am pretty sure a 0.2x0.2x0.2 brick would affect it that much.
Report Abuse
greatestdan is not online. greatestdan
Joined: 08 Sep 2008
Total Posts: 504
17 Sep 2011 10:42 PM
nope. didn't fix it.
Report Abuse
SarahAngel is not online. SarahAngel
Joined: 12 Dec 2009
Total Posts: 2166
17 Sep 2011 10:48 PM
There is probably something wrong with the welding.


~SarahAngel(:
Report Abuse
greatestdan is not online. greatestdan
Joined: 08 Sep 2008
Total Posts: 504
17 Sep 2011 10:49 PM
if the problem is the welding then it wouldn't have happened when the monster was just wearing the hat.
Report Abuse
SarahAngel is not online. SarahAngel
Joined: 12 Dec 2009
Total Posts: 2166
17 Sep 2011 10:54 PM
What does that mean?

~SarahAngel(:
Report Abuse
greatestdan is not online. greatestdan
Joined: 08 Sep 2008
Total Posts: 504
17 Sep 2011 10:56 PM
I had the monster wear the hat at first. then I saw the glitch and thought it was because of the weight of the hat. so I shrank the size of the brick and put it in the head.
Report Abuse
SarahAngel is not online. SarahAngel
Joined: 12 Dec 2009
Total Posts: 2166
17 Sep 2011 11:02 PM
Are you building in studio? If so, then the monster isn't tripping because it's paused. >.>

~SarahAngel(:
Report Abuse
greatestdan is not online. greatestdan
Joined: 08 Sep 2008
Total Posts: 504
17 Sep 2011 11:03 PM
did you even read it? the monster moves and chases you but as soon as he touches anything (including you) he falls over and can't get back up.
Report Abuse
SarahAngel is not online. SarahAngel
Joined: 12 Dec 2009
Total Posts: 2166
17 Sep 2011 11:09 PM
You said it just trips non-stop when it walks. You didn't say it tripps when it touched someone. Can you tell me what really happened? -.-

~SarahAngel(:
Report Abuse
greatestdan is not online. greatestdan
Joined: 08 Sep 2008
Total Posts: 504
17 Sep 2011 11:18 PM
Hey. I am working on anrpg but there is a problem. when a monster has a hat on then they fall down and can't get up.

that is exactly what I said. and it is what happens. when the monster touches anything it falls over and can't walk or get up.
Report Abuse
Arthur123 is not online. Arthur123
Joined: 01 Jun 2008
Total Posts: 5347
17 Sep 2011 11:21 PM
"when the monster touches anything it falls over and can't walk or get up"

Sounds to me as if it's programmed to do that, you checked the monster programming FIRST?
Report Abuse
greatestdan is not online. greatestdan
Joined: 08 Sep 2008
Total Posts: 504
17 Sep 2011 11:29 PM
the scripts inside it are exactly the same as the scripts in another monster that has no hat. I am certain of that because I even deleted the scripts inside it and replaced themwith the ones that were in a working monster. just to make sure the script wasn't messed with at all.
Report Abuse
Arthur123 is not online. Arthur123
Joined: 01 Jun 2008
Total Posts: 5347
17 Sep 2011 11:31 PM
Which DOESN'T mean it's not programmed to function as you've described when faced with your given circumstances... you see what I'm saying? (Although possibly I could be wrong, but my doubts are against that.)
Report Abuse
greatestdan is not online. greatestdan
Joined: 08 Sep 2008
Total Posts: 504
17 Sep 2011 11:35 PM
I do not understand you. the monster worked perfectly. then I put the hat on it and it started falling over. I know it is not because of the weight of the hat because I made it as small as you could possibly make it.
Report Abuse
Arthur123 is not online. Arthur123
Joined: 01 Jun 2008
Total Posts: 5347
17 Sep 2011 11:37 PM
Basically what I'm saying is, in fact - if my sentiments are correct, what I think it's doing is setting that hat as a target, and since it can't reach it - it tips over with the hat.

That's ONE possibility.

Does this help clear up what I'm saying? It could & probably IS PROGRAMMED that way... to do whatever it's doing... errr, maybe looking at the script will help, although if it's too long... .
Report Abuse
greatestdan is not online. greatestdan
Joined: 08 Sep 2008
Total Posts: 504
17 Sep 2011 11:45 PM
I am pretty sure that's not the problem. The idea of the chase script is that it finds someone with a humanoid named "Humanoid" then follows them around. and if it was also looking for hats then that wouldn't be the problem either because it isn't even in the form of a hat now right now it is just a block with a mesh that has been cframed inside the head.
Report Abuse
greatestdan is not online. greatestdan
Joined: 08 Sep 2008
Total Posts: 504
17 Sep 2011 11:47 PM
if you want them then here is the animate script. Chase script will be in next post.
btw this is 485 lines.


function waitForChild(parent, childName)

while true do

local child = parent:findFirstChild(childName)

if child then

return child

end

parent.ChildAdded:wait()

end

end

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 = 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



-- same as jump for now

function moveFreeFall()

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 == "Seated") then

moveSit()

return

end



local climbFudge = 0



if (pose == "Running") then

RightShoulder.MaxVelocity = 0.15

LeftShoulder.MaxVelocity = 0.15

amplitude = 1

frequency = 9

elseif (pose == "Climbing") then

RightShoulder.MaxVelocity = 0.5

LeftShoulder.MaxVelocity = 0.5

amplitude = 1

frequency = 9

climbFudge = 3.14

else

amplitude = 0.1

frequency = 1

end



desiredAngle = amplitude * math.sin(time*frequency)



RightShoulder.DesiredAngle = desiredAngle + climbFudge

LeftShoulder.DesiredAngle = desiredAngle - climbFudge

RightHip.DesiredAngle = -desiredAngle

LeftHip.DesiredAngle = -desiredAngle





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 + 0.1

end

end
Report Abuse
Arthur123 is not online. Arthur123
Joined: 01 Jun 2008
Total Posts: 5347
17 Sep 2011 11:47 PM
Hmmm.... I'm not sure then, according to the info you provided - they _should_ be working, you must be overlooking something (which is VERY common among us programmers, lol).
Report Abuse
greatestdan is not online. greatestdan
Joined: 08 Sep 2008
Total Posts: 504
17 Sep 2011 11:48 PM
and heres the chase script (only about 40 lines)


local larm = script.Parent:FindFirstChild("Left Arm")
local rarm = script.Parent:FindFirstChild("Right Arm")

function findNearestTorso(pos)
local list = game.Workspace:children()
local torso = nil
local dist = 10 ---HOW LONG WILL THE MONSTER SEE
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:TakeDamage(15) ---CHANGE THIS NUMBER TO MODIFY THE DAMAGE OF THE MONSTER
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.Monster:MoveTo(target.Position, target)----CHANGE THE MONSTER ON THIS LINE ON WAT NAME U REPLACED AT THE MONSTER
end
end
Report Abuse
Arthur123 is not online. Arthur123
Joined: 01 Jun 2008
Total Posts: 5347
17 Sep 2011 11:56 PM
Ok, tell me this: does the monster do the 'glitch' when you JUST put a hat on him, or is it when he touches ANYTHING with ANY part of his body? Also, is the 'hat' INSIDE the Monster Model?
Report Abuse
greatestdan is not online. greatestdan
Joined: 08 Sep 2008
Total Posts: 504
17 Sep 2011 11:59 PM
well I didn't test him the instant I put the hat on him but whenever he touches anything besides the ground (your body, path, wall, tree, etc.) he falls over. and sometimes when he spawns his legs fall through the ground but they ar still attatched to him.
Report Abuse
greatestdan is not online. greatestdan
Joined: 08 Sep 2008
Total Posts: 504
18 Sep 2011 12:02 AM
ok I belive that I have proven it wasn't because he was wearing a hat. I dropped a hat on the head of another monste's head and he didn't fall over.
Report Abuse
Previous Thread :: Next Thread 
Page 1 of 1
 
 
ROBLOX Forum » Game Creation and Development » Scripting Helpers
   
 
   
  • About Us
  • Jobs
  • Blog
  • Parents
  • Help
  • Terms
  • Privacy

©2017 Roblox Corporation. Roblox, the Roblox logo, Robux, Bloxy, and Powering Imagination are among our registered and unregistered trademarks in the U.S. and other countries.



Progress
Starting Roblox...
Connecting to Players...
R R

Roblox is now loading. Get ready to play!

R R

You're moments away from getting into the game!

Click here for help

Check Remember my choice and click Launch Application in the dialog box above to join games faster in the future!

Gameplay sponsored by:
Loading 0% - Starting game...
Get more with Builders Club! Join Builders Club
Choose Your Avatar
I have an account
generic image