Had to compromise and settle for scripted statues that animate for just a moment then freeze. I took Kalbaern's scripts and modified to the OnSpawn event to work as an OnPerception event. The statues seem to hold the chosen pose, even when the PC moves out of perception range or leaves the area - so its slightly more reliable (at least in my experience).
I tried making placeable statues, but the models I want to use for the villagers all have skins, and, although the statues loaded fine in the toolset, they crashed the game. My guess is that the game doesn't like placeables with skinmesh.
I'll give the OnPerception script below - the OnConversation script is unmodified.
void main()
{
object oPercep = GetLastPerceived();
if (GetIsObjectValid(oPercep))
{
int nAnimation = GetLocalInt(OBJECT_SELF, "ANIMATION");
switch(nAnimation)
{
case 0:
case 1: nAnimation = ANIMATION_LOOPING_CONJURE1; break;
case 2: nAnimation = ANIMATION_LOOPING_CONJURE2; break;
case 3: nAnimation = ANIMATION_LOOPING_DEAD_BACK; break;
case 4: nAnimation = ANIMATION_LOOPING_GET_LOW; break;
case 5: nAnimation = ANIMATION_LOOPING_GET_MID; break;
case 6: nAnimation = ANIMATION_LOOPING_LOOK_FAR; break;
case 7: nAnimation = ANIMATION_LOOPING_MEDITATE; break;
case 8: nAnimation = ANIMATION_LOOPING_PAUSE; break;
case 9: nAnimation = ANIMATION_LOOPING_TALK_PLEADING; break;
case 10: nAnimation = ANIMATION_LOOPING_WORSHIP; break;
}
//float fDirection = IntToFloat(Random(361));
//SetFacing(fDirection);
PlayAnimation(nAnimation, 1.0, 9999.0);
effect eHold = EffectVisualEffect(VFX_DUR_FREEZE_ANIMATION);
DelayCommand(1.0,ApplyEffectToObject(DURATION_TYPE_PERMANENT, eHold, OBJECT_SELF));
//ApplyEffectToObject(DURATION_TYPE_PERMANENT, eHold, OBJECT_SELF);
effect ePetrify = EffectVisualEffect(VFX_DUR_PETRIFY);
DelayCommand(1.0,ApplyEffectToObject(DURATION_TYPE_PERMANENT, ePetrify, OBJECT_SELF));
//ApplyEffectToObject(DURATION_TYPE_PERMANENT, ePetrify, OBJECT_SELF);
SetLocalInt(OBJECT_SELF, "X1_L_IMMUNE_TO_DISPEL", 10);
}
}
I opted for using a local variable on the creature to store the animation rather than using a random animation. If no variable is stored, then the script will default to ANIMATION_LOOPING_CONJURE1 animation.
EDIT - EPIC FAIL...worked great with one NPC statue, but the moment I added more statues, the entire routine went all wonky. So its back to OnSpawn, which works adequately as long as the PC doesn't move right in once the statues OnPerception event fires and they animate.
Répondre aux messages cités Effacer
- The BioWare Forum
- → BioWare
- → Legacy Games
- → Neverwinter Nights
- → Builders - Scripting