Quote:
Originally Posted by ~Yuki~
moving npc? Yeah... sure... im the onlyone that has em afaik :D
|
not like its hard.
i realize this isn't what you was asking for. but, here's how i do my Lua npcs. you should be able to get the general idea of how LUA works.
Code:
if (File.Exists(Database.DatabaseLoc + "Npc\\" + NpcID.ToString() + ".txt"))
{
Lua lua = new Lua();
ExplicitPackets ep = new ExplicitPackets();
Database db = new Database();
lua.RegisterFunction("Say", this, this.GetType().GetMethod("Say"));
lua.RegisterFunction("Link", this, this.GetType().GetMethod("Link"));
lua.RegisterFunction("Input", this, this.GetType().GetMethod("Input"));
lua.RegisterFunction("Face", this, this.GetType().GetMethod("Face"));
lua.RegisterFunction("Finish", this, this.GetType().GetMethod("Finish"));
lua.RegisterFunction("Teleport", _client, _client.GetType().GetMethod("Teleport"));
lua.RegisterFunction("OpenWareouse", _client.Warehouse, _client.Warehouse.GetType().GetMethod("OpenWareouse"));
lua.RegisterFunction("LoadSpawnPoint", db, db.GetType().GetMethod("LoadSpawnPoint"));
lua["NpcDialog"] = NpcDialog;
lua["Client"] = _client;
lua["InputText"] = InputText;
lua.DoFile(Database.DatabaseLoc + "Npc\\" + NpcID.ToString() + ".txt");
}
if Client.Warehouse.Tries <= 2 then
if NpcDialog == 0 then
if Client.Warehouse.Password == "" then
Face(1);
Say("Please set a warehouse password for your securty.");
Link("Ok.", 255);
Finish();
OpenWareouse();
else
Face(1);
Say("Please input your warehouse password.");
Input("Password:", 1);
Link("Let me think.", 255);
Finish();
end
end
if NpcDialog == 1 then
if (Client.Warehouse.Password == InputText) then
OpenWareouse();
else
Face(1);
Say("The Password You entered was incorrect.");
Link("Let me try again.", 0);
Link("Ok.", 255);
Finish();
Client.Warehouse.Tries = Client.Warehouse.Tries + 1;
end
end
else
Face(1);
Say("You have entered an incorrect password three times.");
Say("Please relogin to try again.");
Link("Ok.", 255);
Finish();
end