Graal Forums  

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

Reply
 
Thread Tools Search this Thread Display Modes
  #1  
Old 07-13-2009, 12:21 AM
[email protected] jamerson61894@yahoo.com is offline
Banned
Join Date: Jul 2008
Posts: 83
jamerson61894@yahoo.com is an unknown quantity at this point
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
Reply With Quote
  #2  
Old 07-13-2009, 12:37 AM
Crow Crow is offline
ǝɔɐɹq ʎןɹnɔ
Crow's Avatar
Join Date: Dec 2006
Location: Germany
Posts: 5,153
Crow has a reputation beyond reputeCrow has a reputation beyond reputeCrow has a reputation beyond reputeCrow has a reputation beyond reputeCrow has a reputation beyond reputeCrow has a reputation beyond reputeCrow has a reputation beyond reputeCrow has a reputation beyond reputeCrow has a reputation beyond reputeCrow has a reputation beyond reputeCrow has a reputation beyond repute
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.
Reply With Quote
  #3  
Old 07-13-2009, 02:51 PM
Gambet Gambet is offline
Registered User
Join Date: Oct 2003
Posts: 2,712
Gambet is on a distinguished road
Quote:
Originally Posted by Crow View Post
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

Reply With Quote
Reply


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 01:29 PM.


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