NPC spawn's laying down and kneeling Edit

Spawning an NPC in praying or just about any other action is simple. To spawn them in praying, simply add the script below to the bottom of the NPC's OnSpawn script. This one is set to 90000 Sec., which should be long enough for the NPC to stay there until interupted.


A PC clicking on the NPC will make them get up, or you can use anouther script to send a ClearAllActions() to the NPC. To make them go back to kneeling, issue that same line in a script. NOTE: You may need to use AssignCommand() with it.

To Spawn them sleeping is just as easy; getting them to wake up is another story. Add this script to the bottom of the NPC's OnSpawn script:

effect eSleep = EffectSleep();

Now, to get them to wake up, loop through the effects, look for the Sleep effect, and then remove it. You can wake them up anyway you want, and the scripting is similar, but I will do this in a Trigger near the NPC. When the PC enters the Trigger, the NPC will wake up. This is just basic; you could add it to the OnPerception and make a Skill check to see if the NPC "hears" the PC.

Put this script in a Trigger neer the NPC and Replace "NPC_TAG" with that of the actual NPC. Make sure the TAG is unique.

void main()
    object oNPC = GetObjectByTag("NPC_TAG");
    effect eSleep = GetFirstEffect(oNPC);
        if(GetEffectType(eSleep) == EFFECT_TYPE_SLEEP)
        eSleep = GetNextEffect(oNPC);

That's also the basics on how to remove any effect. RemoveEffect() alone won't do it.

Unless you use some kind of a hak-pack. you won't be able to get the NPC to sleep on a bed. You can, however, get them to sleep on top of a bedroll.

Ad blocker interference detected!

Wikia is a free-to-use site that makes money from advertising. We have a modified experience for viewers using ad blockers

Wikia is not accessible if you’ve made further modifications. Remove the custom ad blocker rule(s) and the page will load as expected.