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 02-06-2004, 12:01 PM
Jimmii Jimmii is offline
Registered User
Join Date: Jan 2004
Posts: 3
Jimmii is on a distinguished road
mouse -> ID

you pass a players ID into with(allplayers(i)) do you not?

how would i say, get this ID # from a player when i say, click on them... i don't think its testplayer, because that gets index...
Reply With Quote
  #2  
Old 02-06-2004, 02:18 PM
Termina_Owner Termina_Owner is offline
Registered User
Join Date: Oct 2003
Posts: 175
Termina_Owner is on a distinguished road
NPC Code:

with (players[i])

with (allplayers[i])

testplayer(x,y)



All players ID can't be found unless you check the logs (Alt+0) for when the player entered:

Added player Termina_Owner (id: 2)

Clear?
__________________
- Rance Vicious
Reply With Quote
  #3  
Old 02-06-2004, 02:39 PM
Loriel Loriel is offline
Somewhat rusty
Loriel's Avatar
Join Date: Mar 2001
Posts: 5,059
Loriel is a name known to allLoriel is a name known to allLoriel is a name known to allLoriel is a name known to all
Re: mouse -> ID

Quote:
Originally posted by Jimmii
you pass a players ID into with(allplayers(i)) do you not?
Nope. Allplayers takes a global index that is different from both the local index and the player ID.
Player IDs are not neccessarily sequential, because if a player with a lower ID logs off, the higher ones to not change their ID. Thus, you could not do for (i = 0; i < allplayerscount; i ++) ...
If you want to find a certain player, you can use testplayer to get his index, then use that index with #a() to get his account name, and use with (getplayer()).
Reply With Quote
  #4  
Old 02-06-2004, 10:55 PM
Termina_Owner Termina_Owner is offline
Registered User
Join Date: Oct 2003
Posts: 175
Termina_Owner is on a distinguished road
Erm... Global Player ID is shown in two places: Log Frame, and RC.

But programming-speaking, the only way would be doing the for loop with allplayerscount, which would produce somewhat a lot of lag.
__________________
- Rance Vicious
Reply With Quote
  #5  
Old 02-07-2004, 12:58 AM
Duwul Duwul is offline
Registered User
Join Date: Nov 2003
Posts: 105
Duwul is on a distinguished road
Would be easier if we could use mousex/y serverside.

You could do

NPC Code:

with (players[testplayer(mousex,mousey)])



if it was serverside.

I suppose you could check for mousedown on the clientside, triggeraction the mouse coordinates, then do

NPC Code:

with players[testplayer(strtofloat(#p(0)),strtofloat(#p(1)))])

__________________
-Ajira
Liek, omigosh.
<3 DoomsDay.
Reply With Quote
  #6  
Old 02-07-2004, 02:25 AM
Termina_Owner Termina_Owner is offline
Registered User
Join Date: Oct 2003
Posts: 175
Termina_Owner is on a distinguished road
Erm.. Save work for serverside: Send the value of testplayer.

NPC Code:

with (players[strtofloat(#p(0)))
//#CLIENTSIDE
triggeraction 0,0,serverside,#w,#v(testplayer(mousex,mousey));



Though, that's ineffective: It'll send when the index is -1.
__________________
- Rance Vicious
Reply With Quote
  #7  
Old 02-07-2004, 02:58 AM
Duwul Duwul is offline
Registered User
Join Date: Nov 2003
Posts: 105
Duwul is on a distinguished road
So check that id != -1
__________________
-Ajira
Liek, omigosh.
<3 DoomsDay.
Reply With Quote
  #8  
Old 02-07-2004, 06:19 AM
Loriel Loriel is offline
Somewhat rusty
Loriel's Avatar
Join Date: Mar 2001
Posts: 5,059
Loriel is a name known to allLoriel is a name known to allLoriel is a name known to allLoriel is a name known to all
Quote:
Originally posted by Termina_Owner
Erm.. Save work for serverside: Send the value of testplayer.
A player's index is not guaranteed to be the same serverside and clientside. Use playerid and loop again, or just pass the mouse coordinates.
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 09:37 AM.


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