Direct a foreach at Char in Map?

03/28/2010 19:10 ktamer#1
I've been working at a hunt quest that teleports chars to a map where they must kill a monster get a key find the treasure box, open it then teleport back to TC.
This is what I have but it directs the tele to all characters in game

foreach (Game.Character C in Game.World.H_Chars.Values)
{
Game.World.SendMsgToAll("SYSTEM", "The Treasure has been found. Better luck next time.", 2011, 0);
C.Teleport(1002, 429, 379);
}

how would I direct this to only the characters in the map? I've tried millions of different things...even tried using bools that change the subject of the NPC but for some reason it wont' switch false to true...even with a command...grrrzzz...any and all help is greatly appreciated. (Sometimes I wish I stuck with my 5095 server lol)
03/30/2010 23:46 Korvacs#2
Moved.
03/30/2010 23:50 Fish*#3
Quote:
Originally Posted by ktamer View Post
I've been working at a hunt quest that teleports chars to a map where they must kill a monster get a key find the treasure box, open it then teleport back to TC.
This is what I have but it directs the tele to all characters in game

foreach (Game.Character C in Game.World.H_Chars.Values)
{
Game.World.SendMsgToAll("SYSTEM", "The Treasure has been found. Better luck next time.", 2011, 0);
C.Teleport(1002, 429, 379);
}

how would I direct this to only the characters in the map? I've tried millions of different things...even tried using bools that change the subject of the NPC but for some reason it wont' switch false to true...even with a command...grrrzzz...any and all help is greatly appreciated. (Sometimes I wish I stuck with my 5095 server lol)
make it look for (if char is in map = ????)
03/31/2010 01:07 -Shunsui-#4
Code:
foreach (DictionaryEntry DE in World.H_Chars)
                                        {
                                            Character Entity = (Character)DE.Value;

                                            if (Entity.Loc.Map == 1505)
                                            {
                                                Entity.Teleport(1002, 420, 420);
}
}
03/31/2010 04:15 -NewDawn-#5
=P lol, yah- you could use an if statement with "if character is on this map" but...
Why not have it so that it checks how far you are into it ... then it can knock off a few players and revel a 2nd prize.. then knock off a few players so that only 2 remain and have a third treasure (or prize or whatever you want)?
That'd be more exciting. Have it so that a progress is saved to the character's structure and then have it reset on log in to 0. That could track it. =]
Good luck ^^

PS: I'm with you bro! C# for fun! Woot!!
=P
03/31/2010 04:32 Fish*#6
Quote:
Originally Posted by -NewDawn- View Post
=P lol, yah- you could use an if statement with "if character is on this map" but...
Why not have it so that it checks how far you are into it ... then it can knock off a few players and revel a 2nd prize.. then knock off a few players so that only 2 remain and have a third treasure (or prize or whatever you want)?
That'd be more exciting. Have it so that a progress is saved to the character's structure and then have it reset on log in to 0. That could track it. =]
Good luck ^^

PS: I'm with you bro! C# for fun! Woot!!
=P
maybe cuz he didnt want a 2nd prize ^^
03/31/2010 05:54 -NewDawn-#7
Quote:
Originally Posted by grillmad View Post
maybe cuz he didnt want a 2nd prize ^^
Lol, just a suggestion to make it more interesting =P
Have a message pop up that says "Player Name has been eliminated" that only appears on the game map xP
that's what I'd do. rofl =P
03/31/2010 06:09 Fish*#8
Quote:
Originally Posted by -NewDawn- View Post
Lol, just a suggestion to make it more interesting =P
Have a message pop up that says "Player Name has been eliminated" that only appears on the game map xP
that's what I'd do. rofl =P
Yea could be cool ^^ Thought is not that hard to make :P
04/01/2010 05:45 ktamer#9
I appreciate the help. Sorry for the late thx, been crankin away at things.
At -NewDawn-
I like your idea. I think alternate prizes would be a good idea. And definitely easy enough to do. As for the rest of the chars, I could tele them to an alternate/copy version of horserace map. Losers take the walk sort of thing ^_^. Once it's all done I'll release it for sure.
Thx again.