I've come across a small and tedious difficulty, and now I know why some of my projects had to be redone.
Problems:
1. Need better tutorials for triggeraction, I keep setting shape to clientside because I kept believing it needed a shape to react from, not to.
(Not really a problem, only a difficulty in remembering and understanding)
2. I was told setshape was a replacement for showcharacter or vise versa except one was the default npc character look.
Solution: Make show character work?
3. If an X or Y is set at an offset by less than .5 it breaks the trigger.
Ex. 32.4 wouldn't work. 32.5 would work, 32.6 wouldn't work.
Solution, fix it to make work ...?
4. If any X and Y placement is done clientside, it renders serverside void...
Solution ...not sure. But it seems like anything my clientside has done via X and Y, it would have to trigger the final points serverside which seems stupid.
Graal sends positional data as a byte for triggeractions. One byte is a value between 0-255.
Graal packs the positional data into a single byte per axis, so you have limited accuracy. 20.4 is rounded down to 20, and 20.6 is rounded up to 21. Both of those are outside of the non-inclusive 32x32 range that Graal seems to be testing against.
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.
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.
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.
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.
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
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.
When I read your posts I get the feeling you have no idea what you're talking about.
I don't.
Clientside - Doesn't work for serverside.
Serverside - Doesn't work for anything not of .5's
NPC Index - Doesn't work for anything not of .5's
That is what I know.
If it doesn't work, I assume there is a problem somewhere.
Not sure how Graal was built, so I can't say I know what I'm talking about.
Anyway, you guys are more than welcome to test it yourselves.
Test 1 (Assumed it might work since on Clientside it was only one tile off. Meaning part of it was still one tile on for Serverside, and on the top-left corner half) Does not work. (This test was not tested last time)
PHP Code:
NPC block.png 28 32 function onActionServerside(cmd){ findPlayer(cmd).chat = "This Works."; } function onCreated(){ setshape(1,32,32); } //#CLIENTSIDE function onCreated(){ this.x-=1; } function onPlayerTouchsMe(){ triggeraction(this.x,this.y,"Serverside",player.account); } NPCEND
Test 2 Regular Triggeraction - Works.
PHP Code:
NPC block.png 32 32 function onActionServerside(cmd){ findPlayer(cmd).chat = "This Works."; } function onCreated(){ setshape(1,32,32); } //#CLIENTSIDE function onPlayerTouchsMe(){ triggeraction(this.x,this.y,"Serverside",player.account); } NPCEND
Test 3 Triggeraction with an added .5 on X Serverside - Works.
PHP Code:
NPC block.png 36 32 function onActionServerside(cmd){ findPlayer(cmd).chat = "This Works."; } function onCreated(){ setshape(1,32,32); this.x += .5; } //#CLIENTSIDE function onPlayerTouchsMe(){ triggeraction(this.x,this.y,"Serverside",player.account); } NPCEND
Test 4 Triggeraction with an added .3 on the Serverside - Does not work.
PHP Code:
NPC block.png 40 32 function onActionServerside(cmd){ findPlayer(cmd).chat = "This Works."; } function onCreated(){ setshape(1,32,32); this.x += .3; } //#CLIENTSIDE function onPlayerTouchsMe(){ triggeraction(this.x,this.y,"Serverside",player.account); } NPCEND
Test 5 Triggeraction with an added .3 on the NPC - Does not work. (This test was not tested last time)
PHP Code:
NPC block.png 44.3 32 function onActionServerside(cmd){ findPlayer(cmd).chat = "This Works."; } function onCreated(){ setshape(1,32,32); } //#CLIENTSIDE function onPlayerTouchsMe(){ triggeraction(this.x,this.y,"Serverside",player.account); } NPCEND
Slightly over two minute video.
Making it an NPC with its own ID is not part of the problem so it was not a test I was going to do. Not sure if NPC Characters that have interactions Clientside to Serverside should all be NPCs lol...
The only reason I came up with this is because my NPC randomly stopped working when I had her look like she was sitting correctly, -.3 tiles on the Y axis. The first time I started over, and on the second time I realized what was causing it.
Stop wasting your time, holy ****. What the Hell are you trying to accomplish? Stefan and I have both pointed out why your **** isn't working and the necessary solutions.
Stefan mentioned Showcharacter having a blocking behavior. This has nothing to do with improving in the future making it usable to trigger action. He also mentioned triggeraction rounds to the nearest multiple of .5. That was not a solution, nor an explanation of how it can be fixed, except to make things directly .5 which I've already been doing.
You told me to place the NPC at the origin of the NPC's spawn. Tried that by making the spawn less than a multiple of .5. (Both the actual NPC position, and under onCreated) Did not work.
Creating a whole NPC IDing system does seems like a waste of time and unneeded for everyone to do should they want a moving character that reacts serverside.
I've only asked for a future improvement that NPCs can use triggeraction outside of multiples of five. You may believe those solutions were necessary, and work, and I may think the area can still be improved. Lets agree to disagree with each other and I'll keep this open.
Not sure what you're trying to accomplish, but typically triggering at a specific x/y is a bad idea and prone to error for many reasons (depends on what you're trying to do, though). I can't think of a time I've had to do that in years.
Not sure what you're trying to accomplish, but typically triggering at a specific x/y is a bad idea and prone to error for many reasons (depends on what you're trying to do, though). I can't think of a time I've had to do that in years.
Isn't that how most typical minning systems, custom sword/punch systems work? By triggering at an x/y?
I believe he is saying that graal is using the cord's from where the NPC was placed, not the x/y value after the adjustment. For example when setting a npc in a spot that needs adjusted .5 to look proper. Then the tigger is basing off the cords before you hit the play button not the updated cords.? I might be wrong understanding him tho..
Isn't that how most typical minning systems, custom sword/punch systems work? By triggering at an x/y?
Some primitive systems do this, but it's not the recommended way (gives you less flexibility for things like attack radius and hitboxes). For mining it would be acceptable, although I'd probably not do it that way anyway.
Keep in mind those are essentially different use cases; Devil wants to send a message serverside to a known NPC, whereas a pickaxe wants to hit any rocks that might be at a certain (x, y).
Isn't that how most typical minning systems, custom sword/punch systems work? By triggering at an x/y?
I believe he is saying that graal is using the cord's from where the NPC was placed, not the x/y value after the adjustment. For example when setting a npc in a spot that needs adjusted .5 to look proper. Then the tigger is basing off the cords before you hit the play button not the updated cords.? I might be wrong understanding him tho..
I'd rather check for NCPs/players in a small area and treat those objects accordingly than use triggers for most things.