[Question]2vs2 PK match

08/08/2010 02:09 Fish*#31
nope, the timer still works.
only changes whats in it
as i said in the comment thing //what ever starts it
thats what to happen when is time for it :D
08/08/2010 02:14 ftp4life#32
ohhh lol aite i get it sumwhat now lol this is the first time i used a timer :) thanx to u i understand alot more
08/08/2010 02:26 Fish*#33
Quote:
Originally Posted by ftp4life View Post
ohhh lol aite i get it sumwhat now lol this is the first time i used a timer :) thanx to u i understand alot more
Keep going.
And goodluck :)
Thanks for pressing thanks :D
08/08/2010 02:39 ftp4life#34
np lol uhmmm btw you think if i used the exact same team death match from .Summer and recoded it with TeamPk would that work for it


okay grill mad time for you to fix meh errors :) this is what i got in a New Class called TeamPK.cs
Code:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading;
using System.IO;
using NewestCOServer.Game;

namespace NewestCOServer.Features
{
    public enum TeamPkStage
    {
        None,
        Inviting,
        Countdown,
        Fighting,
        Over
    }
    public enum BroadCast
    {
        World,
        Map
    }
    public static class TeamPk
    {
        public static ushort Map;
        public static ushort X, Y;
        public static TeamPkStage Stage2 = TeamPkStage.None;
        public static Dictionary<uint, Main.GameClient> TeamPkHash;
        public static int CountDown;
        private static Thread TeamPkThread;

        public static void StartTeamPk(Character Started)
        {
            if (Started.MyClient.GM)
            {
                TeamPkHash = new Dictionary<uint, Main.GameClient>();
                CountDown = 20;
                Stage2 = TeamPkStage.Inviting;
                Map = 1005;
                X = 51;
                Y = 71;

                TeamPkThread = new Thread(new ThreadStart(BeginElimination));
                TeamPkThread.IsBackground = true;
                TeamPkThread.Start();
            }
        }
        public static void StartTeamPk()
        {
            TeamPkHash = new Dictionary<uint, Main.GameClient>();
            CountDown = 20;
            Stage2 = TeamPkStage.Inviting;
            Map = 1005;
            X = 51;
            Y = 71;

            TeamPkThread = new Thread(new ThreadStart(BeginElimination));
            TeamPkThread.IsBackground = true;
            TeamPkThread.Start();
        }
        private static void Broadcast1(string msg, BroadCastLoc1 loc)
        {
            Console.WriteLine(msg);
            if (loc == BroadCastLoc1.World)
            {
                foreach (Character Char in World.H_Chars.Values)
                {
                    Char.MyClient.AddSend(Packets.ChatMessage(0, "[GM]", "All", msg, 2011, 0));
                    Char.MyClient.EndSend();
                }
            }
            else if (loc == BroadCastLoc1.Map)
            {
                foreach (Main.GameClient Char in TeamPkHash.Values)
                {
                    Char.AddSend(Packets.ChatMessage(0, "[GM]", "All", msg, 2011, 0));
                    Char.EndSend();
                }
            }
        }
        private static void TeamPkWinner(Character Winner1)
        {
            Broadcast1(Winner1.Name + " has won Elimination!", BroadCastLoc1.World);

            Winner1.StatEff.Add(StatusEffectEn.WeeklyPKChampion);
            Winner1.HonorPoints += 500;

            TeamPk.Stage2 = TeamPkStage.None;
            TeamPkThread.Abort();
            return;
        }
        public static void WaitForWinner2()
        {
            TeamPk.Stage2 = TeamPkStage.Fighting;
            uint Tick = (uint)Environment.TickCount;
            int InMapAlive = TeamPkHash.Count;
            while (true)
            {
                foreach (Main.GameClient _GC in TeamPkHash.Values)
                {
                    if (_GC.MyChar.InElimination)
                        if (!_GC.MyChar.Alive)
                        {
                            InMapAlive--;
                            _GC.MyChar.InElimination = false;
                        }
                        else if (!World.H_Chars.ContainsKey(_GC.MyChar.EntityID))
                        {
                            InMapAlive--;
                            _GC.MyChar.InElimination = false;
                        }
                }

                foreach (Main.GameClient _GC in TeamPkHash.Values)
                {
                    if (_GC.MyChar.InElimination)
                        if (_GC.MyChar.Alive && InMapAlive == 2)
                        {
                            _GC.MyChar.Teleport(1505, 154, 218);
                            TeamPkWinner(_GC.MyChar);
                            Stage2 = TeamPkStage.Over;
                            return;
                        }
                }

                if (InMapAlive != 2)
                {
                    Broadcast1("There are" + InMapAlive + "people left, kill them before they kill you!", BroadCastLoc1.Map);

                }
                Thread.Sleep(1000);
            }
        }


        public static void BeginElimination()
        {
            foreach (Character Char in World.H_Chars.Values)
            {
                Char.MyClient.DialogNPC = 665611;
                PacketHandling.NPCDialog.Handle(Char.MyClient, null, 665611, 0);
                Char.MyClient.EndSend();
            }
            Stage2 = TeamPkStage.Inviting;
            while (CountDown > 0)
            {
                if (CountDown == 20)
                    Broadcast1("20 seconds until Elimination starts!", BroadCastLoc1.World);
                else if (CountDown == 10)
                {
                    Stage2 = TeamPkStage.Countdown;
                    if (TeamPkHash.Count < 2)
                    {
                        Broadcast1("Elimination requires atleast 2 people to start, Elimination Cancelled.", BroadCastLoc1.World);
                        Stage2 = TeamPkStage.None;
                        TeamPkHash = null;
                        return;
                    }
                    Broadcast1("10 seconds until Elimination starts!", BroadCastLoc1.World);
                }
                else if (CountDown < 10)
                    Broadcast1(CountDown + " seconds until Elimination starts, hurry your ass up!", BroadCastLoc1.World);

                CountDown--;
                Thread.Sleep(1000);
            }
            Stage2 = TeamPkStage.Fighting;
            Broadcast1("Fight!", BroadCastLoc1.World);
            WaitForWinner2();
        }
    }
}
08/08/2010 03:20 Fish*#35
The errors are?
test it please :D
08/08/2010 03:23 ftp4life#36
was askin u if i needed to take something out cuz by a pro like u lookin at it before i make my self look stupid and takin the time to debug it when its not finished lol
08/08/2010 03:49 Fish*#37
Well.
I dont know whats wrong with it, if i dont know what issues ur facing :D
And im diffently not a pro.
Im still learning =]
08/08/2010 08:54 ftp4life#38
ahahah in my eyes ur pro :) and naw there isnt any errors i was just asking u if that is how it wuld be done

okay so i made the NPC and it went something like this
Code:
                           #region JoinTPKDialog
                            case 10021:
                                {
                                    if (Control == 0)
                                    {
                                        if (Features.TeamPk.Stage2 == Features.TeamPkStage.Inviting)
                                        {
                                            GC.AddSend(Packets.NPCSay("Would you like to join the TeamPk tournament in the PKArena? You have " + (Features.TeamPk.CountDown - 10) + " seconds to join."));
                                            GC.AddSend(Packets.NPCLink("Sure, I'll join!", 1));
                                            GC.AddSend(Packets.NPCLink("What're the rules?", 2));
                                            GC.AddSend(Packets.NPCSetFace(30));
                                            GC.AddSend(Packets.NPCFinish());
                                            return;
                                        }
                                        else if (Features.TeamPk.Stage2 != Features.TeamPkStage.None)
                                        {
                                            GC.AddSend(Packets.NPCSay("You're too late, " + GC.MyChar.Name + ", the tournament has already started!"));
                                            GC.AddSend(Packets.NPCLink("Darn", 255));
                                            GC.AddSend(Packets.NPCSetFace(30));
                                            GC.AddSend(Packets.NPCFinish());
                                        }
                                        else
                                        {
                                            GC.AddSend(Packets.NPCSay("No TeamPK tournament is going on at this time."));
                                            GC.AddSend(Packets.NPCLink("Darn", 255));
                                            GC.AddSend(Packets.NPCSetFace(30));
                                            GC.AddSend(Packets.NPCFinish());
                                        }
                                    }
                                    else if (Control == 1)
                                    {
                                        if (GC.MyChar.MyTeam.Members.Count >= 2)
                                        {
                                            GC.MyChar.Team2Joined += 1;
                                            GC.MyChar.Team1Joined += 1;
                                            GC.MyChar.Teleport(1005, 51, 71);
                                            GC.AddSend(Packets.NPCSay("Goodluck, " + GC.MyChar.Name + "."));
                                            GC.AddSend(Packets.NPCLink("Thanks", 255));
                                            GC.AddSend(Packets.NPCSetFace(30));
                                            GC.AddSend(Packets.NPCFinish());
                                            GC.MyChar.InTPK = true;
                                            GC.MyChar.CurHP = 50000;
                                            Features.TeamPk.TeamPkHash.Add(GC.MyChar.EntityID, GC);
                                        }
                                        else if (GC.MyChar.Team1Joined <= 2)
                                        {
                                            GC.AddSend(Packets.NPCSay("Sorry There is a Match Already?"));
                                            GC.AddSend(Packets.NPCLink("Okay.", 255));
                                            GC.AddSend(Packets.NPCSetFace(N.Avatar));
                                            GC.AddSend(Packets.NPCFinish());
                                        }
                                    }
                                    return;
                                }
                            #endregion
08/08/2010 20:21 Fish*#39
u should make a check for wich team the person is on.
because else there can only be one on each team.
as it goes +1 in both teams everytime 1 palyer join :)

Goodluck
08/08/2010 20:37 ftp4life#40
would this work
Code:
                                        #region JoinTPKDialog
                            case 10021:
                                {
                                    if (Control == 0)
                                    {
                                        if (Features.TeamPk.Stage2 == Features.TeamPkStage.Inviting)
                                        {
                                            GC.AddSend(Packets.NPCSay("Would you like to join the TeamPk tournament in the PKArena? You have " + (Features.TeamPk.CountDown - 10) + " seconds to join."));
                                            GC.AddSend(Packets.NPCLink("Sure, I'll join!", 1));
                                            GC.AddSend(Packets.NPCLink("What're the rules?", 2));
                                            GC.AddSend(Packets.NPCSetFace(30));
                                            GC.AddSend(Packets.NPCFinish());
                                            return;
                                        }
                                        else if (Features.TeamPk.Stage2 != Features.TeamPkStage.None)
                                        {
                                            GC.AddSend(Packets.NPCSay("You're too late, " + GC.MyChar.Name + ", the tournament has already started!"));
                                            GC.AddSend(Packets.NPCLink("Darn", 255));
                                            GC.AddSend(Packets.NPCSetFace(30));
                                            GC.AddSend(Packets.NPCFinish());
                                        }
                                        else
                                        {
                                            GC.AddSend(Packets.NPCSay("No TeamPK tournament is going on at this time."));
                                            GC.AddSend(Packets.NPCLink("Darn", 255));
                                            GC.AddSend(Packets.NPCSetFace(30));
                                            GC.AddSend(Packets.NPCFinish());
                                        }
                                    }
                                    else if (Control == 1)
                                    {
                                    if (GC.MyChar.MyTeam.Members.Count >= 2)
                                        {
                                            GC.MyChar.Team1Joined += 1;
                                            GC.MyChar.Team2Joined += 1;
                                            GC.MyChar.Teleport(1005, 51, 71);
                                            GC.AddSend(Packets.NPCSay("Goodluck, " + GC.MyChar.Name + "."));
                                            GC.AddSend(Packets.NPCLink("Thanks", 255));
                                            GC.AddSend(Packets.NPCSetFace(30));
                                            GC.AddSend(Packets.NPCFinish());
                                            GC.MyChar.InTPK = true;
                                            GC.MyChar.CurHP = 50000;
                                            Features.TeamPk.TeamPkHash.Add(GC.MyChar.EntityID, GC);
                                        }
                                        [COLOR="Red"]else if (GC.MyChar.Team1Joined <= 2 || GC.MyChar.Team2Joined <= 2)[/COLOR]
                                        {
                                            GC.AddSend(Packets.NPCSay("Sorry There is a Match Already?"));
                                            GC.AddSend(Packets.NPCLink("Okay.", 255));
                                            GC.AddSend(Packets.NPCSetFace(N.Avatar));
                                            GC.AddSend(Packets.NPCFinish());
                                        }
                                    }
                                    return;
                                }
                            #endregion
08/09/2010 09:13 Fish*#41
why do you put a return;
and this:
else if (GC.MyChar.Team1Joined <= 2 || GC.MyChar.Team2Joined <= 2)
should be
else if (GC.MyChar.Team1Joined <= 2 && GC.MyChar.Team2Joined <= 2)
i think
08/09/2010 22:04 ftp4life#42
true true lol... well imma go test this out and if it works ill release it and have credits wit ur name
08/09/2010 22:22 Fish*#43
Quote:
Originally Posted by ftp4life View Post
true true lol... well imma go test this out and if it works ill release it and have credits wit ur name
Goodluck on it. Im always interested in help :)
08/13/2010 03:49 ftp4life#44
lol well for some reason when i wuld kill everyone it wuld keep spamming 4 people left.. in the team pk turny and it wont go away till i restart the server