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 01-22-2006, 05:07 PM
talkingnoodle talkingnoodle is offline
Rapidwolve
talkingnoodle's Avatar
Join Date: Nov 2005
Location: Leominster, MA
Posts: 229
talkingnoodle is on a distinguished road
Send a message via AIM to talkingnoodle Send a message via MSN to talkingnoodle
Post testplayer x.x

I'm making a profile system and when I use rightmousebutton and testplayer, the profile only works when both of the players are on a gmap

help?
__________________


AIM: Rapidwolve Graal
MSN: [email protected]


2/12/06 - Crossroads NPC Admin
Reply With Quote
  #2  
Old 01-22-2006, 05:16 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
How about you give us more details about how you're doing this? Also, please explain how this is a problem.
__________________
Skyld
Reply With Quote
  #3  
Old 01-22-2006, 05:20 PM
Kronan Kronan is offline
yo
Kronan's Avatar
Join Date: May 2001
Location: Florida, USA
Posts: 682
Kronan is on a distinguished road
Send a message via ICQ to Kronan Send a message via AIM to Kronan Send a message via Yahoo to Kronan
Quote:
Originally Posted by talkingnoodle
I'm making a profile system and when I use rightmousebutton and testplayer, the profile only works when both of the players are on a gmap

help?
What? how? why? testplayer(x,y) only gets a players ID from the x,y you specify. And yes, provide more information so we can help you..
__________________
Reply With Quote
  #4  
Old 01-22-2006, 05:52 PM
talkingnoodle talkingnoodle is offline
Rapidwolve
talkingnoodle's Avatar
Join Date: Nov 2005
Location: Leominster, MA
Posts: 229
talkingnoodle is on a distinguished road
Send a message via AIM to talkingnoodle Send a message via MSN to talkingnoodle
ok well heres part of the script...and its a problem because when you right click inside a level the profile wont show up :-/
NPC Code:

if (mousedown){
if (rightmousebutton){
pid = testplayer(mousex,mousey);
if (pid > -1){
close();
triggeraction 0,0,serverside,-System/Profiles,mouse,#v(mousex),#v(mousey);

...

if i make (pid > -1) it only works on a gmap or when you click yourself...if i make it -2 then anyhwere you click on the screen it shows the last profile you clickd...if i make it 0 it just doesnt work
__________________


AIM: Rapidwolve Graal
MSN: [email protected]


2/12/06 - Crossroads NPC Admin
Reply With Quote
  #5  
Old 01-22-2006, 07:03 PM
Yen Yen is offline
Banned
Yen's Avatar
Join Date: Oct 2005
Location: Nova Scotia, Canada
Posts: 1,085
Yen is an unknown quantity at this point
Send a message via AIM to Yen Send a message via MSN to Yen
-1 is what's returned when you get no player.
0 is your own ID.
1 and above is another player.

Why is it sending mousex and mousey to the serverside?
Why not send #a(pid) ?
Reply With Quote
  #6  
Old 01-22-2006, 08:57 PM
talkingnoodle talkingnoodle is offline
Rapidwolve
talkingnoodle's Avatar
Join Date: Nov 2005
Location: Leominster, MA
Posts: 229
talkingnoodle is on a distinguished road
Send a message via AIM to talkingnoodle Send a message via MSN to talkingnoodle
Quote:
Originally Posted by Yen
Why is it sending mousex and mousey to the serverside?
Why not send #a(pid) ?
because on the serverside it uses testplayer agin x.x

is that bad?
__________________


AIM: Rapidwolve Graal
MSN: [email protected]


2/12/06 - Crossroads NPC Admin
Reply With Quote
  #7  
Old 01-22-2006, 09:11 PM
ZeLpH_MyStiK ZeLpH_MyStiK is offline
Scripter
ZeLpH_MyStiK's Avatar
Join Date: May 2003
Location: NYC
Posts: 553
ZeLpH_MyStiK is on a distinguished road
Send a message via MSN to ZeLpH_MyStiK Send a message via Yahoo to ZeLpH_MyStiK
You should just send the account name of the player you found on clientside through the triggeraction. Why do testplayer twice (especially there is the consideration of lag when going from clientside to serverside and vice-versa)?
__________________
Reply With Quote
  #8  
Old 01-22-2006, 11:43 PM
Admins Admins is offline
Graal Administration
Join Date: Jan 2000
Location: Admins
Posts: 11,693
Admins has much to be proud ofAdmins has much to be proud ofAdmins has much to be proud ofAdmins has much to be proud ofAdmins has much to be proud ofAdmins has much to be proud of
Yes just send #a(pindex) to the server
Reply With Quote
  #9  
Old 01-23-2006, 05:24 AM
talkingnoodle talkingnoodle is offline
Rapidwolve
talkingnoodle's Avatar
Join Date: Nov 2005
Location: Leominster, MA
Posts: 229
talkingnoodle is on a distinguished road
Send a message via AIM to talkingnoodle Send a message via MSN to talkingnoodle
Quote:
Originally Posted by Stefan
Yes just send #a(pindex) to the server
I did that and it still only works on gmaps (when they are not idle), when they are idle it doesnt work either
__________________


AIM: Rapidwolve Graal
MSN: [email protected]


2/12/06 - Crossroads NPC Admin
Reply With Quote
  #10  
Old 01-23-2006, 05:37 AM
Yen Yen is offline
Banned
Yen's Avatar
Join Date: Oct 2005
Location: Nova Scotia, Canada
Posts: 1,085
Yen is an unknown quantity at this point
Send a message via AIM to Yen Send a message via MSN to Yen
That made no sense.

Try testplayer(mousex % 65,mousey % 65), but I doubt it'll make a difference. :/
Reply With Quote
  #11  
Old 01-23-2006, 05:47 AM
Rick Rick is offline
PipBoy Extraordinaire!
Rick's Avatar
Join Date: Jul 2004
Location: Long Beach, California.
Posts: 831
Rick is on a distinguished road
Quote:
Originally Posted by Yen
That made no sense.

Try testplayer(mousex % 65,mousey % 65), but I doubt it'll make a difference. :/
How would that help?
Reply With Quote
  #12  
Old 01-23-2006, 07:25 AM
ZeLpH_MyStiK ZeLpH_MyStiK is offline
Scripter
ZeLpH_MyStiK's Avatar
Join Date: May 2003
Location: NYC
Posts: 553
ZeLpH_MyStiK is on a distinguished road
Send a message via MSN to ZeLpH_MyStiK Send a message via Yahoo to ZeLpH_MyStiK
Quote:
Originally Posted by Rick
How would that help?
It doesn't.
NPC Code:

//#CLIENTSIDE
if (mousedown) {
if (rightmousebutton) {
this.pid = testplayer(mousex,mousey);
setplayerprop #c,#a(this.pid);
}
}


See if that detects the players. If it doesn't, you can always loops through the players in the level and check if the mouse coordinates are within the coordinates used by the players. I.E.
NPC Code:

//#CLIENTSIDE
if (mousedown) { // checks to see if mouse is used
if (rightmousebutton) { // checks to see if right mouse button was used
for(i=0; i<playerscount; i++) { // loops through players in the level
this.pid = -1; // presets the id var to -1 just in case there are no players at the mouse coordinates
if (mousex in |players[i].x,players[i].x+1.5| && mousey in |players[i].y,players[i].y+2|) { // checks for players at the coordinate
this.pid = i; // if player exists sets id var to player's id
}
}
if (this.pid == -1) { // does the player exist?
setplayerprop #c,Player not detected;
}else setplayerprop #c,#a(this.pid);
}
}

__________________
Reply With Quote
  #13  
Old 01-23-2006, 07:31 AM
napo_p2p napo_p2p is offline
oh snaps
napo_p2p's Avatar
Join Date: Sep 2003
Location: Pismo Beach, California
Posts: 2,118
napo_p2p has a spectacular aura aboutnapo_p2p has a spectacular aura about
Send a message via AIM to napo_p2p Send a message via MSN to napo_p2p
Quote:
Originally Posted by Yen
Try testplayer(mousex % 65,mousey % 65), but I doubt it'll make a difference. :/
That even got me confused... (talkingnoodle/Rabidwolve don't consider doing that).

Zelph has got it better.

And Yen. I'm just wondering. What is the reasoning behind that?
__________________
Scito hoc super omnia.
Haec vita est tua una sola.
Dum vita superest, utere maxime quoque puncto, momento, et hora quae habes.
Tempus neminem non manet.
Noli manere tempus.
Carpe Diem

Seize the Day.
Reply With Quote
  #14  
Old 01-23-2006, 05:35 PM
talkingnoodle talkingnoodle is offline
Rapidwolve
talkingnoodle's Avatar
Join Date: Nov 2005
Location: Leominster, MA
Posts: 229
talkingnoodle is on a distinguished road
Send a message via AIM to talkingnoodle Send a message via MSN to talkingnoodle
ok thx
__________________


AIM: Rapidwolve Graal
MSN: [email protected]


2/12/06 - Crossroads NPC Admin
Reply With Quote
  #15  
Old 01-23-2006, 09:56 PM
Yen Yen is offline
Banned
Yen's Avatar
Join Date: Oct 2005
Location: Nova Scotia, Canada
Posts: 1,085
Yen is an unknown quantity at this point
Send a message via AIM to Yen Send a message via MSN to Yen
There's absolutely no reasoning behind it, but the only reason I could think of for testplayer() not returning anything on a gmap is that testplayer only checks on the individual level, but mousex and mousey are using coordinates on the gmap.
Reply With Quote
  #16  
Old 01-24-2006, 12:12 AM
Lance Lance is offline
dark overlord
Lance's Avatar
Join Date: Sep 2003
Location: Space Jam Mountain
Posts: 5,072
Lance is on a distinguished road
Quote:
Originally Posted by Yen
There's absolutely no reasoning behind it, but the only reason I could think of for testplayer() not returning anything on a gmap is that testplayer only checks on the individual level, but mousex and mousey are using coordinates on the gmap.
Even if that were true, why would you use 65?
Reply With Quote
  #17  
Old 01-24-2006, 12:28 AM
Yen Yen is offline
Banned
Yen's Avatar
Join Date: Oct 2005
Location: Nova Scotia, Canada
Posts: 1,085
Yen is an unknown quantity at this point
Send a message via AIM to Yen Send a message via MSN to Yen
Levels are 64x64 tiles. The 64th tile is valid, so % 65 will begin at 0,0 of your current level.
Reply With Quote
  #18  
Old 01-24-2006, 12:45 AM
Lance Lance is offline
dark overlord
Lance's Avatar
Join Date: Sep 2003
Location: Space Jam Mountain
Posts: 5,072
Lance is on a distinguished road
Quote:
Originally Posted by Yen
Levels are 64x64 tiles. The 64th tile is valid, so % 65 will begin at 0,0 of your current level.
Coordinates start at 0,0, not 1,1. From the origin, the 64th tile would be at coordinate 63. The first tile on the next level would be at coordinate 64. If you mod this value by 65 you aren't ensuring anything about the current level.
Reply With Quote
  #19  
Old 01-24-2006, 01:13 AM
Yen Yen is offline
Banned
Yen's Avatar
Join Date: Oct 2005
Location: Nova Scotia, Canada
Posts: 1,085
Yen is an unknown quantity at this point
Send a message via AIM to Yen Send a message via MSN to Yen
PHP Code:
function onKeyPressed() {
  
player.chat player.65;

I warped to the third level (on the x-axis) of a gmap, at 30,30. I made sure it attached me to the gmap.

It set my chat to 30, not 33.
Reply With Quote
  #20  
Old 01-24-2006, 01:47 AM
Lance Lance is offline
dark overlord
Lance's Avatar
Join Date: Sep 2003
Location: Space Jam Mountain
Posts: 5,072
Lance is on a distinguished road
Quote:
Originally Posted by Yen
PHP Code:
function onKeyPressed() {
  
player.chat player.65;

I warped to the third level (on the x-axis) of a gmap, at 30,30. I made sure it attached me to the gmap.

It set my chat to 30, not 33.
You're nuts.



Reply With Quote
  #21  
Old 01-24-2006, 02:59 AM
Yen Yen is offline
Banned
Yen's Avatar
Join Date: Oct 2005
Location: Nova Scotia, Canada
Posts: 1,085
Yen is an unknown quantity at this point
Send a message via AIM to Yen Send a message via MSN to Yen
No, I warped to a03.. Which was 3 down on the y-axis, not the x-axis..

-Wanders off.-
Reply With Quote
  #22  
Old 01-24-2006, 03:11 AM
Lance Lance is offline
dark overlord
Lance's Avatar
Join Date: Sep 2003
Location: Space Jam Mountain
Posts: 5,072
Lance is on a distinguished road
Quote:
Originally Posted by Yen
No, I warped to a03.. Which was 3 down on the y-axis, not the x-axis..

-Wanders off.-
Well, you said x.

Either way:



NPC Code:
    else if (player.chat == "coordtest") {
player.chat = "x: " @ player.x @ ", x % 64: " @ player.x%64 @ ", x % 65: " @ player.x%65 @ "; " @ "y: " @ player.y @ ", y % 64: " @ player.y%64 @ ", y % 65: " @ player.y%65;
}

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 05:26 AM.


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