Graal Forums  

Go Back   Graal Forums > Development Forums > NPC Scripting
FAQ Members List Calendar Today's Posts

Reply
 
Thread Tools Search this Thread Display Modes
  #1  
Old 01-08-2008, 01:39 AM
Switch Switch is offline
o.o
Switch's Avatar
Join Date: Jan 2007
Location: Philadelphia
Posts: 3,038
Switch has a spectacular aura about
Send a message via MSN to Switch
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...
__________________
Oh squiggly line in my eye fluid. I see you lurking there on the peripheral of my vision.
But when I try to look at you, you scurry away.
Are you shy, squiggly line?
Why only when I ignore you, do you return to the center of my eye?
Oh, squiggly line, it's alright, you are forgiven.
Reply With Quote
  #2  
Old 01-08-2008, 01:42 AM
DustyPorViva DustyPorViva is offline
Will work for food. Maybe
DustyPorViva's Avatar
Join Date: Sep 2003
Location: Maryland, USA
Posts: 9,589
DustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond repute
Send a message via AIM to DustyPorViva Send a message via MSN to DustyPorViva
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.
Reply With Quote
  #3  
Old 01-08-2008, 01:46 AM
Switch Switch is offline
o.o
Switch's Avatar
Join Date: Jan 2007
Location: Philadelphia
Posts: 3,038
Switch has a spectacular aura about
Send a message via MSN to Switch
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?
__________________
Oh squiggly line in my eye fluid. I see you lurking there on the peripheral of my vision.
But when I try to look at you, you scurry away.
Are you shy, squiggly line?
Why only when I ignore you, do you return to the center of my eye?
Oh, squiggly line, it's alright, you are forgiven.
Reply With Quote
  #4  
Old 01-08-2008, 03:45 AM
Inverness Inverness is offline
Incubator
Inverness's Avatar
Join Date: Aug 2004
Location: Houston, Texas
Posts: 3,613
Inverness is a jewel in the roughInverness is a jewel in the rough
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.
__________________
Reply With Quote
  #5  
Old 01-08-2008, 06:02 PM
xXziroXx xXziroXx is offline
Malorian
xXziroXx's Avatar
Join Date: May 2004
Posts: 5,289
xXziroXx has a brilliant futurexXziroXx has a brilliant futurexXziroXx has a brilliant futurexXziroXx has a brilliant futurexXziroXx has a brilliant futurexXziroXx has a brilliant futurexXziroXx has a brilliant future
Data can be saved in the NPC's attributes (attr[#]) and be read/altered from clientside and serverside.
__________________
Follow my work on social media post-Graal:Updated august 2025.
Reply With Quote
  #6  
Old 01-08-2008, 06:05 PM
DustyPorViva DustyPorViva is offline
Will work for food. Maybe
DustyPorViva's Avatar
Join Date: Sep 2003
Location: Maryland, USA
Posts: 9,589
DustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond repute
Send a message via AIM to DustyPorViva Send a message via MSN to DustyPorViva
Communicating information is easy enough with attr[]'s, but what about actual function calling?
Reply With Quote
  #7  
Old 01-08-2008, 07:33 PM
Inverness Inverness is offline
Incubator
Inverness's Avatar
Join Date: Aug 2004
Location: Houston, Texas
Posts: 3,613
Inverness is a jewel in the roughInverness is a jewel in the rough
Like I said, make a name for the object.
__________________
Reply With Quote
  #8  
Old 01-08-2008, 11:49 PM
xXziroXx xXziroXx is offline
Malorian
xXziroXx's Avatar
Join Date: May 2004
Posts: 5,289
xXziroXx has a brilliant futurexXziroXx has a brilliant futurexXziroXx has a brilliant futurexXziroXx has a brilliant futurexXziroXx has a brilliant futurexXziroXx has a brilliant futurexXziroXx has a brilliant future
Quote:
Originally Posted by Inverness View Post
Like I said, make a name for the object.
Yeah, what Inverness said.
__________________
Follow my work on social media post-Graal:Updated august 2025.
Reply With Quote
  #9  
Old 01-09-2008, 01:17 AM
Kyranki Kyranki is offline
Freelance Coder
Join Date: Aug 2007
Location: At the end of the rainbow, in the pot of gold.
Posts: 202
Kyranki is on a distinguished road
Send a message via AIM to Kyranki Send a message via MSN to Kyranki
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?
__________________
Stan.
Reply With Quote
  #10  
Old 01-09-2008, 04:17 PM
Admins Admins is offline
Graal Administration
Join Date: Jan 2000
Location: Admins
Posts: 11,693
Admins has much to be proud ofAdmins has much to be proud ofAdmins has much to be proud ofAdmins has much to be proud ofAdmins has much to be proud ofAdmins has much to be proud of
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.
Reply With Quote
  #11  
Old 01-09-2008, 04:26 PM
Crow Crow is offline
ǝɔɐɹq ʎןɹnɔ
Crow's Avatar
Join Date: Dec 2006
Location: Germany
Posts: 5,153
Crow has a reputation beyond reputeCrow has a reputation beyond reputeCrow has a reputation beyond reputeCrow has a reputation beyond reputeCrow has a reputation beyond reputeCrow has a reputation beyond reputeCrow has a reputation beyond reputeCrow has a reputation beyond reputeCrow has a reputation beyond reputeCrow has a reputation beyond reputeCrow has a reputation beyond repute
That reminds me of timevar3...when will the client finally support this? :P
Reply With Quote
  #12  
Old 01-09-2008, 10:59 PM
Switch Switch is offline
o.o
Switch's Avatar
Join Date: Jan 2007
Location: Philadelphia
Posts: 3,038
Switch has a spectacular aura about
Send a message via MSN to Switch
Quote:
Originally Posted by Stefan View Post
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.
You should update the GraalEditor to:
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
__________________
Oh squiggly line in my eye fluid. I see you lurking there on the peripheral of my vision.
But when I try to look at you, you scurry away.
Are you shy, squiggly line?
Why only when I ignore you, do you return to the center of my eye?
Oh, squiggly line, it's alright, you are forgiven.
Reply With Quote
  #13  
Old 01-10-2008, 12:21 AM
Kristi Kristi is offline
Bowie's Deciple
Kristi's Avatar
Join Date: Dec 2003
Location: Boston, MA
Posts: 748
Kristi has a spectacular aura aboutKristi has a spectacular aura about
Send a message via AIM to Kristi Send a message via MSN to Kristi
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.
__________________
Reply With Quote
  #14  
Old 01-10-2008, 12:34 AM
Skyld Skyld is offline
Script-fu
Skyld's Avatar
Join Date: Jan 2002
Location: United Kingdom
Posts: 3,914
Skyld has much to be proud ofSkyld has much to be proud ofSkyld has much to be proud ofSkyld has much to be proud ofSkyld has much to be proud ofSkyld has much to be proud of
Send a message via AIM to Skyld
Quote:
Originally Posted by Crow View Post
That reminds me of timevar3...when will the client finally support this? :P
It already does support it, it's just that it is currently only synchronised when in Graal3D mode.
Reply With Quote
  #15  
Old 01-10-2008, 01:21 AM
coreys coreys is offline
N-Pulse Assistant Manager
coreys's Avatar
Join Date: Mar 2005
Posts: 2,180
coreys has a spectacular aura about
Send a message via AIM to coreys Send a message via MSN to coreys Send a message via Yahoo to coreys
Quote:
Originally Posted by Kristi View Post
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.
You could also use level vars, couldn't you?
__________________

Quote:
*SlikRick: so should I even ask about your aim status?
*Xor: well if you want to
*Xor: but i am LARPING
*SlikRick: While on a computer?
*Xor: yes
*Xor: in my living room
*SlikRick: ahh
*Xor: i have a fort setup to hide from beasts
Reply With Quote
  #16  
Old 01-10-2008, 01:55 AM
Inverness Inverness is offline
Incubator
Inverness's Avatar
Join Date: Aug 2004
Location: Houston, Texas
Posts: 3,613
Inverness is a jewel in the roughInverness is a jewel in the rough
levels vars are just this. variables in the level object.
__________________
Reply With Quote
  #17  
Old 01-10-2008, 02:24 AM
Switch Switch is offline
o.o
Switch's Avatar
Join Date: Jan 2007
Location: Philadelphia
Posts: 3,038
Switch has a spectacular aura about
Send a message via MSN to Switch
Quote:
Originally Posted by Kristi View Post
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.
I'm talking about getting from clientside to serverside IN A LEVEL NPC.
__________________
Oh squiggly line in my eye fluid. I see you lurking there on the peripheral of my vision.
But when I try to look at you, you scurry away.
Are you shy, squiggly line?
Why only when I ignore you, do you return to the center of my eye?
Oh, squiggly line, it's alright, you are forgiven.
Reply With Quote
  #18  
Old 01-10-2008, 04:00 AM
napo_p2p napo_p2p is offline
oh snaps
napo_p2p's Avatar
Join Date: Sep 2003
Location: Pismo Beach, California
Posts: 2,118
napo_p2p has a spectacular aura aboutnapo_p2p has a spectacular aura about
Send a message via AIM to napo_p2p Send a message via MSN to napo_p2p
Quote:
Originally Posted by Switch View Post
I'm talking about getting from clientside to serverside IN A LEVEL NPC.
Quote:
Originally Posted by Switch
"triggernpc(x,y,params,..)" which x,y triggers an NPC IN THAT LEVEL with those coords.
You can use triggeraction to do just that ... (just make sure you set the NPCs shape).

Just an example:
PHP Code:
function onCreated() {
  
setshape(13232);
}

function 
onActionMessage(msg) {
  
this.chat temp.msg;
}

//#CLIENTSIDE
function onPlayerChats() {
  
triggeraction(this.xthis.y"message"player.chat);

__________________
Scito hoc super omnia.
Haec vita est tua una sola.
Dum vita superest, utere maxime quoque puncto, momento, et hora quae habes.
Tempus neminem non manet.
Noli manere tempus.
Carpe Diem

Seize the Day.
Reply With Quote
  #19  
Old 01-10-2008, 04:05 AM
coreys coreys is offline
N-Pulse Assistant Manager
coreys's Avatar
Join Date: Mar 2005
Posts: 2,180
coreys has a spectacular aura about
Send a message via AIM to coreys Send a message via MSN to coreys Send a message via Yahoo to coreys
Quote:
Originally Posted by Inverness View Post
levels vars are just this. variables in the level object.
Yeah...I know. But using level vars could work well in certain cases, I think, for this.
__________________

Quote:
*SlikRick: so should I even ask about your aim status?
*Xor: well if you want to
*Xor: but i am LARPING
*SlikRick: While on a computer?
*Xor: yes
*Xor: in my living room
*SlikRick: ahh
*Xor: i have a fort setup to hide from beasts
Reply With Quote
  #20  
Old 01-10-2008, 04:32 AM
Switch Switch is offline
o.o
Switch's Avatar
Join Date: Jan 2007
Location: Philadelphia
Posts: 3,038
Switch has a spectacular aura about
Send a message via MSN to Switch
Quote:
Originally Posted by napo_p2p View Post
You can use triggeraction to do just that ... (just make sure you set the NPCs shape).

Just an example:
PHP Code:
function onCreated() {
  
setshape(13232);
}

function 
onActionMessage(msg) {
  
this.chat temp.msg;
}

//#CLIENTSIDE
function onPlayerChats() {
  
triggeraction(this.xthis.y"message"player.chat);

Really?
Must have not worked last time because I didn't set set a shape
Thanks!
__________________
Oh squiggly line in my eye fluid. I see you lurking there on the peripheral of my vision.
But when I try to look at you, you scurry away.
Are you shy, squiggly line?
Why only when I ignore you, do you return to the center of my eye?
Oh, squiggly line, it's alright, you are forgiven.
Reply With Quote
  #21  
Old 01-10-2008, 03:23 PM
Crow Crow is offline
ǝɔɐɹq ʎןɹnɔ
Crow's Avatar
Join Date: Dec 2006
Location: Germany
Posts: 5,153
Crow has a reputation beyond reputeCrow has a reputation beyond reputeCrow has a reputation beyond reputeCrow has a reputation beyond reputeCrow has a reputation beyond reputeCrow has a reputation beyond reputeCrow has a reputation beyond reputeCrow has a reputation beyond reputeCrow has a reputation beyond reputeCrow has a reputation beyond reputeCrow has a reputation beyond repute
Quote:
Originally Posted by Skyld View Post
It already does support it, it's just that it is currently only synchronised when in Graal3D mode.
Thats what I was talking about, sorry for not being clear.
Reply With Quote
Reply


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +2. The time now is 10:10 PM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2026, vBulletin Solutions Inc.
Copyright (C) 1998-2019 Toonslab All Rights Reserved.