LUA Movement Script example

Tutorials on setting up a server, configuring your client, and connecting to an EQ2Emulator server.
Only moderators can start new topics here
Forum rules
Most information about EQ2Emulator and Tutorials can be found at the Project Wiki. Look there for the most current information.
Locked
User avatar
ZexisStryfe
Posts: 1026
Joined: Thu Jul 26, 2007 6:39 am
EQ2Emu Server: Sytherian Legends
Location: Connecticut
Contact:

LUA Movement Script example

Post by ZexisStryfe » Fri Aug 07, 2009 5:37 am

Scatman wrote:Sometime this weekend I'll try to get a spawnscript tutorial out here incase you guys need some help with it.
Knowing how to script NPC paths would be awesome Scat...
~ EQ2 Emulator Project Manager

Image
Image
Image
"Zexis, from this day forth, you shall be known as... '3 of 6'" - John Adams

User avatar
Scatman
Retired
Posts: 1688
Joined: Wed Apr 16, 2008 5:44 am
EQ2Emu Server: Scatman's Word
Characters: Scatman
Location: New Jersey

Re: Simple Quest Script

Post by Scatman » Fri Aug 07, 2009 6:12 am

Generically? or a set path? I have a script I wrote to make NPCs move around the area they spawn but since there is no collison detection it's possible they can walk through walls/trees/etc heh.

User avatar
John Adams
Retired
Posts: 9684
Joined: Thu Jul 26, 2007 6:27 am
EQ2Emu Server: EQ2Emulator Test Center
Characters: John
Location: Arizona
Contact:

Re: Simple Quest Script

Post by John Adams » Fri Aug 07, 2009 9:26 am

Movement:

Code: Select all

function spawn(NPC)
	--Syntax is NPC, x, y, z, speed, delay (in seconds)
	MovementLoopAddLocation(NPC, 21.09, -5.30, 161.75, 3, 10)
	MovementLoopAddLocation(NPC, 21.18, -5.28, 144.12, 3, 0)
	MovementLoopAddLocation(NPC, 16.59, -5.27, 133.36, 3, 0)
	MovementLoopAddLocation(NPC, 10.50, -5.24, 114.47, 3, 0)
	MovementLoopAddLocation(NPC, 6.95, -5.22, 103.47, 3, 0)
	MovementLoopAddLocation(NPC, -25.22, -5.10, 100.19, 3, 0)
	MovementLoopAddLocation(NPC, -52.38, -5.79, 108.30, 3, 30)
	MovementLoopAddLocation(NPC, -55.46, -4.91, 131.16, 3, 0)
	MovementLoopAddLocation(NPC, -46.75, -5.04, 157.32, 3, 0)
	MovementLoopAddLocation(NPC, -23.70, -5.12, 176.13, 3, 0)
	MovementLoopAddLocation(NPC, -9.30, -5.20, 186.68, 3, 0)
	MovementLoopAddLocation(NPC, -21.30, -5.41, 217.11, 3, 30)
	MovementLoopAddLocation(NPC, -7.47, -5.21, 188.38, 3, 0)
	MovementLoopAddLocation(NPC, 1.16, -5.22, 181.35, 3, 0)
	MovementLoopAddLocation(NPC, 12.73, -5.26, 172.09, 3, 0)
end

function respawn(NPC)
	spawn(NPC)
end

function hailed(NPC, Spawn)
	FaceTarget(NPC, Spawn)
	Emote(NPC, "glares at you.")
	Say(NPC, "Yes, I'm busy. Hurry up now, what is it?")
end
This is the script to make the guard walk in a circle throughout Queen's Colony.

Locked

Who is online

Users browsing this forum: No registered users and 0 guests