Graal Forums  

Go Back   Graal Forums > Development Forums > NPC Scripting
FAQ Members List Calendar Today's Posts

 
 
Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1  
Old 08-26-2008, 04:56 AM
Understood Understood is offline
Registered User
Join Date: Jun 2006
Location: Orlando, FL
Posts: 120
Understood is on a distinguished road
Looping problems

Hi, I'm relatively new to GS2 and have been trying to get this player-sorting script to work...I'm getting closer, and I -think- I have an idea what the problem is, but I can't quite figure it out.
Basically, what is supposed to happen is the first 6 players are warped on a top level, 8 tiles apart from eachother, and the next 4 are warped below them...However, it only seems to sort the first 10. (I haven't had a chance to test it with 20+, so I don't know if it's only sorting the first 10, or in sets of 10)

I included a picture in this post..the red squares are where people are being warped...just not everyone.

PHP Code:
function onCreated()
{
  
//starting x,y for top and bottom rows
  
this.conStartTopx 8.5;
  
this.conStartBottomx 23.5;  
  
this.conStartTopy 10;
  
this.conStartBottomy 20;
}

function 
onPlayerChats()
{
  if ( 
player.guild == "Events Team" )
  {
    if ( 
player.chat == ":start" )
    {
      
temp.countCons 0;

      for ( 
temp.0temp.players.size(); temp.c++ )
      {
        if ( 
players[temp.c].guild == "Convict" )
          
temp.countCons++;
      }
      
      
serverr.numStartCons temp.countCons;

      if ( !(
serverr.pbmapsize null) )
      {
        for ( 
temp.pl 0temp.pl players.size(); temp.pl++ )
        {
          if ( 
players[temp.pl].guild == "Guard" )
          {
            
players[temp.pl].setlevel2("era_prison-entrance_" serverr.pbmapsize ".nw"3040);
          }
        }

        
//This is supposed to determine the number of times 
        //the while loop should execute
        
if (serverr.numStartCons%10 != 0)
        {
          
temp.numloop int(serverr.numStartCons/10) + 1;
        }
        else
        {
          
temp.numloop serverr.numStartCons/10;
        }

        while ( 
temp.numloop )
        {
          
temp.counter 0;
          
temp.conxwarp this.conStartTopx;
          
temp.conywarp this.conStartTopy;

          for ( 
temp.0temp.players.size(); temp.p++ )
          {
            if ( 
players[temp.p].guild == "Convict" )
            {
              if ( 
temp.counter )
              {
                
players[temp.p].setlevel2("era_prison-cellroom_" serverr.pbmapsize ".nw"temp.conxwarptemp.conywarp);
                
temp.conxwarp+=8;
                if ( 
temp.counter == )
                  
temp.conxwarp this.conStartBottomx;
              }
              else if ( 
temp.counter 10 )
              {
                
temp.conywarp this.conStartBottomy;
                
players[temp.p].setlevel2("era_prison-cellroom_" serverr.pbmapsize ".nw"temp.conxwarptemp.conywarp);
                
temp.conxwarp+=8;
              }
              
temp.counter++;
            }
          }
          
temp.numloop--;
        }

      }
      else
      {
        
player.chat "I need to set the map!";
      }
    }
  }

Attached Thumbnails
Click image for larger version

Name:	explanation.png
Views:	129
Size:	56.9 KB
ID:	45687  
Reply With Quote
 


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +2. The time now is 10:11 AM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2025, vBulletin Solutions Inc.
Copyright (C) 1998-2019 Toonslab All Rights Reserved.