Server Totals
Visimontium - (1)
M'Chek - (1)
Wilderness - (0)
Ferrell - (0)
Elysia - (0)
Le'Or - (0)
Deglos - (0)
Underdark - (0)
Mikona - (0)
Total players: 2
Gallery

Links Menu

How can I make an NPC appear asleep?

Moderators: Nighthawk4, Dungeon Masters

How can I make an NPC appear asleep?

PostAuthor: Furin » Tue Oct 14, 2003 5:40 am

I have an NPC little boy, and I want him to be asleep always and forever.
I put an onSpawn effect to kill him (so he'd lie down), but he now the instant he appears he falls face-down (good), fades out (bad) and leaves behind 4 gold (sad, really).

How can I get him to stay in place, face-down (or face up--I don't care)?

And ideally, I'd love to get him sawing wood like our PCs do when they sleep (you know, "ZZZZZ...."). Is that possible? I mean, hell, of course it's possible. Can anyone tell me how to do it?

And as a bonus, is it possible to get him to be sleeping on a bed?

Also, I just started using the toolset (yesterday). So don't be bashful about talking to me like I'm an idjit.

Thanks very much,
Furin

Furin
Scholar of Fools
 
Posts: 431
Joined: Thu Oct 31, 2002 1:41 am
Location: San Francisco Bay Area, USA (GMT - 7 in summer)

PostAuthor: marauder » Tue Oct 14, 2003 5:47 am

Put this in the onSpawn

Code: Select all
   object oPlayer = OBJECT_SELF;
   AssignCommand (oPlayer, ActionPlayAnimation (iSleepAnimation, 1.0, 5.0));
   DelayCommand (7.0f, ApplyEffectToObject (DURATION_TYPE_PERMANENT, eNap, oPlayer, 0.0));
   AssignCommand (oPlayer, ActionPlayAnimation (iSleepAnimation, 1.0, 300.0));


oPlayer should be the object that you want to sleep. You can rename it accordingly, but this was taken from a script that made a PC sleep, and I did not change the names.

*edited to add duration to be permanent*
It is the mark of an educated mind to be able to entertain a thought without accepting it.

-Aristotle
User avatar
marauder
Scholar
 
Posts: 1320
Joined: Sun Feb 23, 2003 3:36 am
Location: College Station, TX (GMT -6)

PostAuthor: Aloro » Tue Oct 14, 2003 6:09 am

Why would you DelayCommand something in the OnSpawn?

Also... neither iSleepAnimation nor eNap are defined in the above code. ;)

Generally, if I want the NPC's status to change, I'd add a trigger or an OnEnter script or something like that. Since this is supposed to be an always-on effect (as I understand it), you can simply put something like this in the creature's OnSpawn:

Code: Select all
void main()
{
    ApplyEffectToObject(DURATION_TYPE_PERMANENT, EffectSleep(), OBJECT_SELF);
}


- Aloro
Aleksandr Solzhenitsyn wrote:The meaning of earthly existence lies, not as we have grown used to thinking, in prosperity, but in the development of the soul.
User avatar
Aloro
Team Member; Retired with Honors
 
Posts: 12810
Joined: Sat Dec 28, 2002 5:11 am
Location: Rainbow's End

PostAuthor: marauder » Tue Oct 14, 2003 6:21 am

I cut it from some other code. The reason for the delay was because of another animation that was playing if I remember correctly. It is not needed. Also yes I did not notice the iSleepAnimation missing. Yours is a lot better Aloro ;-)
It is the mark of an educated mind to be able to entertain a thought without accepting it.

-Aristotle
User avatar
marauder
Scholar
 
Posts: 1320
Joined: Sun Feb 23, 2003 3:36 am
Location: College Station, TX (GMT -6)


Return to NWN Scripting

Who is online

Registered users: Bing [Bot], Google [Bot], ShadowViper