Spawn movement

Discussions of the design and development of in-game content.

Moderator: Team Members

Plague
Posts: 68
Joined: Mon Jun 29, 2015 3:17 pm
EQ2Emu Server: WiP

Spawn movement

Post by Plague » Fri Jan 26, 2018 12:05 am

After a lively discussion on discord I still have questions.

Was discussed for some time but is there a way to make the Spawn Stop Movement and FaceTarget, like when hailed, when it is in a MovementLoop?

I'm also having trouble getting 2 spawns to follow a primary spawn around without wandering off if the primary is stopped for whatever reason ,attacked in this case. The Spawn in question is Baron Dracious and his 2 guard dogs.

And lastly ,at least for now, I have around thirt spawns wandering around East Freeport now and every time they run into each other they start jumping around eventually pathing off, is there a way to make a MovementLoop path to an approximint destinition?

Code: Select all

function spawn(NPC)
  MovementLoopAddLocation(NPC, -202.57, -56.07, 32.62, 1, math.random(5, 15))
  MovementLoopAddLocation(NPC, -212.03, -56.07, -3.67, 1, math.random(5, 15))
end
Can make the pause time random can you do it for x/y/z too? that would give their walking around a truly random appearance.

Code: Select all

function spawn(NPC)
  MovementLoopAddLocation(NPC, math.random(-200.01, -202.57), math.random(-50.02, -56.07), math.random(30.05, 32.62), 1, math.random(5, 15))
end
Wish I were not at work and could test this and other things.

tyrbo
Team Member
Posts: 271
Joined: Thu Feb 18, 2016 12:33 pm

Re: Spawn movement

Post by tyrbo » Fri Jan 26, 2018 6:19 am

The random calculation would only happen once.

Otherwise, the Lua function I provided in Discord can be used to stop a mobs pathing.

User avatar
Cynnar
Project Leader
Posts: 738
Joined: Sat Sep 27, 2014 1:22 am
EQ2Emu Server: Eq2emulator
Characters: Vlash
Veinlash
Taragak
Cynnar

Re: Spawn movement

Post by Cynnar » Fri Jan 26, 2018 5:37 pm

Plague wrote: Fri Jan 26, 2018 12:05 am Can make the pause time random can you do it for x/y/z too?
Are you talking about making the path random like the movement_circle_small.lua script?

Code: Select all

	local x = GetX(NPC)
	local y = GetY(NPC)
	local z = GetZ(NPC)
	
	local random = math.random(2, 12))
	
	MovementLoopAddLocation(NPC, x + random , y, z - random , 2, math.random(5, 15))
I didn't test this, but it should be close.
tyrbo wrote: Fri Jan 26, 2018 6:19 am The random calculation would only happen once
That is correct. You will need to add a MovementLoopAddLocation() for each waypoint you want.
[ 01000011 01111001 01101110 01101110 01100001 01110010 ]

Follow on:
Twitter Facebook

Contact me:
PM Discord chat email

Hardware: the parts of a computer that can be kicked

Plague
Posts: 68
Joined: Mon Jun 29, 2015 3:17 pm
EQ2Emu Server: WiP

Re: Spawn movement

Post by Plague » Fri Jan 26, 2018 6:55 pm

Oh I like that, solves one problem I'm having.

Code: Select all

	local effect = math.random(2, 4)

function spawn(NPC)
  MovementLoopAddLocation(NPC, -98.41+effect, -37.71, -2.44+effect, 1, math.random(5, 15))
  MovementLoopAddLocation(NPC, -101.38+effect, -37.71, 3.20+effect, 1, math.random(5, 15))
end

Plague
Posts: 68
Joined: Mon Jun 29, 2015 3:17 pm
EQ2Emu Server: WiP

Re: Spawn movement

Post by Plague » Wed Feb 07, 2018 6:39 pm

So how do you keep your spawns from walking in the air or underground?

tyrbo
Team Member
Posts: 271
Joined: Thu Feb 18, 2016 12:33 pm

Re: Spawn movement

Post by tyrbo » Wed Feb 07, 2018 6:50 pm

That's a work in process. Same with preventing mobs from walking through walls.

[mention]Jabantiz[/mention] had a work in progress bit of code (re: parsing the zone geo data from an uncompressed EQ2 install) that would allow us to eventually handle pathing better, but I'm not sure what the status of that is.

[mention]Jabantiz[/mention], any chance you're willing to open source the map generator yet so others can make some progress with it?

Plague
Posts: 68
Joined: Mon Jun 29, 2015 3:17 pm
EQ2Emu Server: WiP

Re: Spawn movement

Post by Plague » Thu Feb 08, 2018 4:09 pm

So the game knows when a player character is walking, swimming, etc and does not let us walk under the ground on in the air. I take it PCs and NPC movements are handled differently.

tyrbo
Team Member
Posts: 271
Joined: Thu Feb 18, 2016 12:33 pm

Re: Spawn movement

Post by tyrbo » Thu Feb 08, 2018 5:50 pm

Right. That type of detection for players is handled by the server, and then the player position is sent by the client to the server.

NPC movement is entirely controlled by the server. Until the server is able to take advantage of zone geometry information, it can't determine whether a mob is in a valid position or not.

Plague
Posts: 68
Joined: Mon Jun 29, 2015 3:17 pm
EQ2Emu Server: WiP

Re: Spawn movement

Post by Plague » Thu Feb 15, 2018 6:21 pm

So I noticed today that some of my spawns are walking backwards, not all the time but about half the time. Any good suggestions to make them walk forwards?

User avatar
Cynnar
Project Leader
Posts: 738
Joined: Sat Sep 27, 2014 1:22 am
EQ2Emu Server: Eq2emulator
Characters: Vlash
Veinlash
Taragak
Cynnar

Re: Spawn movement

Post by Cynnar » Thu Feb 15, 2018 6:33 pm

Never seen that. Is there a movement loop function in the script?
[ 01000011 01111001 01101110 01101110 01100001 01110010 ]

Follow on:
Twitter Facebook

Contact me:
PM Discord chat email

Hardware: the parts of a computer that can be kicked

tyrbo
Team Member
Posts: 271
Joined: Thu Feb 18, 2016 12:33 pm

Re: Spawn movement

Post by tyrbo » Thu Feb 15, 2018 6:42 pm

Can't say I've seen that before either.

User avatar
Cynnar
Project Leader
Posts: 738
Joined: Sat Sep 27, 2014 1:22 am
EQ2Emu Server: Eq2emulator
Characters: Vlash
Veinlash
Taragak
Cynnar

Re: Spawn movement

Post by Cynnar » Thu Feb 15, 2018 6:46 pm

Maybe it's trying to do the moonwalk!
[ 01000011 01111001 01101110 01101110 01100001 01110010 ]

Follow on:
Twitter Facebook

Contact me:
PM Discord chat email

Hardware: the parts of a computer that can be kicked

Plague
Posts: 68
Joined: Mon Jun 29, 2015 3:17 pm
EQ2Emu Server: WiP

Re: Spawn movement

Post by Plague » Thu Feb 15, 2018 6:59 pm

Not much to the script. Just to keep them moving about in a small area.

Code: Select all

function hailed(NPC, Spawn)
    FaceTarget(NPC, Spawn)
end

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

function respawn(NPC)
	spawn(NPC)

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

User avatar
Cynnar
Project Leader
Posts: 738
Joined: Sat Sep 27, 2014 1:22 am
EQ2Emu Server: Eq2emulator
Characters: Vlash
Veinlash
Taragak
Cynnar

Re: Spawn movement

Post by Cynnar » Thu Feb 15, 2018 7:09 pm

You don't need to put it all in the function respawn()

Code: Select all

function respawn(NPC)
	spawn(NPC)
end
This line will call the function spawn(NPC) when the npc respawns.
[ 01000011 01111001 01101110 01101110 01100001 01110010 ]

Follow on:
Twitter Facebook

Contact me:
PM Discord chat email

Hardware: the parts of a computer that can be kicked

Plague
Posts: 68
Joined: Mon Jun 29, 2015 3:17 pm
EQ2Emu Server: WiP

Re: Spawn movement

Post by Plague » Thu Feb 15, 2018 7:40 pm

Thanks, tho my wolves are still moonwalking. I dunno why.

Post Reply

Who is online

Users browsing this forum: No registered users and 0 guests