NPC Roaming

General support forum. If you require assistance and your problem doesnt fall in any of the other categories, this is the forum for you!

Moderator: Team Members

Forum rules
READ THE FORUM STICKY THREADS BEFORE ASKING FOR HELP!
Most information can be found there, and if not, the posts will help you determine the information required to get assistance from the development team.
Incomplete Help Requests will be locked or deleted.
Post Reply
User avatar
Gangrenous
Posts: 812
Joined: Sun Apr 24, 2016 6:54 am
Characters: Dinsmoor

NPC Roaming

Post by Gangrenous » Thu Apr 28, 2016 8:23 pm

Is there already a function to have an NPC wander in a given area? I would think I could easily do it in lua, probably even make a generic LUA script and do require. If there is already a script it may be more robust than I can write.
Resident Dirty Hippy

Jabantiz
Lead Developer
Posts: 2912
Joined: Wed Jul 25, 2007 2:52 pm
Location: California

Re: NPC Roaming

Post by Jabantiz » Thu Apr 28, 2016 8:39 pm

In SpawnScripts/Generic there are several movement scripts, for example MovementCircleSmall.lua

User avatar
Gangrenous
Posts: 812
Joined: Sun Apr 24, 2016 6:54 am
Characters: Dinsmoor

Re: NPC Roaming

Post by Gangrenous » Thu Apr 28, 2016 9:26 pm

Jabantiz wrote:In SpawnScripts/Generic there are several movement scripts, for example MovementCircleSmall.lua
Knowledge is power, thanks man
Resident Dirty Hippy

User avatar
Gangrenous
Posts: 812
Joined: Sun Apr 24, 2016 6:54 am
Characters: Dinsmoor

Re: NPC Roaming

Post by Gangrenous » Fri Apr 29, 2016 6:17 am

Loving the RandomPatternSmall. I am being blown away with what I am going to be able to do as far as world building, plus the design is going to allow to me to add in infinite scripts to make it robust. Question, as far as waypoints go is there is a system in place to do it more easily? Since it has to be done in Lua as per previous post I dug up, there has got to be a way to at least speed up the process. I really wish it was more visual, even being able to show current waypoints with visual placeholders. I mean it is not the end of the world, I can still do it but I will have thousands to do.
Resident Dirty Hippy

User avatar
Gangrenous
Posts: 812
Joined: Sun Apr 24, 2016 6:54 am
Characters: Dinsmoor

Re: NPC Roaming

Post by Gangrenous » Fri Apr 29, 2016 6:29 am

Random question though. In SpawnScripts/Generic/random_pattern_small.lua

Code: Select all

function RouteOne(NPC, Spawn)
    local X = GetX(NPC)
	local Y = GetY(NPC)
	local Z = GetZ(NPC)
    MovementLoopAddLocation(NPC, X, Y, Z, 2, math.random(2,10))
    MovementLoopAddLocation(NPC, X + 4, Y, Z, 2, math.random(20,45))
	MovementLoopAddLocation(NPC, X + 4, Y, Z[color=#FF0000] + 4[/color], 2, math.random(20,45))
	MovementLoopAddLocation(NPC, X + 7, Y, Z, 2, math.random(20,45))
	MovementLoopAddLocation(NPC, X + 4, Y, Z[color=#FF0000] + 4[/color], 2, math.random(20,45))
	MovementLoopAddLocation(NPC, X, Y, Z, 2, math.random(20,45))
end
Shouldn't you be going in different directions on the X and Y axis? Z axis for me is traditionally up and down, not side to side.

Code: Select all

function RouteOne(NPC, Spawn)
    local X = GetX(NPC)
	local Y = GetY(NPC)
	local Z = GetZ(NPC)
    MovementLoopAddLocation(NPC, X, Y, Z, 2, math.random(2,10))
    MovementLoopAddLocation(NPC, X + 4, Y, Z, 2, math.random(20,45))
	MovementLoopAddLocation(NPC, X + 4, Y[color=#FF0000] + 4[/color], Z, 2, math.random(20,45))
	MovementLoopAddLocation(NPC, X + 7, Y, Z, 2, math.random(20,45))
	MovementLoopAddLocation(NPC, X + 4, Y[color=#FF0000] + 4[/color], Z, 2, math.random(20,45))
	MovementLoopAddLocation(NPC, X, Y, Z, 2, math.random(20,45))
end
Last edited by Jabantiz on Fri Apr 29, 2016 1:01 pm, edited 1 time in total.
Reason: Put code in [code] bocks
Resident Dirty Hippy

Jabantiz
Lead Developer
Posts: 2912
Joined: Wed Jul 25, 2007 2:52 pm
Location: California

Re: NPC Roaming

Post by Jabantiz » Fri Apr 29, 2016 1:09 pm

In eq2 Y is up and down. Also if you were to change y the client will show it on the ground any way, client will always drag it to the level geometry, need to set the y_offset to get something to float in the air fyi.

For creating paths there really is no simple way to do it. The only way I could think of speeding it up is to turn the text logging on in game and run the path do /loc every time the npc would stop or change direction slightly then make a program to parse that log.

User avatar
xinux
Team Member
Posts: 680
Joined: Wed Mar 10, 2010 11:10 am
Location: Destroyer of Servers

Re: NPC Roaming

Post by xinux » Fri Apr 29, 2016 6:08 pm

The only way I could think of speeding it up is to turn the text logging on in game and run the path do /loc every time the npc would stop or change direction slightly then make a program to parse that log.
Yup i created one for the content folks over at VGOEmu they just spam the location hotkey while moving when they are done they parse the log file and it spit's it out nice and neat then they just have to paste it into the lua script.
EQ II - Build=1360 (Orig) - Build=1360 (DoF) - Build=2654 (KoS) - Build=3375 (Classic) - Build=3554 (EoF)
EQ II - Build=4412 (RoK) - Build=5122 (TSO) - Build=6118 (SF) - Build=7628 (DoV) - Build=8295 (Aod)

Post Reply

Who is online

Users browsing this forum: No registered users and 0 guests