Full Version : bug in ctf game
xmlspawner >>XMLPoints Discussion >>bug in ctf game


<< Prev | Next >>

ambak- 01-24-2006
today i organised ctf game with 20 players.
10 players per team.
but a bug apperead sad.gif
very annoying bug.
the a teams flag dropped to the ground in their base.and the b team couldnt capture it.whats that sad.gif

ArteGordon- 01-24-2006
how did they get it to drop to the ground? That shouldnt be possible, but you can add this code to automatically return the flag if somehow it manages to get to the ground.

(edit)

I'll have to look into that.

hmm, perhaps their backpack was full, and when the flag was placed in their pack it dropped to the ground?

ambak- 01-24-2006
i think its appreared like this.
the person that captured the flag killed in the flags home base
and the flag droppen to the ground where the player killed.

ambak- 01-24-2006
arte ok ill try it but can u come to my shard if i give you my shards ip and port and open a demo account for you?ill show you more clearly

ambak- 01-24-2006
QUOTE (ArteGordon @ Jan 24 2006, 09:21 PM)
hmm, perhaps their backpack was full, and when the flag was placed in their pack it dropped to the ground?

yes it could be but this is very annoying sad.gif

ArteGordon- 01-24-2006
try making this mod. In CTF.cs around line 422

QUOTE

    if (!b.Deleted && b.Flag != null && !b.Flag.Deleted)
    {
      if (b.Flag.RootParent is Mobile)
      {

      Mobile m = b.Flag.RootParent as Mobile;

      // make sure a participant has it
      IChallengeEntry entry = GetParticipant(m);

      if (entry != null)
      {
        // display the flag
        //m.PublicOverheadMessage( MessageType.Regular, BaseChallengeGame.TeamColor(b.Team), false, b.Team.ToString());

        Effects.SendTargetParticles(m, 0x375A, 35, 10, BaseChallengeGame.TeamColor(b.Team), 0x00, 9502,
        (EffectLayer)255, 0x100);

      }
      else
      {
        b.ReturnFlag();
      }
      } else
      if (!b.HasFlag)
      {
        b.ReturnFlag();
      }

    }


this will force the flag to return to the base if it somehow ends up on the ground.

ambak- 01-24-2006
i make the change like this,is it true arte?
CODE

         // check for anyone carrying flags
           if(HomeBases != null)
           {
               ArrayList dlist = null;

               foreach(CTFBase b in HomeBases)
               {
                   if(b == null || b.Deleted)
                   {
                       if(dlist == null)
                           dlist = new ArrayList();
                       dlist.Add(b);
                       continue;
                   }

                   if(!b.Deleted && b.Flag != null && !b.Flag.Deleted)
                   {
                       if(b.Flag.RootParent is Mobile)
                       {

                           Mobile m = b.Flag.RootParent as Mobile;

                           // make sure a participant has it
                           IChallengeEntry entry = GetParticipant(m);

                           if(entry != null)
                           {
                               // display the flag
                               //m.PublicOverheadMessage( MessageType.Regular, BaseChallengeGame.TeamColor(b.Team), false, b.Team.ToString());

                               Effects.SendTargetParticles( m, 0x375A, 35, 10, BaseChallengeGame.TeamColor(b.Team), 0x00, 9502,
                               (EffectLayer)255, 0x100 );

                           } else
                           {
                               b.ReturnFlag();
                           }
                       } else
     if (!b.HasFlag)
     {
       b.ReturnFlag();
     }
                   }
               }

               if(dlist != null)

ArteGordon- 01-24-2006
yes, that looks right.