|
You last visited: Today at 16:54
Advertisement
Lua and c#
Discussion on Lua and c# within the CO2 Private Server forum part of the Conquer Online 2 category.
03/24/2010, 18:54
|
#1
|
elite*gold: 0
Join Date: May 2006
Posts: 1,190
Received Thanks: 516
|
Lua and c#
Hey guys anyone got much knowlege of lua? i am starting to work on some lua stuff for my server. I have looked at some guides on the net and not much reli helpfull anyone can tell me a place for a good guide? or write a simple guide here for a moving NPC? thanks
|
|
|
03/24/2010, 21:04
|
#2
|
elite*gold: 20
Join Date: Jan 2008
Posts: 2,338
Received Thanks: 490
|
moving npc? Yeah... sure... im the onlyone that has em afaik
|
|
|
03/24/2010, 21:22
|
#3
|
elite*gold: 20
Join Date: Jan 2006
Posts: 890
Received Thanks: 241
|
Quote:
Originally Posted by ~Yuki~
moving npc? Yeah... sure... im the onlyone that has em afaik 
|
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
|
|
|
03/24/2010, 21:39
|
#4
|
elite*gold: 20
Join Date: Jan 2008
Posts: 2,338
Received Thanks: 490
|
i know its not lool
|
|
|
03/24/2010, 21:47
|
#5
|
elite*gold: 0
Join Date: Jun 2009
Posts: 378
Received Thanks: 141
|
Quote:
Originally Posted by ~Yuki~
moving npc? Yeah... sure... im the onlyone that has em afaik 
|
Nah i got moving npc's , but the only moving NPC's i use are spawned as an entity so it moves and looks like a player character. That was one of my favorite idea's should look into that comes out pretty fun. Lua and c# used it once i liked it a lot. I'm not to good with it per say but good luck.
|
|
|
03/27/2010, 03:34
|
#6
|
elite*gold: 0
Join Date: Oct 2009
Posts: 8,783
Received Thanks: 5,304
|
Quote:
Originally Posted by ~Yuki~
moving npc? Yeah... sure... im the onlyone that has em afaik 
|
Lol actually I got them too
|
|
|
03/27/2010, 11:00
|
#7
|
elite*gold: 20
Join Date: Mar 2006
Posts: 6,126
Received Thanks: 2,518
|
Ive played around with that too, and a few friends of mine used to move NPCs on official servers lol.
|
|
|
03/27/2010, 19:08
|
#8
|
elite*gold: 0
Join Date: Oct 2009
Posts: 8,783
Received Thanks: 5,304
|
Quote:
Originally Posted by Korvacs
Ive played around with that too, and a few friends of mine used to move NPCs on official servers lol.
|
Lol like real co servers?
|
|
|
03/27/2010, 19:11
|
#9
|
elite*gold: 20
Join Date: Mar 2006
Posts: 6,126
Received Thanks: 2,518
|
Quote:
Originally Posted by .Arco
Lol like real co servers?
|
Indeed, you used to be able to send the movement packet with an npcid and the server would move it.
|
|
|
03/27/2010, 19:21
|
#10
|
elite*gold: 0
Join Date: Jan 2007
Posts: 656
Received Thanks: 541
|
Quote:
Originally Posted by Korvacs
Indeed, you used to be able to send the movement packet with an npcid and the server would move it.
|
Yeah I used to do that too on offical servers. I think I did it on Pyramid since tha was were I played.
|
|
|
All times are GMT +1. The time now is 16:54.
|
|