Is there a script that can make an NPC look dead?
script for sleeping NPC or dead npc?
#1
Posté 24 octobre 2015 - 06:12
#2
Posté 24 octobre 2015 - 08:20
You can try to assign him an animation with ActionPlayAnimation(ANIMATION_LOOPING_DEAD_BACK, float Speed, float Duration);
Edit: You can add SetCommandable(FALSE); to avoid a PC changing his animation by trying to speak with the NPC, but don't forget to set it to TRUE again if you want to do something else with your NPC!
#3
Posté 24 octobre 2015 - 09:38
That's a good method.
Another one is to set the corpse options you want, then kill the NPC. I often use
SetIsDestroyable(FALSE, TRUE, FALSE);
which makes the NPC corpse unselectable, like a static placeable. This has the advantage that players aren't explicitly told that the NPC is dead; they can't interfere with inventory or converse. You can play around with the parameters to get the effect you need, though.
You can kill the NPC with EffectDeath or EffectDamage (the difference being that only the latter fires the OnDeath event, which you might not want in this case).
To bring the corpse to life,
RemoveEffects(oNPC); ApplyEffectToObject(DURATION_TYPE_PERMANENT, EffectResurrection(), oNPC); ApplyEffectToObject(DURATION_TYPE_PERMANENT, EffectHeal(GetMaxHitPoints(oNPC)), oNPC); SetCommandable(TRUE, oNPC);
#4
Posté 24 octobre 2015 - 12:02
{
AssignCommand(OBJECT_SELF, ClearAllActions());
AssignCommand(OBJECT_SELF, ActionPlayAnimation(ANIMATION_LOOPING_DEAD_BACK, 1.0, 1800.0));
// Apply an effect.
effect eEffect;
eEffect = SupernaturalEffect(EffectParalyze());
DelayCommand(2.0, ApplyEffectToObject(DURATION_TYPE_PERMANENT, eEffect, OBJECT_SELF));
DelayCommand(1800.0, DestroyObject(OBJECT_SELF));
}
The npc will spawn dead, then lay there for a half hour, or whatever time you want. Then can spawn again later from the encounter trigger. Just be sure that the npc is not immune to a paralyze effect.
- Who said that I aime ceci
#5
Posté 24 octobre 2015 - 12:23
EffectDeath does fire the onDeath handler. It just does it BEFORE setting the NPC's HitPoints to 0 so things like GetIsDead() return FALSE. So if your onDeath handler starts with "if(!GetIsDead()) return;" or similar it won't do much. But it does fire... ![]()
- Proleric et Verilazic aiment ceci





Retour en haut







