Graal Forums  

Go Back   Graal Forums > Development Forums > NPC Scripting
FAQ Members List Calendar Search Today's Posts Mark Forums Read

Reply
 
Thread Tools Search this Thread Display Modes
  #1  
Old 12-06-2010, 03:57 AM
ZeroG ZeroG is offline
Developer
Join Date: Oct 2010
Posts: 12
ZeroG is on a distinguished road
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.
Reply With Quote
  #2  
Old 12-06-2010, 11:34 AM
Cubical Cubical is offline
Banned
Join Date: Feb 2007
Posts: 1,348
Cubical has a brilliant futureCubical has a brilliant futureCubical has a brilliant futureCubical has a brilliant futureCubical has a brilliant futureCubical has a brilliant futureCubical has a brilliant future
use putnpc2 and this.image
Reply With Quote
  #3  
Old 12-06-2010, 08:12 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
what are you trying to do?
__________________
Reply With Quote
  #4  
Old 12-06-2010, 08:50 PM
salesman salesman is offline
Finger lickin' good.
salesman's Avatar
Join Date: Nov 2008
Location: Colorado
Posts: 1,865
salesman has much to be proud ofsalesman has much to be proud ofsalesman has much to be proud ofsalesman has much to be proud ofsalesman has much to be proud ofsalesman has much to be proud ofsalesman has much to be proud of
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.
__________________
Reply With Quote
  #5  
Old 12-06-2010, 09:05 PM
fowlplay4 fowlplay4 is offline
team canada
fowlplay4's Avatar
Join Date: Jul 2004
Location: Canada
Posts: 5,200
fowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond repute
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.
__________________
Quote:
Reply With Quote
  #6  
Old 12-07-2010, 05:56 AM
ZeroG ZeroG is offline
Developer
Join Date: Oct 2010
Posts: 12
ZeroG is on a distinguished road
Quote:
Originally Posted by salesman View Post
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.
Reply With Quote
  #7  
Old 12-07-2010, 05:58 AM
ZeroG ZeroG is offline
Developer
Join Date: Oct 2010
Posts: 12
ZeroG is on a distinguished road
But is it possible to send variables from serverside to clientside?
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

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 01:44 PM.


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