Graal Forums

Graal Forums (https://forums.graalonline.com/forums/index.php)
-   NPC Scripting (https://forums.graalonline.com/forums/forumdisplay.php?f=8)
-   -   scripting question (https://forums.graalonline.com/forums/showthread.php?t=86861)

[email protected] 07-13-2009 12:21 AM

scripting question
 
hey, im making a spar complex system where when you enter the level, or say /spar, a gui comes up that says "Do you want to spar?" and there is a "yes" and "no" button. If you say yes, it warps you into the middle of the spar, and if you say no, it closes the gui. My question is, how can I make the script check if there is already 2 players in the spar? like in a certain x,y? How can I make them check for 2 players in that x,y? Right now, people just come in, while others are sparring. THanks, Jamerson

Crow 07-13-2009 12:37 AM

Personally, I would just loop through all the players in the level, and if the player's x and y are inside the sparring part of the level, you increment a variable. If the value of the variable reaches two, break out of the loop (since it's not needed anymore). Then you know that there's two people inside.

Gambet 07-13-2009 02:51 PM

Quote:

Originally Posted by Crow (Post 1506473)
Personally, I would just loop through all the players in the level, and if the player's x and y are inside the sparring part of the level, you increment a variable. If the value of the variable reaches two, break out of the loop (since it's not needed anymore). Then you know that there's two people inside.


This.


Also, to check if the player is in a certain part of the level in the loop, you would use:

PHP Code:

if (player.x in |minXmaxX| && player.y in |minYmaxY|) {
 
//Stuff




All times are GMT +2. The time now is 04:06 AM.

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