|
You last visited: Today at 14:08
Advertisement
[Release]NPC system 5165 simplified
Discussion on [Release]NPC system 5165 simplified within the CO2 PServer Guides & Releases forum part of the CO2 Private Server category.
12/10/2009, 23:26
|
#1
|
elite*gold: 20
Join Date: Jun 2006
Posts: 3,296
Received Thanks: 924
|
[Release]NPC system 5165 simplified
//
|
|
|
12/11/2009, 00:24
|
#2
|
elite*gold: 0
Join Date: Oct 2009
Posts: 8,765
Received Thanks: 5,291
|
Quote:
Originally Posted by Kiyono
I took a look at the NPCs and it annoyed me so this is to make the system simpler.
Add this in packethandling/npcdialog.cs
Code:
public static void Text(string value, Main.GameClient GC)
{
GC.AddSend(Packets.NPCSay(value));
}
public static void Link(string value, byte linkback, Main.GameClient GC)
{
GC.AddSend(Packets.NPCLink(value, linkback));
}
public static void Face(ushort face, Main.GameClient GC)
{
GC.AddSend(Packets.NPCSetFace(face));
}
public static void End(Main.GameClient GC)
{
GC.AddSend(Packets.NPCFinish());
}
public static void Teleport(ushort map, ushort x, ushort y, Main.GameClient GC)
{
GC.MyChar.Teleport(map, x, y);
}
Example:
Code:
#region Leave TG
case 600075:
{
if (Control == 0)
{
Text("Do you want to leave this place?", GC);
Link("Yeah.", 1, GC);
Link("No, I'll stay here.", 255, GC);
Face(N.Avatar, GC);
End(GC);
}
else if (Control == 1)
{
Game.Vector2 V = (Game.Vector2)Database.DefaultCoords[GC.MyChar.Loc.PreviousMap];
Teleport(GC.MyChar.Loc.PreviousMap, V.X, V.Y, GC);
}
break;
}
#endregion
instead of
Code:
#region Leave TG
case 600075:
{
if (Control == 0)
{
GC.AddSend(Packets.NPCSay("Do you want to leave this place?"));
GC.AddSend(Packets.NPCLink("Yeah.", 1));
GC.AddSend(Packets.NPCLink("No, I'll stay here.", 255));
GC.AddSend(Packets.NPCSetFace(N.Avatar));
GC.AddSend(Packets.NPCFinish());
}
else if (Control == 1)
{
Game.Vector2 V = (Game.Vector2)Database.DefaultCoords[GC.MyChar.Loc.PreviousMap];
GC.MyChar.Teleport(GC.MyChar.Loc.PreviousMap, V.X, V.Y);
}
break;
}
#endregion
I did not test this a lot though, the example provided is the only NPC I tested it on.
//edit Added Teleport.
|
Uhm I kinda released this already.
Only thing different about yours is the Teleport.
And you need to be specific on where to add the code.
Because it won't work just anywhere in the packethandler.
Please test stuff before you release it.
|
|
|
12/11/2009, 00:39
|
#3
|
elite*gold: 0
Join Date: Nov 2009
Posts: 256
Received Thanks: 63
|
It's already simple, why is this needed...
|
|
|
12/11/2009, 00:41
|
#4
|
elite*gold: 0
Join Date: Oct 2009
Posts: 8,765
Received Thanks: 5,291
|
Quote:
Originally Posted by airborne.
It's already simple, why is this needed...
|
Because people get tired of typing
PHP Code:
GC.AddSend(Packets.NPCSay
|
|
|
12/11/2009, 01:28
|
#5
|
elite*gold: 0
Join Date: Aug 2007
Posts: 187
Received Thanks: 45
|
Quote:
Originally Posted by airborne.
It's already simple, why is this needed...
|
Lol you say this is simple but so is adding an NPC to take you to a blank map
|
|
|
12/11/2009, 02:37
|
#6
|
elite*gold: 0
Join Date: Dec 2009
Posts: 116
Received Thanks: 42
|
Tiku allready release something like this
But good job i guess =P
|
|
|
12/11/2009, 13:42
|
#7
|
elite*gold: 20
Join Date: Jun 2006
Posts: 3,296
Received Thanks: 924
|
Quote:
Originally Posted by Tiku
Uhm I kinda released this already.
Only thing different about yours is the Teleport.
And you need to be specific on where to add the code.
Because it won't work just anywhere in the packethandler.
Please test stuff before you release it.
|
I didn't knew that you also released something like this.
//edit Also added removing/adding CPs/Silvers.
|
|
|
05/09/2010, 17:18
|
#8
|
elite*gold: 0
Join Date: May 2010
Posts: 298
Received Thanks: 57
|
To make that even better you could do a NPC like
Code:
#region Leave TG
case 600075:
{
switch (Control)
{
case 0:
Text("Do you want to leave this place?", GC);
Link("Yeah.", 1, GC);
Link("No, I'll stay here.", 255, GC);
break;
case 1:
Game.Vector2 V = (Game.Vector2)Database.DefaultCoords[GC.MyChar.Loc.PreviousMap];
Teleport(GC.MyChar.Loc.PreviousMap, V.X, V.Y, GC);
break;
}
Face(N.Avatar, GC);
End(GC);
break;
}
break;
That's how all my NPC's are coded and are a very good way to code NPC's also it makes npc's respond faster
|
|
|
05/09/2010, 19:03
|
#9
|
elite*gold: 0
Join Date: Oct 2009
Posts: 768
Received Thanks: 550
|
Quote:
Originally Posted by Kiyono
I took a look at the NPCs and it annoyed me so this is to make the system simpler.
Add this in packethandling/npcdialog.cs
Code:
public static void Text(string value, Main.GameClient GC)
{
GC.AddSend(Packets.NPCSay(value));
}
public static void Link(string value, byte linkback, Main.GameClient GC)
{
GC.AddSend(Packets.NPCLink(value, linkback));
}
public static void Face(ushort face, Main.GameClient GC)
{
GC.AddSend(Packets.NPCSetFace(face));
}
public static void End(Main.GameClient GC)
{
GC.AddSend(Packets.NPCFinish());
}
public static void Teleport(ushort map, ushort x, ushort y, Main.GameClient GC)
{
GC.MyChar.Teleport(map, x, y);
}
public static void Silvers(uint value, Main.GameClient GC)
{
GC.MyChar.Silvers += value;
}
public static void CPs(uint value, Main.GameClient GC)
{
GC.MyChar.CPs += value;
}
Example:
Code:
#region Leave TG
case 600075:
{
if (Control == 0)
{
Text("Do you want to leave this place?", GC);
Link("Yeah.", 1, GC);
Link("No, I'll stay here.", 255, GC);
Face(N.Avatar, GC);
End(GC);
}
else if (Control == 1)
{
Game.Vector2 V = (Game.Vector2)Database.DefaultCoords[GC.MyChar.Loc.PreviousMap];
Teleport(GC.MyChar.Loc.PreviousMap, V.X, V.Y, GC);
}
break;
}
#endregion
instead of
Code:
#region Leave TG
case 600075:
{
if (Control == 0)
{
GC.AddSend(Packets.NPCSay("Do you want to leave this place?"));
GC.AddSend(Packets.NPCLink("Yeah.", 1));
GC.AddSend(Packets.NPCLink("No, I'll stay here.", 255));
GC.AddSend(Packets.NPCSetFace(N.Avatar));
GC.AddSend(Packets.NPCFinish());
}
else if (Control == 1)
{
Game.Vector2 V = (Game.Vector2)Database.DefaultCoords[GC.MyChar.Loc.PreviousMap];
GC.MyChar.Teleport(GC.MyChar.Loc.PreviousMap, V.X, V.Y);
}
break;
}
#endregion
To give 1000 silvers:
Code:
Silvers(+1000, GC);
To remove 1000 silvers:
Code:
Silvers(-1000, GC);
I did not test this a lot though, the example provided is the only NPC I tested it on.
//edit Added Teleport.
|
I'm sorry to tell you but using
Code:
public static void Silvers(uint value, Main.GameClient GC)
{
GC.MyChar.Silvers += value;
}
public static void CPs(uint value, Main.GameClient GC)
{
GC.MyChar.CPs += value;
}
with
Silvers(-1000) will get your character like...max value of silvers?, it happens the same for CPs. You should use...
Code:
public static void Silvers(int value, Main.GameClient GC)
{
if(value <= 0 && GC.MyChar.Silvers < -value)
return;
GC.MyChar.Silvers = (uint)(GC.MyChar.Silvers + value);
}
public static void CPs(int value, Main.GameClient GC)
{
if(value <= 0 && GC.MyChar.CPs < -value)
return;
GC.MyChar.CPs = (uint)(GC.MyChar.CPs + value);
}
|
|
|
05/10/2010, 08:14
|
#10
|
elite*gold: 0
Join Date: Oct 2009
Posts: 8,765
Received Thanks: 5,291
|
Ah never woulda guess that.
+k alex.
Taught me a bit lol.
|
|
|
05/10/2010, 08:17
|
#11
|
elite*gold: 0
Join Date: May 2010
Posts: 630
Received Thanks: 130
|
well, this is not really useful, if you can't use all methode types
like other statements instead of teleport, cps and silvers only
But also peoples get sone work then, to add them by them selves, but most peoples is just Copy + paste xD
|
|
|
05/10/2010, 08:20
|
#12
|
elite*gold: 0
Join Date: Oct 2009
Posts: 8,765
Received Thanks: 5,291
|
Quote:
Originally Posted by .Summer
well, this is not really useful, if you can't use all methode types
like other statements instead of teleport, cps and silvers only
But also peoples get sone work then, to add them by them selves, but most peoples is just Copy + paste xD
|
It can be done for all methods, not that hard.
|
|
|
05/10/2010, 08:22
|
#13
|
elite*gold: 0
Join Date: May 2010
Posts: 630
Received Thanks: 130
|
Quote:
Originally Posted by .Arco
It can be done for all methods, not that hard.
|
I know, i was talking for the copy + paste peoples
|
|
|
05/10/2010, 08:26
|
#14
|
elite*gold: 0
Join Date: Oct 2009
Posts: 8,765
Received Thanks: 5,291
|
It's simple enough, I bet even they can do it xD
|
|
|
05/10/2010, 08:32
|
#15
|
elite*gold: 0
Join Date: May 2010
Posts: 630
Received Thanks: 130
|
Quote:
Originally Posted by .Arco
It's simple enough, I bet even they can do it xD
|
Yea true, is just some simple lines
|
|
|
|
Similar Threads
|
[Release] 5165 Warehouses Auth System
04/01/2011 - CO2 PServer Guides & Releases - 18 Replies
this is just a simple Auth system for warehouses. It will ask for password (set from WHGuardian) each time players will open their warehouse. Attempt limit is not included in this release... btw; with this release, warehouseGuardian will now save the password in Character file.
here are the screenshots:
http://img408.imageshack.us/img408/6986/98867182. jpg
Click The Image to see more screen shots
1. Go to NPCDialog.cs and search for this code:
public static void...
|
[Release] Flower System (5165)
09/25/2010 - CO2 PServer Guides & Releases - 71 Replies
Heya!
Mostly complete... just figure a way to save it on your server....
ScreenShots:
http://img98.imageshack.us/img98/1949/164947279.j pg
http://img714.imageshack.us/img714/5372/64922998. jpg
http://img59.imageshack.us/img59/1025/64930238.jp g
|
[Release]Make the threading system better.[5165 NewestCOServer]
09/13/2010 - CO2 PServer Guides & Releases - 10 Replies
Okay so,
I was bored so I thought I would release some easy shiz. Credits to Impulse for his Thread.cs :)
Goto Program.cs find
Console.WriteLine("The server is ready for connections.");
abit under that is the threading system. It's like
|
[RELEASE]Anti bot system 5165
06/15/2010 - CO2 PServer Guides & Releases - 15 Replies
Here is an simple anti bot system.
Credits goes to Arco for the npc send thing :)
First go to MyThreads.cs and find:
interval = Interval;
T = new Thread(new ThreadStart(Run));
T.Start();
|
[RELEASE]Fully Working AFK System 5165
05/16/2010 - CO2 PServer Guides & Releases - 9 Replies
Hello Elitepvpers.
I will start release things again.
I released a tdm for not long time ago, but
now i will release a fully working afk system.
If you are smart enough you can convert it with my anti bot thing.
First go to Character.cs and search for: public ulong VP;
under it put:
public bool AFK;
|
All times are GMT +2. The time now is 14:08.
|
|