Oui pour ça qu'il faut savoir si le placable a besoin de hp. Si ce n'est pas le cas met le placable en intrigue. Mais comme je pense que le placable peut être detruit il faut modifier ces deux sort en rajoutant une condition sur la cible du sort.
voila pour la mise à mal (à mettre dans le fichier
nw_s0_harm) :
#include "NW_I0_SPELLS"
#include "x2_inc_spellhook"
void main()
{
if (!X2PreSpellCastCode())
{
// If code within the PreSpellCastHook (i.e. UMD) reports FALSE, do not run this spell
return;
}
//Declare major variables
object oTarget = GetSpellTargetObject();
int nDamage, nHeal;
int nMetaMagic = GetMetaMagicFeat();
int nTouch = TouchAttackMelee(oTarget);
effect eVis = EffectVisualEffect(246);
effect eVis2 = EffectVisualEffect(VFX_IMP_HEALING_G);
effect eHeal, eDam;
//Check that the target is undead
if (GetObjectType(oTarget)==OBJECT_TYPE_PLACEABLE||GetObjectType(oTarget)==OBJECT_TYPE_DOOR)
return;
if (GetRacialType(oTarget) == RACIAL_TYPE_UNDEAD)
{
//Figure out the amount of damage to heal
nHeal = (GetMaxHitPoints(oTarget) - GetCurrentHitPoints(oTarget))/2;
if (nHeal>150)
nHeal=150;
//Set the heal effect
eHeal = EffectHeal(nHeal);
//Apply heal effect and VFX impact
ApplyEffectToObject(DURATION_TYPE_INSTANT, eHeal, oTarget);
ApplyEffectToObject(DURATION_TYPE_INSTANT, eVis2, oTarget);
//Fire cast spell at event for the specified target
SignalEvent(oTarget, EventSpellCastAt(OBJECT_SELF, SPELL_HARM, FALSE));
}
else if (nTouch) //== TRUE) 1 or 2 are valid return numbers from TouchAttackMelee
{
if(!GetIsReactionTypeFriendly(oTarget))
{
//Fire cast spell at event for the specified target
SignalEvent(oTarget, EventSpellCastAt(OBJECT_SELF, SPELL_HARM));
if (!MyResistSpell(OBJECT_SELF, oTarget))
{
nDamage = GetCurrentHitPoints(oTarget)/2 - d4(1);
//Check for metamagic
if (nMetaMagic == METAMAGIC_MAXIMIZE)
{
nDamage = GetCurrentHitPoints(oTarget)/2 - 1;
}
if (nDamage>150)
nDamage=150;
eDam = EffectDamage(nDamage,DAMAGE_TYPE_NEGATIVE);
//Apply the VFX impact and effects
DelayCommand(1.0, ApplyEffectToObject(DURATION_TYPE_INSTANT, eDam, oTarget));
ApplyEffectToObject(DURATION_TYPE_INSTANT, eVis, oTarget);
}
}
}
}
Voila pour la destruction (à mettre dans le fichier
nw_s0_destruc) :
#include "NW_I0_SPELLS"
#include "x2_inc_spellhook"
void main()
{
if (!X2PreSpellCastCode())
{
// If code within the PreSpellCastHook (i.e. UMD) reports FALSE, do not run this spell
return;
}
//Declare major variables
object oTarget = GetSpellTargetObject();
int nMetaMagic = GetMetaMagicFeat();
int nDamage;
effect eDeath = EffectDeath();
effect eDam;
effect eVis = EffectVisualEffect(234);
if (GetObjectType(oTarget)==OBJECT_TYPE_PLACEABLE||GetObjectType(oTarget)==OBJECT_TYPE_DOOR)
return;
if(!GetIsReactionTypeFriendly(oTarget))
{
//Fire cast spell at event for the specified target
SignalEvent(oTarget, EventSpellCastAt(OBJECT_SELF, SPELL_DESTRUCTION));
//Make SR check
if(!MyResistSpell(OBJECT_SELF, oTarget))
{
//Make a saving throw check
if(!/*Fort Save*/ MySavingThrow(SAVING_THROW_FORT, oTarget, GetSpellSaveDC()))
{
//Apply the VFX impact and effects
ApplyEffectToObject(DURATION_TYPE_INSTANT, eDeath, oTarget);
}
else
{
nDamage = d6(10);
//Enter Metamagic conditions
if (nMetaMagic == METAMAGIC_MAXIMIZE)
{
nDamage = 60;//Damage is at max
}
else if (nMetaMagic == METAMAGIC_EMPOWER)
{
nDamage = nDamage + (nDamage/2); //Damage/Healing is +50%
}
//Set damage effect
eDam = EffectDamage(nDamage, DAMAGE_TYPE_DIVINE);
ApplyEffectToObject(DURATION_TYPE_INSTANT, eDam, oTarget);
}
//Apply VFX impact
ApplyEffectToObject(DURATION_TYPE_INSTANT, eVis, oTarget);
}
}
}
il suffit donc de juste rajouter ces lignes dans chaques sorts ou tu veux qu'il ne soit pas actif sur placable ou porte :
if (GetObjectType(oTarget)==OBJECT_TYPE_PLACEABLE||GetObjectType(oTarget)==OBJECT_TYPE_DOOR)
return;