![]() |
If there's a way..?
Can you (in general, not juat YOU) access the server-side part of a NPC in a level?
How? Every time I try I can't seem to be able to... |
I haven't found an easy way to communicate serverside<>clientside with DBNPC's and level NPC's yet. I tried creating a bomb with clientside effects but had to drop it because I couldn't destroy it on the serverside(globally) while still having clientside effects.
|
Hmm.
Is it possible, then, to make a Database NPC with say, all things that you want to "drop to pick up", and all of it would be serversided, like normal? |
Communicating clientside<->serverside with any object is as simple as creating a global variable pointing to that object and keeping track of them for garbage collecting.
Though perhaps I could be of further assistance if more details were provided. |
Data can be saved in the NPC's attributes (attr[#]) and be read/altered from clientside and serverside.
|
Communicating information is easy enough with attr[]'s, but what about actual function calling?
|
Like I said, make a name for the object.
|
Quote:
|
Correct me if I'm wrong, but if I use the npcs[] array on the serverside shouldn't I be able to access the serverside section of level ncps? I've never really made a point to do so but basic scripting theory would suggest this possible?
|
You can communicate with server- and client side using the triggerserver/triggerclient functions, e.g. to communicate with a dbnpc you can use triggerserver("npc", npcname, parameters) which will invoke onActionServerSide on the npc, or use triggerserver("weapon", weaponname, parameters) to let the serverside part of the weapon do something.
|
That reminds me of timevar3...when will the client finally support this? :P
|
Quote:
Use GS2 (if it'd not be so memory consuming), allow more BIT on files, like tiles, and to "triggernpc(x,y,params,..)" which x,y triggers an NPC IN THAT LEVEL with those coords. Also allow more BIT in GraalShop :p |
if you're talking about having serverside npcs talk to each other even if they're level npc's, give it a name.
on the serverside part, do this function onCreated() { mylevelnpc = this; } now from any other script serverside, you can call it's public functions by doing mylevelnpc.functionname(); in another npc. |
Quote:
|
Quote:
|
levels vars are just this. variables in the level object.
|
Quote:
|
Quote:
Quote:
Just an example: PHP Code:
|
Quote:
|
Quote:
Must have not worked last time because I didn't set set a shape :\ Thanks! |
Quote:
|
| All times are GMT +2. The time now is 11:41 PM. |
Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2026, vBulletin Solutions Inc.
Copyright (C) 1998-2019 Toonslab All Rights Reserved.