Page 2 of 2

Re: Spawn movement

Posted: Thu Feb 15, 2018 7:51 pm
by Cynnar
Try changing the + and - values maybe. From what I see here you get the npc x location add one then next movement you get the npc location minus one. Then minus one again

Re: Spawn movement

Posted: Thu Feb 15, 2018 7:56 pm
by Jabantiz
I have never seen spawns walk backwards before, in fact I think the client takes care of the heading when a spawn walks. That said the difference in location is tiny so it may not have a chance to really rotate a spawn but that is just a guess. At most you have a difference of 2 on one axis, 10 is usually right in the face of the spawn, try bumping the +/- 1 and see if you get the same results.

Re: Spawn movement

Posted: Thu Feb 15, 2018 8:18 pm
by Plague

Code: Select all

function spawn(NPC)
	local x = GetX(NPC)
	local y = GetY(NPC)
	local z = GetZ(NPC)
	MovementLoopAddLocation(NPC, x + 10 , y, z - 10 , 1, math.random(5, 15))
	MovementLoopAddLocation(NPC, x - 10 , y, z - 10 , 1, math.random(5, 15))
	MovementLoopAddLocation(NPC, x - 10 , y, z + 10 , 1, math.random(5, 15))
	MovementLoopAddLocation(NPC, x + 10 , y, z + 10 , 1, math.random(5, 15))
end

function respawn(NPC)
	spawn(NPC)
end
Its your basic square movement, to keep them in a small area but look alive.
Now they are moonwalking for a long ways.
This works just fine, callously borrowed from generic tiny_movement_loop.

Code: Select all

	local x = GetX(NPC)
	local y = GetY(NPC)
	local z = GetZ(NPC)
	MovementLoopAddLocation(NPC, x - 2, y, z + 4, 1, math.random(5, 15))
	MovementLoopAddLocation(NPC, x + 3, y, z + 1, 1, math.random(5, 15))
	MovementLoopAddLocation(NPC, x    , y, z - 2, 1, math.random(5, 15))
	MovementLoopAddLocation(NPC, x - 5, y, z - 1, 1, math.random(5, 15))

Re: Spawn movement

Posted: Thu Feb 15, 2018 9:06 pm
by Cynnar
Plague wrote: Thu Feb 15, 2018 8:18 pm This works just fine, callously borrowed from generic tiny_movement_loop.
So if you place the code from tiny_movement_loop in place of your code it works? Not using the tiny_movement_loop script, but changing your script.

Is there a reason you are not wanting to use tiny_movement_loop script?

Re: Spawn movement

Posted: Thu Feb 15, 2018 9:42 pm
by Plague
No reason, it was just a learning process.
I plan on making a moonwalking bear later tho.

Re: Spawn movement

Posted: Thu Feb 15, 2018 9:47 pm
by Cynnar
Ah ok. I don't know why it's happening tbh.

Re: Spawn movement

Posted: Fri Feb 16, 2018 1:08 pm
by Ememjr
if they are truly walking backwards then it could have to do with the spawn it self not knowing what is front and what is back, kinda like when it client gets 0 heading and 180 heading mixed up