Page 1 of 1

NPC Roaming

Posted: Thu Apr 28, 2016 8:23 pm
by Gangrenous
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.

Re: NPC Roaming

Posted: Thu Apr 28, 2016 8:39 pm
by Jabantiz
In SpawnScripts/Generic there are several movement scripts, for example MovementCircleSmall.lua

Re: NPC Roaming

Posted: Thu Apr 28, 2016 9:26 pm
by Gangrenous
Jabantiz wrote:In SpawnScripts/Generic there are several movement scripts, for example MovementCircleSmall.lua
Knowledge is power, thanks man

Re: NPC Roaming

Posted: Fri Apr 29, 2016 6:17 am
by Gangrenous
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.

Re: NPC Roaming

Posted: Fri Apr 29, 2016 6:29 am
by Gangrenous
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

Re: NPC Roaming

Posted: Fri Apr 29, 2016 1:09 pm
by Jabantiz
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.

Re: NPC Roaming

Posted: Fri Apr 29, 2016 6:08 pm
by xinux
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.