Graal Forums

Graal Forums (https://forums.graalonline.com/forums/index.php)
-   NPC Scripting (https://forums.graalonline.com/forums/forumdisplay.php?f=8)
-   -   Clicking the player? (https://forums.graalonline.com/forums/showthread.php?t=36314)

Thript 08-21-2002 10:47 AM

Clicking the player?
 
I looked throught the newfeatures.txt and searched this board and saw nothing of the sort explaining or even hinting at how you would detect if the player was clicked. Now am I just using

NPC Code:
if (actionleftmouse) {



without the proper comands or is there actuly a comand for it?

Torankusu 08-21-2002 11:11 AM

i'm not too sure.

I've only seen/used the mouseover commands for players.

Thript 08-21-2002 11:46 AM

Darn, I really need it for my buffing/de-buffing system >.<

Thript 08-21-2002 12:25 PM

So it would be like

NPC Code:
if (actionleftmouse) {
testplayer stuff;
mousex;
mousey;
}



right?

screen_name 08-21-2002 12:31 PM

Quote:

actionleftmouse - the player has clicked on the npc
I got that from newfeatures2002.txt.

Thript 08-21-2002 12:32 PM

I already new that =P.

amonrabr 08-22-2002 12:12 AM

You not really need to use testplayer.. just if you wanna something in special.. but to work with hearts, swordpower..etc.... you can use the map info, so there is no lag.. i.e.

NPC Code:

//#CLIENTSIDE
if(mousedown){
for(this.a=0;this.a<playerscount;this.a++){
if(mousex in |players[this.a].x-2,players[this.a].x+2| && mousey in |players[this.a].y-2,players[this.a].y+2|){
if(players[this.a].hearts>0){say2 A player;}else {say2 A npc;}
}
}
}



Thript 08-22-2002 01:14 AM

I have it done and got it figured out thanks to Screen_Name :].

screen_name 08-22-2002 10:30 PM

Quote:

Originally posted by Thript
I have it done and got it figured out thanks to Screen_Name :].
*evil laugh inserted here*

Thript 08-23-2002 02:09 AM

Lol omg...

emortylone 08-24-2002 12:02 PM

He he. I always do something like this:
NPC Code:

for (i=0;i<playerscount;i++)
{ if (abs(mousex-players[i].x-1.25)=<1 && abs(mousey-players[i].y-.5)=<1)
{ actions;}
}


that way it checks to see where the mouse is at, and you can customize the distance you want it for. Of course you would have to do an if (created) timeout=0.5; (I would use 0.5 in this case b/c it is still faster than the player notices, but isn't as laggy as 0.1!) and then put that 'for' in the timeout and have it loop.
---Shifter


All times are GMT +2. The time now is 05:35 PM.

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