[Release]Pk Event

05/22/2009 04:29 ~RapidBlade~#1
Okay, this is my first release for a LOTF PK event, so i hope you enjoy it! Any questions reply here or message me on msn at [Only registered and activated users can see links. Click Here To Register...]. Also Credits to EmmeTheCoder for his Start/stop npc codes used for this.
Remember to hit Thanks!

First:
Go to General.cs and add this somewhere:
Code:
        public static bool PKEvent = false;
Second:
Go to Character.cs and search for:
Code:
       public void TimerElapsed(object source, ElapsedEventArgs e) 
        {
Right below that {, add:
Code:
foreach (DictionaryEntry DE in World.AllChars)
{
Character Charr = (Character)DE.Value;



if (Charr.LocMap == 1082)
{
if (DateTime.Now > Charr.Death.AddSeconds(2))
{
if (!Charr.Alive)
{
Charr.Revive(true);
World.SpawnMeToOthers(Charr, true);
World.SpawnOthersToMe(Charr, true);
World.UpdateSpawn(Charr);
Charr.Teleport(1002, 438, 377);
Charr.MyClient.SendPacket(General.MyPackets.Vital( UID, 26, Charr.GetStat()));
Charr.MyClient.SendPacket(General.MyPackets.SendMsg(Charr.MyClient.MessageId, "Eliminator", Charr.Name, "You Were Eliminated!", 2011));
System.Threading.Thread.Sleep(100);
}
}
}
}
Third:
In client.cs find the commands all players can use: (usually /save or /coords)
and add this above one of them:
Code:
                            if (Message == "/joinpk")//coded by RapidBlade
                            {
                                if (General.PKEvent == true)
                                {
                                    MyChar.Teleport(1082, 224, 224);
                                }
                                else
                                {
                                    SendPacket(General.MyPackets.SendMsg(MessageId, "SYSTEM", MyChar.Name, "The PK Event has started is already over, you cannot use the command anymore!", 2005));
                                }

                            }
Fourth:
Add the command to start and end it:
Code:
                                        if (Splitter[0] == "/announcepk")//Coded by RapidBlade
                                        {
                                            World.SendMsgToAll("PK Event is about to start! Type /joinpk to join!", "[SYSTEM]", 2011);
                                            General.PKEvent = true;
                                        }
                                        if (Splitter[0] == "/joinpkend")//Coded by RapidBlade
                                        {
                                             World.SendMsgToAll("You are too late! You cannot join the PK Event anymore!", "[SYSTEM]", 2011);
                                             General.PKEvent = false;
                                        }
Fifth:
Add the NPC to leave the area:
Code:
                            if (CurrentNPC == 61)//PK Event Exiter:By RapidBlade
                            {
                                SendPacket(General.MyPackets.NPCSay("Hi there! Would you like to leave the PK Event area?"));
                                SendPacket(General.MyPackets.NPCLink("Hell Yeah, getting owned is tiring!", 1));
                                SendPacket(General.MyPackets.NPCLink("Just passing by.", 255));
                                SendPacket(General.MyPackets.NPCSetFace(30));
                                SendPacket(General.MyPackets.NPCFinish());
                            }
Control Part=
Code:
                          if (CurrentNPC == 61)
                            {
                                if (Control == 1)
                                {
                                        MyChar.Teleport(1002, 438, 377);
                                        MyChar.Action = 250;
                                    }
                                    MyChar.Ready = true;
                                }
Sixth:
The prize NPC- Credits to Emme for making the start and stop npc codes.
Search in General.cs:
Code:
        public static System.Timers.Timer Thetimer;
and UNDER that add:
Code:
        public static bool CanTalkToNPC = false;//credits to Emme
Add the commands (client.cs):
Code:
                                        if (Splitter[0] == "/stopnpc")
                                            if (!General.CanTalkToNPC)
                                            {
                                             string K = "Disabled!";
                                                General.CanTalkToNPC = true;
                                                {
                                                 World.SendMsgToAll("The Prize Npc For Find/PK Event Has Been Disabled." + K, "NPCHandeler", 2005);
                                        }
                                }
                            
                                        if (Splitter[0] == "/startnpc")//credits to EmmeTheCoder
                                        {
                                            string K = "Activated!";
                                            if (General.CanTalkToNPC)
                                            {
                                                K = "Activated!";
                                                General.CanTalkToNPC = false;
                                            }
                                             World.SendMsgToAll("The Prize Npc For Find/PK Event Has Been Activated." + K, "NPCHandeler", 2005);
                                        }
And Next add the NPC:
Code:
                            if (CurrentNPC == 63)
                            {
                                if (!General.CanTalkToNPC)
                                {
                                    SendPacket(General.MyPackets.NPCSay("Hello PK Master! You win 2 DragonBalls for dominating the tournament!"));
                                    SendPacket(General.MyPackets.NPCLink("Awesome! Give Me My Prize!", 1));
                                    SendPacket(General.MyPackets.NPCSetFace(30));
                                    SendPacket(General.MyPackets.NPCFinish());
                                }
                                else
                                {
                                    SendPacket(General.MyPackets.NPCSay("The prize has been taken."));
                                    SendPacket(General.MyPackets.NPCLink("Okay.", 255));
                                    SendPacket(General.MyPackets.NPCSetFace(30));
                                    SendPacket(General.MyPackets.NPCFinish());
                                }
                            }
and the control part-
Code:
if (CurrentNPC == 63)
                            {
                                if (Control == 1)
                                {
                                    SendPacket(General.MyPackets.NPCSay("Here is your Prize."));
                                    SendPacket(General.MyPackets.NPCLink("Thank You.", 5));
                                    SendPacket(General.MyPackets.NPCSetFace(30));
                                    SendPacket(General.MyPackets.NPCFinish());
                                }
                                if (Control == 5)
                                {
                                    MyChar.AddItem("720028-0-0-0-0-0", 0, (uint)General.Rand.Next(346623472));//ConquestArmor
                                    MyChar.AddItem("720028-0-0-0-0-0", 0, (uint)General.Rand.Next(346623472));//ConquestArmor
                                }
                            }
How to use these things:
Type /announcepk to start the tourny, and it also activates the /joinpk command for normal players. after like 2-3 mins use /joinpkend so after someone dies they can't come bak. use /stopnpc BEFORE the tourny so no prize can randomly b claimed.
I believe thats it, if i left out something post her and ill add it. And please no Flaming, this is only my first release as a noob coder lol.
05/22/2009 05:00 Pete1990#2
Quote:
Originally Posted by ~RapidBlade~ View Post
Okay, this is my first release for a LOTF PK event, so i hope you enjoy it! Any questions reply here. Also Credits to EmmeTheCoder for his Start/stop npc codes used for this.
Remember to hit Thanks!

First:
Go to General.cs and add this somewhere:
Code:
        public static bool PKEvent = false;
Second:
Go to Character.cs and search for:
Code:
       public void TimerElapsed(object source, ElapsedEventArgs e) 
        {
Right below that {, add:
Code:
foreach (DictionaryEntry DE in World.AllChars)
{
Character Charr = (Character)DE.Value;



if (Charr.LocMap == 1082)
{
if (DateTime.Now > Charr.Death.AddSeconds(2))
{
if (!Charr.Alive)
{
Charr.Revive(true);
World.SpawnMeToOthers(Charr, true);
World.SpawnOthersToMe(Charr, true);
World.UpdateSpawn(Charr);
Charr.Teleport(1002, 438, 377);
Charr.MyClient.SendPacket(General.MyPackets.Vital( UID, 26, Charr.GetStat()));
Charr.MyClient.SendPacket(General.MyPackets.SendMsg(Charr.MyClient.MessageId, "Eliminator", Charr.Name, "You Were Eliminated!", 2011));
System.Threading.Thread.Sleep(100);
}
}
}
}
Third:
In client.cs find the commands all players can use: (usually /save or /coords)
and add this above one of them:
Code:
                            if (Message == "/joinpk")//coded by RapidBlade
                            {
                                if (General.PKEvent == true)
                                {
                                    MyChar.Teleport(1082, 224, 224);
                                }
                                else
                                {
                                    SendPacket(General.MyPackets.SendMsg(MessageId, "SYSTEM", MyChar.Name, "The PK Event has started is already over, you cannot use the command anymore!", 2005));
                                }

                            }
Fourth:
Add the command to start and end it:
Code:
                                        if (Splitter[0] == "/announcepk")//Coded by RapidBlade
                                        {
                                            World.SendMsgToAll("PK Event is about to start! Type /joinpk to join!", "[SYSTEM]", 2011);
                                            General.PKEvent = true;
                                        }
                                        if (Splitter[0] == "/joinpkend")//Coded by RapidBlade
                                        {
                                             World.SendMsgToAll("You are too late! You cannot join the PK Event anymore!", "[SYSTEM]", 2011);
                                             General.PKEvent = false;
                                        }
Fifth:
Add the NPC to leave the area:
Code:
                            if (CurrentNPC == 61)//PK Event Exiter:By RapidBlade
                            {
                                SendPacket(General.MyPackets.NPCSay("Hi there! Would you like to leave the PK Event area?"));
                                SendPacket(General.MyPackets.NPCLink("Hell Yeah, getting owned is tiring!", 1));
                                SendPacket(General.MyPackets.NPCLink("Just passing by.", 255));
                                SendPacket(General.MyPackets.NPCSetFace(30));
                                SendPacket(General.MyPackets.NPCFinish());
                            }
Control Part=
Code:
                          if (CurrentNPC == 61)
                            {
                                if (Control == 1)
                                {
                                        MyChar.Teleport(1002, 438, 377);
                                        MyChar.Action = 250;
                                    }
                                    MyChar.Ready = true;
                                }
Sixth:
The prize NPC- Credits to Emme for making the start and stop npc codes.
Search in General.cs:
Code:
        public static System.Timers.Timer Thetimer;
and UNDER that add:
Code:
        public static bool CanTalkToNPC = false;//credits to Emme
Add the commands (client.cs):
Code:
                                        if (Splitter[0] == "/stopnpc")
                                            if (!General.CanTalkToNPC)
                                            {
                                             string K = "Disabled!";
                                                General.CanTalkToNPC = true;
                                                {
                                                 World.SendMsgToAll("The Prize Npc For Find/PK Event Has Been Disabled." + K, "NPCHandeler", 2005);
                                        }
                                }
                            
                                        if (Splitter[0] == "/startnpc")//credits to EmmeTheCoder
                                        {
                                            string K = "Activated!";
                                            if (General.CanTalkToNPC)
                                            {
                                                K = "Activated!";
                                                General.CanTalkToNPC = false;
                                            }
                                             World.SendMsgToAll("The Prize Npc For Find/PK Event Has Been Activated." + K, "NPCHandeler", 2005);
                                        }
And Next add the NPC:
Code:
                            if (CurrentNPC == 63)
                            {
                                if (!General.CanTalkToNPC)
                                {
                                    SendPacket(General.MyPackets.NPCSay("Hello PK Master! You win 2 DragonBalls for dominating the tournament!"));
                                    SendPacket(General.MyPackets.NPCLink("Awesome! Give Me My Prize!", 1));
                                    SendPacket(General.MyPackets.NPCSetFace(30));
                                    SendPacket(General.MyPackets.NPCFinish());
                                }
                                else
                                {
                                    SendPacket(General.MyPackets.NPCSay("The prize has been taken."));
                                    SendPacket(General.MyPackets.NPCLink("Okay.", 255));
                                    SendPacket(General.MyPackets.NPCSetFace(30));
                                    SendPacket(General.MyPackets.NPCFinish());
                                }
                            }
and the control part-
Code:
if (CurrentNPC == 63)
                            {
                                if (Control == 1)
                                {
                                    SendPacket(General.MyPackets.NPCSay("Here is your Prize."));
                                    SendPacket(General.MyPackets.NPCLink("Thank You.", 5));
                                    SendPacket(General.MyPackets.NPCSetFace(30));
                                    SendPacket(General.MyPackets.NPCFinish());
                                }
                                if (Control == 5)
                                {
                                    MyChar.AddItem("720028-0-0-0-0-0", 0, (uint)General.Rand.Next(346623472));//ConquestArmor
                                    MyChar.AddItem("720028-0-0-0-0-0", 0, (uint)General.Rand.Next(346623472));//ConquestArmor
                                }
                            }
I believe thats it, if i left out something post her and ill add it. You have to make sure you type /joinpkend when every1 who wants to enter is there or else they can keep coming back to the tourny. When they die they rev in TC. Also remember to hit /stopnpc before starting the event to make sure the prize npc is turned off. And please no Flaming, this is only my first release as a noob coder lol.
Good job
05/22/2009 05:01 ~RapidBlade~#3
Thanks Pete! lol
05/22/2009 05:25 Pete1990#4
Should do one for Ctf:)
05/22/2009 05:27 hunterman01#5
Quote:
Originally Posted by Pete1990 View Post
Should do one for Ctf:)
I told you i can fix Ctf but u been in a pissy ass mood latley lol :P
05/22/2009 05:29 Pete1990#6
Yea very big one Problems in life.
05/22/2009 05:31 hunterman01#7
Its cool i understand
05/22/2009 05:37 ~RapidBlade~#8
I haven't been able to figure out the flags for capture the flag yet, sorry. If i find it out i probably won't release it anyway tho, gotta keep some stuff for myself =)
05/22/2009 05:48 Pete1990#9
Yea the npc i did was messed up lmao
05/22/2009 08:16 PeTe Ninja#10
ninja here...good release.. ill be on msn in a few
05/22/2009 12:50 Vortex.#11
Rapid Delet it please!
05/22/2009 14:39 danielachraf#12
Quote:
Originally Posted by Vortex. View Post
Rapid Delet it please!
why ?
05/22/2009 19:55 ~RapidBlade~#13
Vortex nice Sig lol, and I released it cause i'm starting trying to make a better version of this event, so this one was just a basic so people who want a PK event could have a fully working one.
05/22/2009 21:43 Vortex.#14
Well I'm in.. See you on msn later.. The funny thing is.. How are you telling me this only now :O
05/22/2009 22:24 AndreaCo#15
lol pete and filer... Capture the Flag is so easy to code in -_-... lol