View Single Post
  #6  
Old 06-20-2012, 04:37 AM
Devil_Lord2 Devil_Lord2 is offline
David K?
Devil_Lord2's Avatar
Join Date: Apr 2011
Location: PA, MD.
Posts: 643
Devil_Lord2 can only hope to improve
Quote:
Originally Posted by Hezzy002 View Post
His problem is that the client and server have different positions. He moves the NPC clientside and because of that the trigger can no longer be sent from the server to the client. The only solution I can think of for this is either placing an NPC at the origin of the NPC's spawn in the onCreated event which would relay the triggeraction to the appropriate NPC, or creating a whole NPC ID'ing system would would make it position-independent.
Serverside does not work also, if they aren't of .5's, however I have not tried to edit the origin to be less than or greater than .5's yet, so I'll try that when I have time, on testbed.

PHP Code:
NPC block.png 33.2 35.7
function onCreated(){
  
this.33.2;
  
this.35.7;
  
setshape(1,32,32);
}
function 
onActionServerside(){
  
this.chat "test";
}
//#CLIENTSIDE
function onCreated(){
  
this.33.2;
  
this.35.7;
  
triggeraction(this.x,this.y,"Serverside",null);
}
NPCEND 
Not sure how to do the whole NPC system.
My fix was just to bring it back to .5 lol..
Unless someone else wants to try ^, I will try it in a week or so.
(I'm not sure if I set both to it either)

Thank you for the reply, I'll see if it works and test when I can.

Quote:
Originally Posted by Stefan View Post
I don't exactly understand what the problem is.
showcharacter() makes the npc have a blocking behaviour like the a player, which means a rectangle of (0.5,1,2,2) (starts at x+0.5, y+1 and is 2x2 tiles wide)
triggeraction() is rounding the x and y values down to the next multiply of 0.5, which means 0.6 will become 0.5, 1.4 will become 1.
As for showcharacter(); I was only thinking that is could be worked on to be used with triggeraction.
If it works, which from the post I'm unsure, than that is great. I only tried it once, but maybe not correctly.
This type of fix is not important... at all.. but could be useful if you want to showcharacter instead of setshape.
(Yes, I understand there is no real difference, but I thought it was awkward setting shape of a character).

Basically the problem was:
this.x = 32.3;
this.y = 32.3;
under serverside or (clientside which didn't matter for triggers), it would not work due to it not being of multiples of .5;
But like Hezzy mentioned, I've never tried the exact location by editing as text. I'll try that next.

Showcharacter I just thought could be added to work like setshape for triggeraction, which isn't a problem.

Thank you as well.


The video I had already set up the triggeraction to work, I was only showing what did not work... clientside, serverside less than or greater than .5. I've never seen it mentioned in tutorials.
__________________

Digital Media Artist - David K? </3 (UnLoved)
www.davidkrout.com
www.twitch.com/DavidKkz




Last edited by Devil_Lord2; 06-20-2012 at 04:54 AM..
Reply With Quote