![]() |
Trigger Client NPC
Is there any way to trigger a clientside-function in an NPC?
|
There have been many threads about this already, please use the forum search function. You'll also have to be more specific as to what type of NPC (level NPC?) or a little bit more about what it does.
|
Quote:
PHP Code:
|
No, you normally can't trigger client like that. Think about it: It'd have to trigger client for every player in the level, right? Unless of course you did something like player.triggerclient.
However, I don't think it works for DB NPCs (putnpc2, for example). I could be wrong, though. |
Quote:
If the conditional statement 'if (blablabla)' can only be read serverside, I suggest storing the data in some other way where it could be read on the client. Edit: what I'm trying to say is that there's most likely a way to do it without needing a server->client trigger and you should be more specific with your problem. |
Quote:
I don't have a problem, it would just be handy if you could trigger a function on the Client in a level NPC ;D |
could you not just do
NPC Code: etc? |
Quote:
|
Quote:
|
It's fairly easy to send data from serverside > clientside via attr[]'s. You can do checks like that if you'd like.
What I also did was set-up a DBNPC that would intercept the triggerserver's/triggerclient's from the local NPC, and then do the communication in the DBNPC itself and then resend the function. However, I only did this for clientside > serverside, so I'm not particularly sure of how that'd work the other way around DBNPC: PHP Code:
PHP Code:
|
|
It does, but not in the way I think you want it too.
NPC Code:triggerClient( "gui", name, params...); PHP Code:
For level NPC's you just have to define the shape, such as NPC Code:0 being non-blocking.setshape( 0, 16 * 2, 16 * 3); Then you can do the triggerAction(); example PHP Code:
|
It really does need a way of directly calling a function on the clientside of the current DBNPC / Level NPC.
|
My first method works for dbNPCs and second for levelNPCs. Both methods have worked for me.
|
Thanks Angel,
but your second method doesn't work. You cannot use triggeraction() from server to client as it seems.. |
Quote:
|
you might want to put this.x + 0.5 and this.y + 0.5 in the triggeraction since it is calling it on the border. I found doing that usually fixes it.
|
Quote:
|
Quote:
|
Triggeraction probably won't work if the shape of the NPC isn't set on the serverside. This is because without a serverside setshape, the NPC server won't be able to 'find' the NPC when you do the triggeraction(since triggeraction uses blocking space only to trigger, and non-blocking will not register).
|
setshape isnt always blocking per sei, if you just do setshape( 0, 32, 32); zero will make it non-blocking
|
| All times are GMT +2. The time now is 03:53 AM. |
Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2026, vBulletin Solutions Inc.
Copyright (C) 1998-2019 Toonslab All Rights Reserved.