Author Topic: Every player in area?  (Read 256 times)

Legacy_Buddywarrior

  • Hero Member
  • *****
  • Posts: 512
  • Karma: +0/-0
Every player in area?
« on: July 17, 2012, 08:52:49 pm »


               I'm writing a script for a creature, when it's at 25% life, it does something to every player in the area. I'm stuck at looping through all players in just the area. Here is what I have so far. The logic looks right to me, the compiler thinks otherwise =) . Any suggestion on how to best effect only players in the area the creature is in are welcome!

object oArea;// Get the area of the script caller.oArea = GetArea(OBJECT_SELF);
object oPC = ExploreAreaForPlayer(oArea);while (GetIsObjectValid(oPC)){   ActionSpeakString("Only Players in area should see this.");}

Thanks!
               
               

               
            

Legacy_Failed.Bard

  • Hero Member
  • *****
  • Posts: 1409
  • Karma: +0/-0
Every player in area?
« Reply #1 on: July 17, 2012, 09:11:50 pm »


               Something like this:

object oArea = GetArea (OBJECT_SELF);
object oPC = GetFirstPC();
while (GetIsObjectValid (oPC))
   {
      if (GetArea (oPC) == oArea)
           {
             // Do stuff.
           }
      oPC = GetNextPC();


               
               

               
            

Legacy_Buddywarrior

  • Hero Member
  • *****
  • Posts: 512
  • Karma: +0/-0
Every player in area?
« Reply #2 on: July 17, 2012, 11:43:46 pm »


               Ahhh thank you kindly Bard!