Graal Forums

Graal Forums (https://forums.graalonline.com/forums/index.php)
-   NPC Scripting (https://forums.graalonline.com/forums/forumdisplay.php?f=8)
-   -   createing temp NPC at mouse location (https://forums.graalonline.com/forums/showthread.php?t=134268484)

greggiles 07-18-2013 09:35 PM

createing temp NPC at mouse location
 
So I'm trying to figure out why the object is not creating at the mouse's x, y.
I tried mousescreenx,y and mousex,y but it doesn't place the NPC.

It works fine though placing it at player.x and player.y

What is in the CLIENTSIDE:
PHP Code:

   player.chat "Dropped Block!";
   
triggerserver("weapon"this.name"block"); 

What is in the SERVERSIDE:
PHP Code:

 if (params[0] == "block"){
  
temp.npc this.level.putNPC2(mousexmousey"");
  
temp.npc.join("block");


NOTE: I just realized I spelled 'Creating' wrong in the title lol

callimuc 07-18-2013 09:44 PM

mousex and mousey are not stored serverside, only clientside. you would need to send those datas within the triggerserver()

PHP Code:

function onActionServerSide() {
  if (
params[0] == "block") {
    
temp.npc putnpc2(params[1], params[2], "");
    
temp.npc.join("block");
  }
}

//#CLIENTSIDE
function onCreated() {
  
player.chat "Dropped Block!";
  
triggerServer("weapon"this.name"block"mousexmousey); 



DustyPorViva 07-18-2013 09:48 PM

You need to learn the differences between what serverside vs. clientside means. Serverside is everything being processed by the NPC-server. It will only have access to information on the server, server data, player data and such. Clientside deals with everything the players computer is processing. This is stuff like movement(since it's clientside), visuals(guis and tiles and so on) and other things handled by the client... thus, there is absolutely no reason the server would have any clue where the players mouse is.

So you will need to send the mouse position as parameters when you trigger the server.


All times are GMT +2. The time now is 06:30 PM.

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