![]() |
Npc to Npc
I've been trying to get an NPC to communicate with another. (such as touching one affects the other) Trigger doesn't seem to work, and I am unable to get callnpc to work either. I don't know if it is the way I am doing it or how it's called...
|
PHP Code:
CallNPC is really a relic from pre npcserver/pre GS2 days, may still work Clientside but it's somewhat deprecated. |
You can use getareanpcs(float, float, float, float) and loop through and find the NPC by a unique id or joined class even.
Baddies find other baddies, I.e: PHP Code:
PHP Code:
PHP Code:
|
I believe ffcmike's explaination is sufficient, however I'm unsure of the this.level.var. Do i insert the level name here or npc? I'm confused as to how to implement in the level... I tried in the script and it comes back as it can't find this.level.someothername.wasTouched (I tried different names in my script, just guess and test with no luck)
|
"this.level" you leave the same, the "somename" part is up to you, you just need to make sure that whatever name is being referred to in one NPC is the specified reference name for the opposite NPC.
|
Yes I understand that, but the reference name is confusing? I place the this.level.var which is what the player would touch, then in the other NPC this.level.var is triggered to hide the image? I'm still very confused, please enlighten me.
|
I believe "var" is a protected variable name, try something else.
|
thats just in my example on forums
|
Maybe show your current script of the 2 NPCs?
Should be as simple as this: NPC 1 PHP Code:
PHP Code:
|
Yea thats how I was doing it, but I get this error and it's the same with mine and yours... : Script: Function obj2.wasTouched not found at line 6 of explodeswitch in script of npcs[0] (in level zie_scripttest.nw at pos (39, 32))
|
Strangest thing actually, I tried it myself and it seemed to be doing nothing at all despite all of my echo's suggesting it was working, I then reconnect to find that the NPC was indeed being hidden just for some reason this was not being sent to the player so it remained visible on my client, this is something Stefan should probably look into.
You can always just to this Clientside if this is a single player thing. |
lol.. I didn't think I was crazy.. so just clientside the whole script?
|
This definitely works clientside.
|
Thanks mike, sucked it took like 2hrs to do something so simple lol
|
Kinda on the same note I am now trying to lay an npc down and have it affect another npc while it is there. again should i trigger an action? I am unsure of this process, but I am trying to affect the npc clientside. I may have to do it serverside?
|
| All times are GMT +2. The time now is 02:59 AM. |
Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2026, vBulletin Solutions Inc.
Copyright (C) 1998-2019 Toonslab All Rights Reserved.