Page 1 of 1

Making Npc Loop Movement

Posted: Tue Mar 03, 2009 12:09 am
by palaxe
I have a Question,
So I have my script for movement
In spawn script I have all the fields right but... Lua_Script.
I tryed putting the name of my script file, that didnt work.
In C# you would write the code with base creature xxxxx, and that would be were the data base would find the script.
This is a bit new to me.
So I put in the location of the file C:\eq2emu\scripts..... so on
Still cant load the script file.
What am I supost to put in the lua_script field for the server to see the file and follow the xyz that I am using for Npc movemnt?
Thanks for your help.
P.s. I did spend all night looking though all the forums and read a lot about group movment and how you tryed to get them to walk in circles and so on. So im not a slacker...
Thanks for the help.

Re: Making Npc Loop Movement

Posted: Tue Mar 03, 2009 2:13 am
by Scatman
You do put the file path of your script in lua_script. Are you positive it's not loading? All 1,331 spawn scripts on Tess work. Is your script written properly? You can use "/luadebug start" in-game to find syntax errors in scripts. If you paste your script here we can double check it for ya.

Re: Making Npc Loop Movement

Posted: Tue Mar 03, 2009 5:20 am
by John Adams
Scat, perhaps this is a good time to start adding to the Wiki those LUA function examples we talked about. I'll see if I can add this one and get a general format for the Wiki started so others can help fill in the blanks.

Re: Making Npc Loop Movement

Posted: Tue Mar 03, 2009 6:37 am
by Scatman
Sure.

Re: Making Npc Loop Movement

Posted: Tue Mar 03, 2009 9:24 am
by palaxe
Thanks guys.
here is the script.
I named the file, " movment"

function spawn(NPC)
--Syntax is NPC, x, y, z, speed, delay (in seconds)
MovementLoopAddLocation(NPC, -115.55, -52.09, -727.04, 2, 30)
MovementLoopAddLocation(NPC, -111.14, -48.75, -751.51, 2, 30)
MovementLoopAddLocation(NPC, -81.45, -45.57, -704.45, 2, 30)
MovementLoopAddLocation(NPC, -.90, -5.47, 212.14, 2, 30)
MovementLoopAddLocation(NPC, -103.04, -45.12, -704.47, 2, 30)
end

like i said this code seems to simple compared to c#.. LOL.
maybe im not coding this right to find it. In C# you put a public class name for the server toto find the file. example

using System;
using System.Collections;
using System.Collections.Generic;
using Server;

namespace Server.Movement
{
public class Movement : IMovement <<<<<<<<
{
So sorry if I am confused. But as I looked at your C++ That is all there is to the code.
Am I wrong?
Also would I make the custom spells from scripts also?
Thanks again for the help.

Re: Making Npc Loop Movement

Posted: Tue Mar 03, 2009 10:08 am
by Zcoretri
Did you enter the name of your spawn script in the 'lua_script' field of the spawn_scripts table in the DB?

Re: Making Npc Loop Movement

Posted: Tue Mar 03, 2009 10:16 am
by palaxe
Yes, the name of the script is "movement"
in spawn scripts in the db table, under Lua_Scripts I put in movement. that didn't work so then i put in the path c:\eq2emuu\spawnScripts\movement.
I got an error saying cant access script and no movement. Is the script written correct? seems to easy lol

Re: Making Npc Loop Movement

Posted: Tue Mar 03, 2009 10:29 am
by Scatman
I can't remember if not having the file extension (.lua) matters or not. I remember reading somewhere that it didn't matter but I always include the .lua to make sure. Are you using version 0.6.5? I logged into your server and noticed the welcome message still said "Welcome to EQ2Emulator 0.0.4", but you probably just haven't changed that in your db :) Your script looks good, so it's nothing there. I'm not really sure.. it's probably a simple mistake somewhere, wrong spawn_id ?

Re: Making Npc Loop Movement

Posted: Tue Mar 03, 2009 10:37 am
by palaxe
here is my server with just Movement path typed in

Loading new Zone 'GreaterFaydark'
Loaded 81 NPC(s), 0 Object(s), 0 Widget(s), 0 Sign(s), 0 GroundSpawn(s).
Error loading cannot open C:\AC Web Ultimate Repack\EQ2EMU\SpawnScripts\Movement
: No such file or directory
Error LUA Spawn Script 'C:\AC Web Ultimate Repack\EQ2EMU\SpawnScripts\Movement'
OP_ChatFiltersMsg Received 0x0135
0: 0D 00 FF FF FF FF FF 01 - 00 00 00 80 FF FF 03 01 | ................
OP_ChatFiltersMsg Received 0x0135
0: 0D 00 FF FF FF FF FF FF - FF FF FF FF FF FF 03 01 | ................
OP_Unknown Received 0x00ad
0: 00 00 | ..

Does that help at all? lol

Re: Making Npc Loop Movement

Posted: Tue Mar 03, 2009 10:39 am
by palaxe
Thanks Scatman. I need to change the message it is 6.5.
I didnt put .lu behind it ill try that right now thanks :)

Re: Making Npc Loop Movement

Posted: Tue Mar 03, 2009 10:42 am
by palaxe
YIPPIE!!!! IT WORKED... So anyone doing this make sure and put your path and .lua behind your file :)
I must stay this is easy coding... I love it... I wish they would of tought c++ in the early 80's when I went to collage in computer science. haha.... Thanks for your help :)

Re: Making Npc Loop Movement

Posted: Tue Mar 03, 2009 10:51 am
by Scatman
Glad that worked. Yep, LE made the LUA interface very easy to use :)

Re: Making Npc Loop Movement

Posted: Tue Mar 03, 2009 11:03 am
by palaxe
Thanks LE.. I really love working on your system.. Its solid :)