You need to modify your raise dead and ressurection spells to accomplish this. You may be able to do this with a spell hook also but I'm not very familiar with spell hooking.
The default raise dead script for example is "nw_s0_raisdead"
Here is my raise dead spell mixed with what you wanted.
//::///////////////////////////////////////////////
//:: [Raise Dead]
//:: [NW_S0_RaisDead.nss]
//:: Copyright © 2000 Bioware Corp.
//:://////////////////////////////////////////////
//:: Brings a character back to life with 1 HP.
//:://////////////////////////////////////////////
//:: Created By: Preston Watamaniuk
//:: Created On: Jan 31, 2001
//:://////////////////////////////////////////////
//:: Last Updated By: Preston Watamaniuk, On: April 11, 2001
//:: VFX Pass By: Preston W, On: June 22, 2001
#include "x2_inc_spellhook"
void ReplaceItem(string sResRef, object oTarget, int iStack);
void main()
{
/*
Spellcast Hook Code
Added 2003-06-20 by Georg
If you want to make changes to all spells,
check x2_inc_spellhook.nss to find out more
*/
if (!X2PreSpellCastCode())
{
// If code within the PreSpellCastHook (i.e. UMD) reports FALSE, do not run this spell
return;
}
// End of Spell Cast Hook
object oBalm = GetItemPossessedBy(OBJECT_SELF, "RAISE_BALM");
object oTarget = GetSpellTargetObject();
object oSpellItem = GetSpellCastItem();
string sResRef = GetResRef(oSpellItem);
if (!GetIsDead(oTarget))
{
if (GetIsObjectValid(oSpellItem))
{
DelayCommand(1.0, ReplaceItem(sResRef, OBJECT_SELF, 1));
}
SendMessageToPC(OBJECT_SELF, "Your target is not dead.");
return;
}
if (!GetIsObjectValid(oBalm))
{
if (GetIsObjectValid(oSpellItem))
{
DelayCommand(1.0, ReplaceItem(sResRef, OBJECT_SELF, 1));
}
SendMessageToPC(OBJECT_SELF, "You do not possess the required item to raise the dead.");
return;
}
//Fire cast spell at event for the specified target
SignalEvent(oTarget, EventSpellCastAt(OBJECT_SELF, SPELL_RAISE_DEAD, FALSE));
if(GetIsDead(oTarget))
{
effect eRaise = EffectResurrection();
effect eVis = EffectVisualEffect(VFX_IMP_RAISE_DEAD);
int iTargetLevel = GetHitDice(oTarget);
int iXPTake;
if (iTargetLevel <= 10)
{
iXPTake = iTargetLevel * 66;
SetXP(oTarget, GetXP(oTarget) - iXPTake);
}
if (iTargetLevel > 10)
{
iXPTake = iTargetLevel * 100;
SetXP(oTarget, GetXP(oTarget) - iXPTake);
}
//Apply raise dead effect and VFX impact
ApplyEffectAtLocation(DURATION_TYPE_INSTANT, eVis, GetLocation(oTarget));
ApplyEffectToObject(DURATION_TYPE_INSTANT, eRaise, oTarget);
DestroyObject(oBalm);
}
}
void ReplaceItem(string sResRef, object oTarget, int iStack)
{
CreateItemOnObject(sResRef, oTarget, iStack);
}
This one has been altered to give a scroll back to a person if they use it on a living player or, now in your case, if they don't have the raise dead balm. The reason I originaly did this was that I often accidentally used my only raise dead scroll on one of the living players instead of the dead one and then you waste the scroll. Grrr.
Make sure on the line "object oBalm = GetItemPossessedBy(OBJECT_SELF, "RAISE_BALM");" you plug in the correct tag of your balm.
Hope this helps. I'll alter the Ressurection spell to if you need. the default for it is "nw_s0_resserec".
Modifié par GhostOfGod, 02 novembre 2010 - 06:40 .