[Questiob] Team Teleport

08/27/2010 04:31 .Beatz#1
Hey guys been at this a lil while (Couple of days) I think its just me being stupid and not seeing the complete obvious. Well my question is in the thread title. How do I teleport a team from an NPC?

I have set it up so it checks that the character clicking through the NPC is the team leader and if they are not then it wont teleport just cant get the whole team to teleport to the same place.

btw this is 5165 and MY adaptation of Tanels source using a different packet structure. Layout of NPCs is pretty much the same.

Thanks to anyone who helps with this.
08/27/2010 05:35 pro4never#2
use a foreach loop through the team... rather simple really.


something like

foreach(Character C in GC.MyChar.Team.Members)
{
C.Teleport(x, y, map);
}

or something similar. Don't use lotf so I prob have it wrong. also don't usually use hashtables (eeweee) so I'm used to using keyvaluepair for my for each loops lol
08/27/2010 11:09 .Beatz#3
Quote:
Originally Posted by pro4never View Post
use a foreach loop through the team... rather simple really.


something like

foreach(Character C in GC.MyChar.Team.Members)
{
C.Teleport(x, y, map);
}

or something similar. Don't use lotf so I prob have it wrong. also don't usually use hashtables (eeweee) so I'm used to using keyvaluepair for my for each loops lol
Yeah hashtables are by far not the best. I am working on changing the whole way LOTF is layed out and making it MySql based.

Changed some of the packets (thanks to hybrid) just got a few to go and got to try and get the clan packets from somewhere
08/28/2010 00:32 Arcо#4
aybe something like...
in Features/Teams.cs
Code:
        public bool Contains(uint uid)
        {
            foreach (Game.Character P in Members)
                if (P.EntityID == uid)
                    return true;
            return false;
        }
Then for the NPC do a foreach check

foreach (Character C in World.H_Char.Values)
{
if (GC.MyChar.MyTeam.Contains(C.EntityID))
{
C.Teleport(coords);
}
}

Not 100% sure it will work, but work a shot.

#####EDIT#####
Forget mine, Chris's will work and its less time consuming than my crappy one.
08/28/2010 02:05 .Beatz#5
Quote:
Originally Posted by .Arco View Post
aybe something like...
in Features/Teams.cs
Code:
        public bool Contains(uint uid)
        {
            foreach (Game.Character P in Members)
                if (P.EntityID == uid)
                    return true;
            return false;
        }
Then for the NPC do a foreach check

foreach (Character C in World.H_Char.Values)
{
if (GC.MyChar.MyTeam.Contains(C.EntityID))
{
C.Teleport(coords);
}
}

Not 100% sure it will work, but work a shot.

#####EDIT#####
Forget mine, Chris's will work and its less time consuming than my crappy one.
Was gonna say bit late Arco haha lol cheers anyway :) modified his to work with my source so its all good xD
08/28/2010 03:34 felipeboladao#6
foreach (Character C in World.H_Char.Values)
{
if (GC.MyChar.MyTeam.Contains(C.EntityID))
{
if (MyMath.PointDistance(24, 248)) << Dont know
{
C.Teleport(Guild.GuildLeader.X, Guild.GuildLeader.Y, Guild.GuildLeader.Map);
Guild.AutoFollow = True;
}
}

If menbros the team is away, he teleports the menbros the team closer to the guild leader and automatically follow.