Graal Forums

Graal Forums (https://forums.graalonline.com/forums/index.php)
-   NPC Scripting (https://forums.graalonline.com/forums/forumdisplay.php?f=8)
-   -   Showimg serverside or serverside to clientside (https://forums.graalonline.com/forums/showthread.php?t=134261245)

ZeroG 12-06-2010 03:57 AM

Showimg serverside or serverside to clientside
 
PHP Code:

function onActionLeftMouse(){
   
showimg(196"green_rupee.png"mouse.x-0.5mouse.y-0.5);


I'm trying to get the image to appear serverside for everyone if a player clicks it. I'm not sure if showimg is clientside only or what.

If you can't use showimg serverside, then is is possible to use triggerserver/triggeraction to go from serverside to clientside? Similar to:

PHP Code:

function onCreated(){
  
this.attr[2] = this.name;
}
function 
onActionServerSide(){
  
this.destroy();
}
//#CLIENTSIDE
function onPlayerTouchsMe(){
  
triggerserver("npc"this.attr[2], NULL);


But instead of clientside to serverside, it's serverside to clientside.
If this is possible, I could loop through all the players and have the image be displayed to everyone on clientside.

Both scripts are on an npc, not a weapon.

Cubical 12-06-2010 11:34 AM

use putnpc2 and this.image

xAndrewx 12-06-2010 08:12 PM

what are you trying to do?

salesman 12-06-2010 08:50 PM

I don't think mouse events or mouse location are synced serverside (I could be wrong).

Depending on what type of npc it is, you can just catch the mouse event on the clientside and then send a triggeraction to the server.

for level npcs, use triggerAction(x, y, ...)
for dbnpcs, or npcs placed with putnpc(), use triggerServer("npc", this.name, ...);

edit: If you just want the NPC to change its image, use setImg(), but if you want to place an image at the mouse's location, you need to send the mousex and mousey to the serverside.

fowlplay4 12-06-2010 09:05 PM

There's really no need to show it based on mouse.x or mouse.y either if it's just clicking the NPC directly.

Use this.x and this.y as reference points instead of the mouse.

ZeroG 12-07-2010 05:56 AM

Quote:

Originally Posted by salesman (Post 1615153)
I don't think mouse events or mouse location are synced serverside (I could be wrong).

Depending on what type of npc it is, you can just catch the mouse event on the clientside and then send a triggeraction to the server.

for level npcs, use triggerAction(x, y, ...)
for dbnpcs, or npcs placed with putnpc(), use triggerServer("npc", this.name, ...);

edit: If you just want the NPC to change its image, use setImg(), but if you want to place an image at the mouse's location, you need to send the mousex and mousey to the serverside.

I'll try that, thanks.

ZeroG 12-07-2010 05:58 AM

But is it possible to send variables from serverside to clientside?


All times are GMT +2. The time now is 04:01 AM.

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