Is it possible to get a Move command for NPCs to wander within the confines of their area randomly? Like fish swimming in their ponds, deer wandering around the meadow. Maybe we can set up safe "bounds" that they can walk in, and they just randomly pick x,y,z,heading,delay themselves.
I still haven't figured out how to get "patrols" to stick together... I think we talked about it, but not sure if that got implemented yet.
LUA function for random wanderings
- John Adams
- Retired
- Posts: 9684
- Joined: Thu Jul 26, 2007 6:27 am
- EQ2Emu Server: EQ2Emulator Test Center
- Characters: John
- Location: Arizona
- Contact:
- John Adams
- Retired
- Posts: 9684
- Joined: Thu Jul 26, 2007 6:27 am
- EQ2Emu Server: EQ2Emulator Test Center
- Characters: John
- Location: Arizona
- Contact:
Random wanderings has been figured out by Scatman's patience, resolve, and sheer will power to make deer scatter in all directions. 
Here's a sample, for anyone else looking for seemingly random wander paths:
You can probably randomize x and z as well if you know your boundaries.
Thank you Scatman!
Here's a sample, for anyone else looking for seemingly random wander paths:
Code: Select all
--[[
Script Name : circle_clockwise_small_01.lua
Script Purpose : Makes the spawn do a small circle in a clockwise fashion.
Script Author : Scatman
Script Date : 2008-08-26
Script Notes : If the coords are out of bounds then the spawn will still go there.
--]]
function spawn(NPC)
x = GetX(NPC)
y = GetY(NPC)
z = GetZ(NPC)
MovementLoopAddLocation(NPC, x + 7 , y, z - 8 , 2, math.random(5, 15))
MovementLoopAddLocation(NPC, x - 5 , y, z - 10, 2, math.random(5, 15))
MovementLoopAddLocation(NPC, x - 10, y, z + 9 , 2, math.random(5, 15))
MovementLoopAddLocation(NPC, x + 5 , y, z + 8 , 2, math.random(5, 15))
end
function respawn(NPC)
spawn(NPC)
end
function hailed(NPC, Spawn)
FaceTarget(NPC, Spawn)
endThank you Scatman!
- Scatman
- Retired
- Posts: 1688
- Joined: Wed Apr 16, 2008 5:44 am
- EQ2Emu Server: Scatman's Word
- Characters: Scatman
- Location: New Jersey
Who is online
Users browsing this forum: No registered users and 0 guests