Spectacular placeable destruction on death
From NWNWiki
Contents |
[edit] Spectacular placeable destruction on death. Ver 0.1
[edit] What it does
"Anyway, I'd like some help on this one please. I have an evil NPC lurking, as such creatures do, at the bottom of a dungeon. When she/he/it is killed, a nearby sarcophagus should be destroyed.
If a visual effect can be added to either or both, that would be marvellous."
Does what Ron Lindsay requested above: a spectacular destruction of an placeable upon the death of a npc
[edit] Notes
- Just use the script as the on-death of the creature.
- Give exactly same tag to the creature and placeable.
- Make sure placeable isn't static (but 'plot' is ok)
Note: this is quite fancy as it takes into account that a creature can get 'chunked' which would spoil the visual effect... so it 'unchunk' 'chunked' creature.
[edit] The Script
// Spectacular placeable destruction ondeath ver 0.1
// Emmanuel Lusinchi / Sentur Signe
// 09/22/2002
//
//
// Destroy placeable on death of creature with visual feedback
// This works even if Chunking is on and your creature get chunked
// (the script 'un-chunk' it!)
// How to use:
// GIVE EXACTLY THE SAME TAG TO YOUR CREATURE AND THE PLACEABLE
// MAKE SURE YOUR PLACEABLE IS NOT 'STATIC' (but PLOT is fine)
// Put this script on the on-death event of your creature.
//
void main()
{
object oKiller = GetLastKiller();
string sTagToDestroy = GetTag(OBJECT_SELF);
object oTarget = GetObjectByTag(sTagToDestroy);
effect eFireLash = EffectBeam(VFX_BEAM_FIRE_LASH, OBJECT_SELF, BODY_NODE_CHEST);
effect eGore = EffectVisualEffect(VFX_COM_HIT_NEGATIVE);
effect eRez = EffectResurrection();
float fTime = 4.0f;
ApplyEffectToObject(DURATION_TYPE_INSTANT, eRez, OBJECT_SELF);
SetIsDestroyable(FALSE, FALSE, FALSE);
ApplyEffectToObject(DURATION_TYPE_INSTANT, EffectDeath(FALSE,FALSE), OBJECT_SELF);
ApplyEffectToObject(DURATION_TYPE_INSTANT, eGore, OBJECT_SELF);
ApplyEffectToObject(DURATION_TYPE_TEMPORARY, eFireLash, oTarget,fTime+0.5f);
SpeakString("Ug... I... die. How can it be?!");
AssignCommand(oKiller, DelayCommand(fTime, SetPlotFlag(oTarget, FALSE)));
AssignCommand(oKiller, DelayCommand(fTime+0.5f, ApplyEffectToObject(DURATION_TYPE_INSTANT, EffectDamage(2000), oTarget)));
DelayCommand(fTime, SetIsDestroyable(TRUE, FALSE, FALSE));
}
