Though I may have going through some NWN Scripting tutorials on YouTube, which I am afraid, may give steps to a simple resolution, they do not impart understanding to be able to see sources of problems.
When this, as recommended by Proleric
{Sleeping NPCs? | The Neverwinter Vault}, is placed OnSpawn, NOTHING HAPPENS.
void main()
{
effect eLieDown = EffectSleep();
effect eSnore = EffectVisualEffect (VFX_IMP_SLEEP);
effect eSleep = EffectLinkEffects (eLieDown, eSnore);
ApplyEffectToObject (DURATION_TYPE_PERMANENT, eSleep, OBJECT_SELF);
}
Yet, strangely, the NW Script Editor did not find ANYTHING wrong with it.
10-Nov-20 12:40:48: 0 Errors. âonspnsleepâ compiled successfully
When the following, modified script, is replaced from HeartBeat to OnSpawn, NOTHING HAPPENS.
///////////
//Drunken fool
/////////// //////////////////////////////////////////
//This script rolls 1d10 and causes a random walking NPC to be have as a drunk.
//Not that I know anything about that
///////////
//Script by Christopher Bernert
//Date Created: 6/27/02
//////////////////////////////////////////////////////
//object oPC = GetLastPerceived(); This can go in to recognize PCs in the future
//int iRollTen = d10(1);
void main()
{
//object oAle;
//oAle = (NW_IT_THNMISC002);
//DelayCommand(30.0, ActionRandomWalk());
//if(d100(1) > 41) //60% chance of performing a drunken act
{
{
// switch(iRollTen) //Generated Number
{
// case 10:
// ClearAllActions();
ActionDoCommand(ActionPlayAnimation
(ANIMATION_LOOPING_DEAD_FRONT));
effect eVis = EffectVisualEffect(VFX_IMP_SLEEP);
ApplyEffectToObject(DURATION_TYPE_PERMANENT, eVis, OBJECT_SELF);
ActionDoCommand(ActionPlayAnimation
(ANIMATION_LOOPING_DEAD_FRONT));
ApplyEffectToObject(DURATION_TYPE_PERMANENT, eVis, OBJECT_SELF);
ActionDoCommand(ActionPlayAnimation
(ANIMATION_LOOPING_DEAD_FRONT));
//ActionDoCommand(ActionPlayAnimation
(ANIMATION_LOOPING_PAUSE_DRUNK));
// break;
}
}
}
}
=============================================
10-Nov-20 12:45:22: 0 Errors. âsleepingnpcâ compiled successfully
Yet again, strangely, the NW Script Editor did not find ANYTHING wrong with it.
Even more strangely, when the above modified drunk to sleep is placed on HeartBeat,
the NPC sleeps, gets up, goes back to sleep, rinse/repeat/ad infinitum.
So exactly where is the problem and why in the above?