I'm not honestly sure how many people care about this at this point, especially when setshape & triggeraction has been such a viable option for a long time now, but I've actually come up with a solution to make this possible that I've personally tested and succeeded with. It's not efficient, but it does get the job done, and if you desperately need a local npc to use client/server interaction without having the npc have a shape, you can use this.
Anyway. First I'll explain the problem that actually causes this to initially not work. The issue is that level npcs simply do not have a name on the clientside of things. Only server. So the issue is that, basically, if you try to use
PHP Code:
triggerserver("npc", this.name, "test");
you're telling it to trigger to nothing. Now, you'd think "oh I can just get the serverside name," but then comes the issue, if I can't trigger between serverside and clientside, how am I going to get that name? Well it's pretty obvious and easy. Maybe I'm not the first to figure this out, but in case anyone was interested, here you go.
PHP Code:
function onCreated() {
setTimer(1);
}
function onTimeOut() {
for (i:allplayers) {
if (i.level == this.level) {
i.client.lnpcn = this.name;
}
}
setTimer(1);
}
function onActionServerside(f) {
switch (f) {
case "f":
sendtorc("Pandar is ****ing rad as ****");
break;
}
}
//#CLIENTSIDE
function onCreated() { setTimer(1); }
function onTimeOut() {
this.n = client.lnpcn;
setTimer(1);
}
function WhatThe****EverYouWantToTriggerFrom() {
triggerserver("npc", this.n, "f");
}
Basically what this does is repeatedly assign everybody in the level a client. flag of the serverside npc name. The npc can then run a constant loop that sets a variable to the serverside name by accessing each player's client flag, and using that to trigger.
Like I said, not sure if this serves anybody any use, but I was ****ing around this morning experimenting different methods of getting triggerserver to work in a Class NPC because I've always wanted to do it, (mostly because of my irrational hatred of triggeraction() ) and when I figured it out I thought I'd share with this lovely (read: vile) community. Also,
pls rep me.
Enjoy.
