Graal Forums

Graal Forums (https://forums.graalonline.com/forums/index.php)
-   NPC Scripting (https://forums.graalonline.com/forums/forumdisplay.php?f=8)
-   -   getnpc (https://forums.graalonline.com/forums/showthread.php?t=44456)

Googi 04-24-2003 02:48 AM

getnpc
 
How does it work?

Pokilty 04-24-2003 02:55 AM

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..).

Python523 04-24-2003 02:56 AM

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

CheeToS2 04-24-2003 04:18 AM

& its serverside-only, if you didn't already know :P

HoudiniMan 04-24-2003 09:57 AM

Thought googi wasn't a scripter o_o

Loriel 04-24-2003 10:36 AM

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 :)

Falados 04-24-2003 09:38 PM

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.

Neoreno 04-24-2003 10:02 PM

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.

osrs 04-24-2003 10:28 PM

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..¬_¬'

Googi 04-24-2003 10:33 PM

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 :)

Python523 04-24-2003 11:01 PM

Quote:

Originally posted by osrs


Perhaps not, but She is trying hard :)
Googi is a woman..¬_¬'

noone knows what googi is

Loriel 04-25-2003 12:22 AM

"what" is not a verb :)

Python523 04-25-2003 12:31 AM

Quote:

Originally posted by Loriel
"what" is not a verb :)
*corrects self* knows

HoudiniMan 04-25-2003 01:53 AM

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...

Neoreno 04-25-2003 02:09 AM

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.

Pokilty 04-25-2003 06:41 AM

so i'm assuming getnpc doesn't work on local npcs?

HoudiniMan 04-25-2003 09:26 AM

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.

Loriel 04-25-2003 11:41 AM

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".

HoudiniMan 04-25-2003 07:03 PM

I don't think he ever said he wanted to do that... he was just asking about getnpc.

osrs 04-26-2003 03:31 PM

1 Attachment(s)
Quote:

Originally posted by Python523

noone knows what googi is

Check screenshot..:rolleyes:

HoudiniMan 04-26-2003 08:45 PM

He's a boy.
There was a big thing on the forums a while back about it.

Python523 04-26-2003 09:07 PM

Quote:

Originally posted by osrs


Check screenshot..:rolleyes:

people can lie.

Googi 04-27-2003 01:30 AM

:\, 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?

Neoreno 04-27-2003 01:37 AM

You could always have the showtext display the variable 'timeout'.

Googi 04-27-2003 03:22 AM

Thank you :)

And, lastly, how do I show a this.var using showtext?

Googi 04-27-2003 04:06 AM

Quote:

Originally posted by Neoreno
You could always have the showtext display the variable 'timeout'.
That doesn't "countdown" like timershow does, however :\

Googi 04-27-2003 06:06 AM

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?

HoudiniMan 04-27-2003 10:16 AM

Quote:

Originally posted by Googi


How can I do that without using a timeout loop or sleep?

Why not a timeout loop?

HoudiniMan 04-27-2003 09:44 PM

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 04-28-2003 09:03 AM

Well i've never heard of timershow to be honest... heh.

Pokilty 04-28-2003 01:47 PM

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.


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

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