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 07-18-2013, 09:35 PM
greggiles greggiles is offline
Registered User
greggiles's Avatar
Join Date: Sep 2007
Posts: 149
greggiles has a spectacular aura about
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
Reply With Quote
  #2  
Old 07-18-2013, 09:44 PM
callimuc callimuc is offline
callimuc's Avatar
Join Date: Nov 2010
Location: Germany
Posts: 1,015
callimuc is a splendid one to beholdcallimuc is a splendid one to beholdcallimuc is a splendid one to beholdcallimuc is a splendid one to beholdcallimuc is a splendid one to behold
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); 

__________________
MEEP!
Reply With Quote
  #3  
Old 07-18-2013, 09:48 PM
DustyPorViva DustyPorViva is offline
Will work for food. Maybe
DustyPorViva's Avatar
Join Date: Sep 2003
Location: Maryland, USA
Posts: 9,589
DustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond repute
Send a message via AIM to DustyPorViva Send a message via MSN to DustyPorViva
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.
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 11:24 AM.


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