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 04-24-2003, 02:48 AM
Googi Googi is offline
A Serious Epidemic
Googi's Avatar
Join Date: Oct 2001
Location: Canada
Posts: 18,866
Googi has much to be proud ofGoogi has much to be proud ofGoogi has much to be proud ofGoogi has much to be proud ofGoogi has much to be proud ofGoogi has much to be proud of
Send a message via AIM to Googi
getnpc

How does it work?
__________________
Reply With Quote
  #2  
Old 04-24-2003, 02:55 AM
Pokilty Pokilty is offline
Registered User
Join Date: Nov 2002
Posts: 101
Pokilty is on a distinguished road
I'm pretty sure it's the same as getplayer(). Just find the index of the NPC and use getnpc(index) and you can change all the attributes an npc has (x,y,etc..).
__________________
"I have not failed. I've just found 10,000 ways that won't work."
"Logic is in the eye of the logician."
Reply With Quote
  #3  
Old 04-24-2003, 02:56 AM
Python523 Python523 is offline
Banned
Join Date: Aug 2001
Location: Illinois
Posts: 3,498
Python523 is on a distinguished road
Quote:
Originally posted by Pokilty
I'm pretty sure it's the same as getplayer(). Just find the index of the NPC and use getnpc(index) and you can change all the attributes an npc has (x,y,etc..).
wrong

with(getnpc(Name))
gets a database npc from the npc list
with(npcs[index]) gets an npc using an index
Reply With Quote
  #4  
Old 04-24-2003, 04:18 AM
CheeToS2 CheeToS2 is offline
That Guy
CheeToS2's Avatar
Join Date: Dec 2001
Location: Seattle, WA
Posts: 2,528
CheeToS2 will become famous soon enough
Send a message via AIM to CheeToS2
& its serverside-only, if you didn't already know :P
__________________

Reply With Quote
  #5  
Old 04-24-2003, 09:57 AM
HoudiniMan HoudiniMan is offline
Playerworld Administrator
HoudiniMan's Avatar
Join Date: Dec 2001
Location: Calfiornia - USA
Posts: 3,512
HoudiniMan will become famous soon enough
Thought googi wasn't a scripter o_o
__________________
-HoudiniMan (Chief Playerworld Administrator)
Compulsive Support Center Checker - 5 Years and Change
Graal Support Center

Reply With Quote
  #6  
Old 04-24-2003, 10:36 AM
Loriel Loriel is offline
Somewhat rusty
Loriel's Avatar
Join Date: Mar 2001
Posts: 5,059
Loriel is a name known to allLoriel is a name known to allLoriel is a name known to allLoriel is a name known to all
Perhaps not, but he is trying hard

NPC Code:
for (i = 0; i < npcscount; i++) {
with (npcs[i]) message I worship Loriel!;
}


^ makes all NPCs in the level express their feelings about me.
That kind of loop is very common
Reply With Quote
  #7  
Old 04-24-2003, 09:38 PM
Falados Falados is offline
Cucumber NPC
Falados's Avatar
Join Date: Jan 2003
Posts: 141
Falados is on a distinguished road
Send a message via ICQ to Falados Send a message via AIM to Falados
Quote:
Originally posted by Loriel
Perhaps not, but he is trying hard

NPC Code:
for (i = 0; i < npcscount; i++) {
with (npcs[i]) message I worship Loriel!;
}


^ makes all NPCs in the level express their feelings about me.
That kind of loop is very common
That isnt getnpc
NPC Code:

with(getnpc(npcname)) {
//Code directed at npcsname
}


get npc in a with statement will direct all code to the npc you choose. all actions like setstring and this.value=# will be done inside the npc.. the name of the npc comes from its name in the database, when you create an npc on NC you do this.

Example:
NPC Code:

with(getnpc(Control-NPC)) {
setstring this.happy,Smile;
this.smiles = 1000;
}



This will set this.happy string in the Control-NPC to Smile, and the variable this.smiles to 1000.
__________________

subliminal message: 1+1=3
Reply With Quote
  #8  
Old 04-24-2003, 10:02 PM
Neoreno Neoreno is offline
Cerebrate
Neoreno's Avatar
Join Date: Aug 2001
Location: England
Posts: 1,663
Neoreno is on a distinguished road
Send a message via AIM to Neoreno
Quote:
Originally posted by Falados

This will set this.happy string in the Control-NPC to Smile, and the variable this.smiles to 1000.
Nothing better than a happy NPC-Server, it relflects the mood of its scripter. If you're a bad scripter. The thing will bite. If it is good. It will shower you with unconditional love. Thas wha mama teached meh.
__________________

Quote:
Exitus Acta Probat: The Outcome Justifies the Deed.
Reply With Quote
  #9  
Old 04-24-2003, 10:28 PM
osrs osrs is offline
Graalian since 1998
osrs's Avatar
Join Date: Mar 2002
Location: Brazil
Posts: 2,724
osrs is on a distinguished road
Send a message via ICQ to osrs Send a message via AIM to osrs Send a message via MSN to osrs Send a message via Yahoo to osrs
Quote:
Originally posted by Loriel
Perhaps not, but he is trying hard

NPC Code:
for (i = 0; i < npcscount; i++) {
with (npcs[i]) message I worship Loriel!;
}


^ makes all NPCs in the level express their feelings about me.
That kind of loop is very common
Perhaps not, but She is trying hard
Googi is a woman..¬_¬'
__________________
"Ability is what you are capable of doing. Motivation determines what you do. Attitude determines how well you do it."
Facebook: facebook.com/raysilvadotnet /
Reply With Quote
  #10  
Old 04-24-2003, 10:33 PM
Googi Googi is offline
A Serious Epidemic
Googi's Avatar
Join Date: Oct 2001
Location: Canada
Posts: 18,866
Googi has much to be proud ofGoogi has much to be proud ofGoogi has much to be proud ofGoogi has much to be proud ofGoogi has much to be proud ofGoogi has much to be proud of
Send a message via AIM to Googi
Quote:
Originally posted by Python523
with(getnpc(Name))
gets a database npc from the npc list
with(npcs[index]) gets an npc using an index
Thank you
__________________

Last edited by Googi; 04-24-2003 at 11:06 PM..
Reply With Quote
  #11  
Old 04-24-2003, 11:01 PM
Python523 Python523 is offline
Banned
Join Date: Aug 2001
Location: Illinois
Posts: 3,498
Python523 is on a distinguished road
Quote:
Originally posted by osrs


Perhaps not, but She is trying hard
Googi is a woman..¬_¬'
noone knows what googi is

Last edited by Python523; 04-25-2003 at 12:30 AM..
Reply With Quote
  #12  
Old 04-25-2003, 12:22 AM
Loriel Loriel is offline
Somewhat rusty
Loriel's Avatar
Join Date: Mar 2001
Posts: 5,059
Loriel is a name known to allLoriel is a name known to allLoriel is a name known to allLoriel is a name known to all
"what" is not a verb
Reply With Quote
  #13  
Old 04-25-2003, 12:31 AM
Python523 Python523 is offline
Banned
Join Date: Aug 2001
Location: Illinois
Posts: 3,498
Python523 is on a distinguished road
Quote:
Originally posted by Loriel
"what" is not a verb
*corrects self* knows
Reply With Quote
  #14  
Old 04-25-2003, 01:53 AM
HoudiniMan HoudiniMan is offline
Playerworld Administrator
HoudiniMan's Avatar
Join Date: Dec 2001
Location: Calfiornia - USA
Posts: 3,512
HoudiniMan will become famous soon enough
Quote:
Originally posted by osrs


Perhaps not, but She is trying hard
Googi is a woman..¬_¬'
Actually he's a confused boy... He'll grow out of it though, hopefully...
__________________
-HoudiniMan (Chief Playerworld Administrator)
Compulsive Support Center Checker - 5 Years and Change
Graal Support Center

Reply With Quote
  #15  
Old 04-25-2003, 02:09 AM
Neoreno Neoreno is offline
Cerebrate
Neoreno's Avatar
Join Date: Aug 2001
Location: England
Posts: 1,663
Neoreno is on a distinguished road
Send a message via AIM to Neoreno
Quote:
Originally posted by HoudiniMan


Actually he's a confused boy... He'll grow out of it though, hopefully...
Psh, you say that like it's a bad thing.
__________________

Quote:
Exitus Acta Probat: The Outcome Justifies the Deed.
Reply With Quote
  #16  
Old 04-25-2003, 06:41 AM
Pokilty Pokilty is offline
Registered User
Join Date: Nov 2002
Posts: 101
Pokilty is on a distinguished road
so i'm assuming getnpc doesn't work on local npcs?
__________________
"I have not failed. I've just found 10,000 ways that won't work."
"Logic is in the eye of the logician."
Reply With Quote
  #17  
Old 04-25-2003, 09:26 AM
HoudiniMan HoudiniMan is offline
Playerworld Administrator
HoudiniMan's Avatar
Join Date: Dec 2001
Location: Calfiornia - USA
Posts: 3,512
HoudiniMan will become famous soon enough
Quote:
Originally posted by Neoreno
Psh, you say that like it's a bad thing.
I don't think it's a bad thing, even full grown adults grow out of their mindsets periodically... It'd be a tragedy if he was to be stuck in it forever, even if the mindset was him thinking he was a flamingo and not something to do with gender.
__________________
-HoudiniMan (Chief Playerworld Administrator)
Compulsive Support Center Checker - 5 Years and Change
Graal Support Center

Reply With Quote
  #18  
Old 04-25-2003, 11:41 AM
Loriel Loriel is offline
Somewhat rusty
Loriel's Avatar
Join Date: Mar 2001
Posts: 5,059
Loriel is a name known to allLoriel is a name known to allLoriel is a name known to allLoriel is a name known to all
Quote:
Originally posted by Kaimetsu
Nope, for that just use npcs[x]
That's why I posted that loop
You can easily stuff it with conditions to check wether the current NPC is the one you want to go "with".
Reply With Quote
  #19  
Old 04-25-2003, 07:03 PM
HoudiniMan HoudiniMan is offline
Playerworld Administrator
HoudiniMan's Avatar
Join Date: Dec 2001
Location: Calfiornia - USA
Posts: 3,512
HoudiniMan will become famous soon enough
I don't think he ever said he wanted to do that... he was just asking about getnpc.
__________________
-HoudiniMan (Chief Playerworld Administrator)
Compulsive Support Center Checker - 5 Years and Change
Graal Support Center

Reply With Quote
  #20  
Old 04-26-2003, 03:31 PM
osrs osrs is offline
Graalian since 1998
osrs's Avatar
Join Date: Mar 2002
Location: Brazil
Posts: 2,724
osrs is on a distinguished road
Send a message via ICQ to osrs Send a message via AIM to osrs Send a message via MSN to osrs Send a message via Yahoo to osrs
Quote:
Originally posted by Python523

noone knows what googi is
Check screenshot..
Attached Thumbnails
Click image for larger version

Name:	googi_details.jpg
Views:	131
Size:	34.1 KB
ID:	23607  
__________________
"Ability is what you are capable of doing. Motivation determines what you do. Attitude determines how well you do it."
Facebook: facebook.com/raysilvadotnet /
Reply With Quote
  #21  
Old 04-26-2003, 08:45 PM
HoudiniMan HoudiniMan is offline
Playerworld Administrator
HoudiniMan's Avatar
Join Date: Dec 2001
Location: Calfiornia - USA
Posts: 3,512
HoudiniMan will become famous soon enough
He's a boy.
There was a big thing on the forums a while back about it.
__________________
-HoudiniMan (Chief Playerworld Administrator)
Compulsive Support Center Checker - 5 Years and Change
Graal Support Center

Reply With Quote
  #22  
Old 04-26-2003, 09:07 PM
Python523 Python523 is offline
Banned
Join Date: Aug 2001
Location: Illinois
Posts: 3,498
Python523 is on a distinguished road
Quote:
Originally posted by osrs


Check screenshot..
people can lie.
Reply With Quote
  #23  
Old 04-27-2003, 01:30 AM
Googi Googi is offline
A Serious Epidemic
Googi's Avatar
Join Date: Oct 2001
Location: Canada
Posts: 18,866
Googi has much to be proud ofGoogi has much to be proud ofGoogi has much to be proud ofGoogi has much to be proud ofGoogi has much to be proud ofGoogi has much to be proud of
Send a message via AIM to Googi
, my threads on the this forum always seem to be brought off-topic.

Anyways, is it possible to do something similar to timershow but with showimg or showtext instead of having it appear in chat text?
__________________
Reply With Quote
  #24  
Old 04-27-2003, 01:37 AM
Neoreno Neoreno is offline
Cerebrate
Neoreno's Avatar
Join Date: Aug 2001
Location: England
Posts: 1,663
Neoreno is on a distinguished road
Send a message via AIM to Neoreno
You could always have the showtext display the variable 'timeout'.
__________________

Quote:
Exitus Acta Probat: The Outcome Justifies the Deed.
Reply With Quote
  #25  
Old 04-27-2003, 03:22 AM
Googi Googi is offline
A Serious Epidemic
Googi's Avatar
Join Date: Oct 2001
Location: Canada
Posts: 18,866
Googi has much to be proud ofGoogi has much to be proud ofGoogi has much to be proud ofGoogi has much to be proud ofGoogi has much to be proud ofGoogi has much to be proud of
Send a message via AIM to Googi
Thank you

And, lastly, how do I show a this.var using showtext?
__________________
Reply With Quote
  #26  
Old 04-27-2003, 04:06 AM
Googi Googi is offline
A Serious Epidemic
Googi's Avatar
Join Date: Oct 2001
Location: Canada
Posts: 18,866
Googi has much to be proud ofGoogi has much to be proud ofGoogi has much to be proud ofGoogi has much to be proud ofGoogi has much to be proud ofGoogi has much to be proud of
Send a message via AIM to Googi
Quote:
Originally posted by Neoreno
You could always have the showtext display the variable 'timeout'.
That doesn't "countdown" like timershow does, however
__________________
Reply With Quote
  #27  
Old 04-27-2003, 06:06 AM
Googi Googi is offline
A Serious Epidemic
Googi's Avatar
Join Date: Oct 2001
Location: Canada
Posts: 18,866
Googi has much to be proud ofGoogi has much to be proud ofGoogi has much to be proud ofGoogi has much to be proud ofGoogi has much to be proud ofGoogi has much to be proud of
Send a message via AIM to Googi
Quote:
Originally posted by Kaimetsu
It does if you refresh the showtext every 0.05 seconds.
How can I do that without using a timeout loop or sleep?
__________________
Reply With Quote
  #28  
Old 04-27-2003, 10:16 AM
HoudiniMan HoudiniMan is offline
Playerworld Administrator
HoudiniMan's Avatar
Join Date: Dec 2001
Location: Calfiornia - USA
Posts: 3,512
HoudiniMan will become famous soon enough
Quote:
Originally posted by Googi


How can I do that without using a timeout loop or sleep?
Why not a timeout loop?
__________________
-HoudiniMan (Chief Playerworld Administrator)
Compulsive Support Center Checker - 5 Years and Change
Graal Support Center

Reply With Quote
  #29  
Old 04-27-2003, 09:44 PM
HoudiniMan HoudiniMan is offline
Playerworld Administrator
HoudiniMan's Avatar
Join Date: Dec 2001
Location: Calfiornia - USA
Posts: 3,512
HoudiniMan will become famous soon enough
Quote:
Originally posted by Kaimetsu


He would need a 0.05 timeout loop to be constantly refreshing the readout, which would override the NPC's main timeout and render the whole thing pointless.
Ah, i must have missed where he said he had a timeout already...
__________________
-HoudiniMan (Chief Playerworld Administrator)
Compulsive Support Center Checker - 5 Years and Change
Graal Support Center

Reply With Quote
  #30  
Old 04-28-2003, 09:03 AM
HoudiniMan HoudiniMan is offline
Playerworld Administrator
HoudiniMan's Avatar
Join Date: Dec 2001
Location: Calfiornia - USA
Posts: 3,512
HoudiniMan will become famous soon enough
Well i've never heard of timershow to be honest... heh.
__________________
-HoudiniMan (Chief Playerworld Administrator)
Compulsive Support Center Checker - 5 Years and Change
Graal Support Center

Reply With Quote
  #31  
Old 04-28-2003, 01:47 PM
Pokilty Pokilty is offline
Registered User
Join Date: Nov 2002
Posts: 101
Pokilty is on a distinguished road
I think timershow just shows the amount of time elapsed on a timeout as the chat text of the player. Never used it... I think using a variable is easier.
__________________
"I have not failed. I've just found 10,000 ways that won't work."
"Logic is in the eye of the logician."
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 12:01 AM.


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