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 06-01-2007, 09:01 PM
Angel_Light Angel_Light is offline
Varia Developer
Angel_Light's Avatar
Join Date: Nov 2005
Location: Knoxville, TN
Posts: 1,684
Angel_Light is on a distinguished road
Send a message via AIM to Angel_Light Send a message via MSN to Angel_Light
Player x y Serverside

How can I detect "a" player's x y coordinates on serverside, I've tried a few method none to seem to work properly.
__________________
Deep into the Darkness peering...
Reply With Quote
  #2  
Old 06-01-2007, 09:04 PM
Skyld Skyld is offline
Script-fu
Skyld's Avatar
Join Date: Jan 2002
Location: United Kingdom
Posts: 3,914
Skyld has much to be proud ofSkyld has much to be proud ofSkyld has much to be proud ofSkyld has much to be proud ofSkyld has much to be proud ofSkyld has much to be proud of
Send a message via AIM to Skyld
The X and Y attributes of a player are accessible through the player's object, like on the clientside, i.e. player.x, findPlayer("Skyld").x, etc.
__________________
Skyld
Reply With Quote
  #3  
Old 06-01-2007, 09:32 PM
Angel_Light Angel_Light is offline
Varia Developer
Angel_Light's Avatar
Join Date: Nov 2005
Location: Knoxville, TN
Posts: 1,684
Angel_Light is on a distinguished road
Send a message via AIM to Angel_Light Send a message via MSN to Angel_Light
right, but I'm talking about if the player just walks by the NPC (it's a Class actually) I tried FindNearestPlayer but had no luck
__________________
Deep into the Darkness peering...
Reply With Quote
  #4  
Old 06-01-2007, 10:32 PM
xAndrewx xAndrewx is offline
Registered User
xAndrewx's Avatar
Join Date: Sep 2004
Posts: 5,260
xAndrewx has much to be proud ofxAndrewx has much to be proud ofxAndrewx has much to be proud ofxAndrewx has much to be proud ofxAndrewx has much to be proud ofxAndrewx has much to be proud ofxAndrewx has much to be proud of
Hmm, I'd do it this way...
HTML Code:
function onCreated()
{
  this.setShape(1, 32, 32);
}
function onActionDetected()
{
  //Your thing, use actionPlayer to find out whom did it
}
//#CLIENTSIDE
function onPlayerEnters()
{
  this.onTimeout();
}
function onTimeout()
{
  if (player.x in |this.x - 5, this.x + 5| && player.y in |this.y - 5, this.y + 5|)
  {
    triggeraction(this.x, this.y, "Detected", "");
  }
  setTimer(0.05);
}
__________________
Reply With Quote
  #5  
Old 06-01-2007, 10:33 PM
xXziroXx xXziroXx is offline
Malorian
xXziroXx's Avatar
Join Date: May 2004
Posts: 5,289
xXziroXx has a brilliant futurexXziroXx has a brilliant futurexXziroXx has a brilliant futurexXziroXx has a brilliant futurexXziroXx has a brilliant futurexXziroXx has a brilliant futurexXziroXx has a brilliant future
setShaoe xD
__________________
Follow my work on social media post-Graal:Updated august 2025.
Reply With Quote
  #6  
Old 06-01-2007, 10:33 PM
xAndrewx xAndrewx is offline
Registered User
xAndrewx's Avatar
Join Date: Sep 2004
Posts: 5,260
xAndrewx has much to be proud ofxAndrewx has much to be proud ofxAndrewx has much to be proud ofxAndrewx has much to be proud ofxAndrewx has much to be proud ofxAndrewx has much to be proud ofxAndrewx has much to be proud of
rawr, setShape *edits
thanks ***** x
__________________
Reply With Quote
  #7  
Old 06-01-2007, 10:45 PM
Novo Novo is offline
[TServerDeveloper]
Join Date: Jun 2006
Posts: 448
Novo will become famous soon enough
And try to prevent it from sending a trigger every 0.05 seconds...
PHP Code:
if ( inrange )
  {
  if ( !
wasinrange )
    
trigger...
  
wasinrange true;
  } else 
wasinrange false
Reply With Quote
  #8  
Old 06-01-2007, 10:47 PM
xAndrewx xAndrewx is offline
Registered User
xAndrewx's Avatar
Join Date: Sep 2004
Posts: 5,260
xAndrewx has much to be proud ofxAndrewx has much to be proud ofxAndrewx has much to be proud ofxAndrewx has much to be proud ofxAndrewx has much to be proud ofxAndrewx has much to be proud ofxAndrewx has much to be proud of
Yes, I do recommend doing that
__________________
Reply With Quote
  #9  
Old 06-02-2007, 02:04 AM
Angel_Light Angel_Light is offline
Varia Developer
Angel_Light's Avatar
Join Date: Nov 2005
Location: Knoxville, TN
Posts: 1,684
Angel_Light is on a distinguished road
Send a message via AIM to Angel_Light Send a message via MSN to Angel_Light
Thanks guys! I'll go test this now

EDIT: No, not working still :/
__________________
Deep into the Darkness peering...

Last edited by Angel_Light; 06-02-2007 at 03:34 AM..
Reply With Quote
  #10  
Old 06-02-2007, 03:56 AM
Novo Novo is offline
[TServerDeveloper]
Join Date: Jun 2006
Posts: 448
Novo will become famous soon enough
triggeraction(this.x+0.5, this.y+0.5, "Detected", ""); ?
I don't know if the trigger is inclusive or exclusive on the border region.
Reply With Quote
  #11  
Old 06-02-2007, 04:40 AM
Angel_Light Angel_Light is offline
Varia Developer
Angel_Light's Avatar
Join Date: Nov 2005
Location: Knoxville, TN
Posts: 1,684
Angel_Light is on a distinguished road
Send a message via AIM to Angel_Light Send a message via MSN to Angel_Light
well, it's a class so triggeraction act different I think, O.o Eh, it's beyond my knowledge :[
__________________
Deep into the Darkness peering...
Reply With Quote
  #12  
Old 06-02-2007, 05:31 AM
killerogue killerogue is offline
Registered Omega
killerogue's Avatar
Join Date: Apr 2006
Location: United States
Posts: 1,920
killerogue is on a distinguished road
Send a message via AIM to killerogue Send a message via MSN to killerogue
Triggeractions don't act differently. You just can't use triggerserver or triggerclient inside of classes.
__________________


REMEMBER, IF YOU REP ME, LEAVE A NAME!

Quote:
Originally Posted by haunter View Post
Graal admins don't die. They go to hell and regroup.
Quote:
Originally Posted by Inverness View Post
Without scripters, your graphics and levels wouldn't do anything but sit there and look pretty.
Reply With Quote
  #13  
Old 06-02-2007, 05:52 AM
Angel_Light Angel_Light is offline
Varia Developer
Angel_Light's Avatar
Join Date: Nov 2005
Location: Knoxville, TN
Posts: 1,684
Angel_Light is on a distinguished road
Send a message via AIM to Angel_Light Send a message via MSN to Angel_Light
so triggeraction ( 0, 0, "serverside", this.name, "Foo"); Would send "Foo" to the serverside of a class? :/ If so, it doesnt for me.
__________________
Deep into the Darkness peering...
Reply With Quote
  #14  
Old 06-02-2007, 05:59 AM
DustyPorViva DustyPorViva is offline
Will work for food. Maybe
DustyPorViva's Avatar
Join Date: Sep 2003
Location: Maryland, USA
Posts: 9,589
DustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond repute
Send a message via AIM to DustyPorViva Send a message via MSN to DustyPorViva
Can't communicate server<>client with classes. Only with weapons/gui's.
Reply With Quote
  #15  
Old 06-02-2007, 06:03 AM
Angel_Light Angel_Light is offline
Varia Developer
Angel_Light's Avatar
Join Date: Nov 2005
Location: Knoxville, TN
Posts: 1,684
Angel_Light is on a distinguished road
Send a message via AIM to Angel_Light Send a message via MSN to Angel_Light
Quote:
Originally Posted by DustyPorViva View Post
Can't communicate server<>client with classes. Only with weapons/gui's.
Thought so, but, you can save vars to this.attr[#]; and communicate that way but takes alot CPU sometimes.
__________________
Deep into the Darkness peering...
Reply With Quote
  #16  
Old 06-02-2007, 06:08 AM
Novo Novo is offline
[TServerDeveloper]
Join Date: Jun 2006
Posts: 448
Novo will become famous soon enough
Quote:
Originally Posted by DustyPorViva View Post
Can't communicate server<>client with classes. Only with weapons/gui's.
NPCs can... Using the x/y coordinates of the NPC on the level. It requires setShape to be set, however.
Reply With Quote
  #17  
Old 06-02-2007, 06:10 AM
DustyPorViva DustyPorViva is offline
Will work for food. Maybe
DustyPorViva's Avatar
Join Date: Sep 2003
Location: Maryland, USA
Posts: 9,589
DustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond repute
Send a message via AIM to DustyPorViva Send a message via MSN to DustyPorViva
Ya, I wanted to create a bomb that exploded and shook the screen, but because the managing of the timer had to be serverside(destroy has to be serverside for it to delete for everyone), and the focus had to be clientside, I never managed to finish it. Sucks, and maybe communication for NPCs will be added soon.

Quote:
Originally Posted by Novo View Post
NPCs can... Using the x/y coordinates of the NPC on the level. It requires setShape to be set, however.
Hmm, I never considered actually triggering itself like that. Does that actually work, confirmed? I've heard a lot of theories on how to do it and I've tried many different ways, and nothing ever worked. And if it is true, can you do so from serverside > clientside?
Reply With Quote
  #18  
Old 06-02-2007, 11:22 AM
Novo Novo is offline
[TServerDeveloper]
Join Date: Jun 2006
Posts: 448
Novo will become famous soon enough
Quote:
Originally Posted by DustyPorViva View Post
Ya, I wanted to create a bomb that exploded and shook the screen, but because the managing of the timer had to be serverside(destroy has to be serverside for it to delete for everyone), and the focus had to be clientside, I never managed to finish it. Sucks, and maybe communication for NPCs will be added soon.


Hmm, I never considered actually triggering itself like that. Does that actually work, confirmed? I've heard a lot of theories on how to do it and I've tried many different ways, and nothing ever worked. And if it is true, can you do so from serverside > clientside?
I'm quite sure you can't do the inverse... But from client to server, yes, it works... From server to client, I'm not quite sure.
Reply With Quote
  #19  
Old 06-02-2007, 11:35 AM
killerogue killerogue is offline
Registered Omega
killerogue's Avatar
Join Date: Apr 2006
Location: United States
Posts: 1,920
killerogue is on a distinguished road
Send a message via AIM to killerogue Send a message via MSN to killerogue
Uh, you can use triggeractions and catch the events with a clientside or serverside in classes.

Like:

PHP Code:
function onActionServerside() {
}

//#CLIENTSIDE
function onCreated() {
  
triggeraction(x,y,"Serverside",NULL);

__________________


REMEMBER, IF YOU REP ME, LEAVE A NAME!

Quote:
Originally Posted by haunter View Post
Graal admins don't die. They go to hell and regroup.
Quote:
Originally Posted by Inverness View Post
Without scripters, your graphics and levels wouldn't do anything but sit there and look pretty.
Reply With Quote
  #20  
Old 06-02-2007, 06:45 PM
cbk1994 cbk1994 is offline
the fake one
cbk1994's Avatar
Join Date: Mar 2003
Location: San Francisco
Posts: 10,718
cbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond repute
Send a message via AIM to cbk1994
Try something like this
PHP Code:
function onCreated()
{
  
setshape13232 );
}
function 
onActionNearacc )
{
  
chat acc SPC "is near me!";
}
//#CLIENTSIDE
function onCreated()
{
  
setTimer.1 );
}
function 
onTimeOut()
{
  if ( 
player.x in this.1this.| && player.y in this.2this.| )
  {
    
triggeractionthis..5this..5"Near"player.account );
  }
  
setTimer.1 );

__________________
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 03:52 PM.


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