Elemental Absorption
#1
Posté 15 août 2011 - 06:50
Thanks a lot
#2
Posté 15 août 2011 - 07:41
That will stop the damage...but you'll have to do something else to actually heal them instead. For NPCs, it would be a simple matter to add code in the OnDamaged event to use the GetDamageDealtByType function to figure out how much damage needs to be turned into healing, and then apply the heal. But for PCs, who have no OnDamaged event, you're out of luck unless you use something like NWNX to provide this missing PC event generation functionality as an add-on.
Maybe you could use temp immunity to stop the damage and give them a temporary regeneration effect as well to heal them over time. Not precisely what you want since the regen would be unrelated to any specific damage type but then it wouldn't heal them quite so much either so maybe it's an acceptable trade-off.
Modifié par Axe_Murderer, 15 août 2011 - 07:45 .
#3
Posté 17 août 2011 - 02:47
Here are the scripts I used:
1) "toamarutprops"
#include "x2_inc_switches"
void main()
{
int nEvent =GetUserDefinedItemEventNumber();
switch (nEvent)
{
case X2_ITEM_EVENT_ACTIVATE:
ExecuteScript("ac_"+GetTag(GetItemActivated()),
OBJECT_SELF); break;
case X2_ITEM_EVENT_EQUIP:
ExecuteScript("eq_"+GetTag(GetPCItemLastEquipped()),
OBJECT_SELF); break;
case X2_ITEM_EVENT_UNEQUIP:
ExecuteScript("ue_"+GetTag(GetPCItemLastUnequipped())
, OBJECT_SELF); break;
case X2_ITEM_EVENT_ACQUIRE:
ExecuteScript("aq_"+GetTag(GetModuleItemAcquired()),
OBJECT_SELF); break;
case X2_ITEM_EVENT_UNACQUIRE:
ExecuteScript("ua_"+GetTag(GetModuleItemLost()),
OBJECT_SELF); break;
case X2_ITEM_EVENT_SPELLCAST_AT:
ExecuteScript("sp_"+GetTag(GetModuleItemLost()),
OBJECT_SELF); break;
case X2_ITEM_EVENT_ONHITCAST:
ExecuteScript("on_"+GetTag(GetSpellCastItem()),
OBJECT_SELF); break;
}
}
....which links the item to this script:
2) "on_toamarutprops"
void main()
{
object oMarut = GetObjectByTag("ToA_Marut");
//object oTarget = oMarut;
int nFireDamage = GetDamageDealtByType(DAMAGE_TYPE_FIRE);
int nColdDamage = GetDamageDealtByType(DAMAGE_TYPE_COLD);
int nElectricDamage = GetDamageDealtByType(DAMAGE_TYPE_ELECTRICAL);
int nAcidDamage = GetDamageDealtByType(DAMAGE_TYPE_ACID);
string sFireDamage = IntToString(nFireDamage);
string sColdDamage = IntToString(nColdDamage);
string sElectricDamage = IntToString(nElectricDamage);
string sAcidDamage = IntToString(nAcidDamage);
effect eEffectFire = EffectHeal(2*nFireDamage);
effect eEffectCold = EffectHeal(2*nColdDamage);
effect eEffectElectric = EffectHeal(2*nElectricDamage);
effect eEffectAcid = EffectHeal(2*nAcidDamage);
eEffectFire = SupernaturalEffect(eEffectFire);
eEffectCold = SupernaturalEffect(eEffectCold);
eEffectElectric = SupernaturalEffect(eEffectElectric);
eEffectAcid = SupernaturalEffect(eEffectAcid);
if (GetDamageDealtByType(DAMAGE_TYPE_FIRE) > 0)
{
DelayCommand(0.01, ApplyEffectToObject(DURATION_TYPE_INSTANT, eEffectFire, oMarut));
DelayCommand(0.01, ApplyEffectAtLocation(DURATION_TYPE_INSTANT, EffectVisualEffect(VFX_IMP_HEALING_S), GetLocation(oMarut)));
FloatingTextStringOnCreature("<c € >+"+sFireDamage+"</c>", oMarut, FALSE);
}
if (GetDamageDealtByType(DAMAGE_TYPE_COLD) > 0)
{
DelayCommand(0.01, ApplyEffectToObject(DURATION_TYPE_INSTANT, eEffectCold, oMarut));
DelayCommand(0.01, ApplyEffectAtLocation(DURATION_TYPE_INSTANT, EffectVisualEffect(VFX_IMP_HEALING_S), GetLocation(oMarut)));
FloatingTextStringOnCreature("<c € >+"+sColdDamage+"</c>", oMarut, FALSE);
}
if (GetDamageDealtByType(DAMAGE_TYPE_ELECTRICAL) > 0)
{
DelayCommand(0.01, ApplyEffectToObject(DURATION_TYPE_INSTANT, eEffectElectric, oMarut));
DelayCommand(0.01, ApplyEffectAtLocation(DURATION_TYPE_INSTANT, EffectVisualEffect(VFX_IMP_HEALING_S), GetLocation(oMarut)));
FloatingTextStringOnCreature("<c € >+"+sElectricDamage+"</c>", oMarut, FALSE);
}
if (GetDamageDealtByType(DAMAGE_TYPE_ACID) > 0)
{
DelayCommand(0.01, ApplyEffectToObject(DURATION_TYPE_INSTANT, eEffectAcid, oMarut));
DelayCommand(0.01, ApplyEffectAtLocation(DURATION_TYPE_INSTANT, EffectVisualEffect(VFX_IMP_HEALING_S), GetLocation(oMarut)));
FloatingTextStringOnCreature("<c € >+"+sAcidDamage+"</c>", oMarut, FALSE);
}
}
Thanks again for the help
#4
Posté 17 août 2011 - 08:46
#5
Posté 17 août 2011 - 07:14
#6
Posté 17 août 2011 - 07:49
Axe_Murderer wrote...
OnHitCast doesn't fire for skins. Only equipment.
It works for skins; I remember using it there to wear down weapons and armor. Onhitcast is limited to hits though. So spells would never fire this property.
#7
Posté 17 août 2011 - 11:28
For 2 and 3, make sure that oMarut is using the correct case sensitive tag. If oMarut is a player character then there is no tag, so you would have to use a different identifier. If oMarut is the subject of the blow you can save time using OBJECT_SELF.DITB123 wrote...
Ok, thanks for the help with that idea Axe_Murderer. Since it would not have worked as I had hoped, I am going to instead put it on a creature's skin as an 'on hit cast uniquie power spell' property that 'absorbs' the 4 elemental damage types (heals for double whatever they caused), but my script won't fire like i had hoped. First, the creature was hit with spells and did not get healed at all, not sure what I did wrong there. Next, The physical damage i did to him with a sword that had elemental damage on it did produce the healing effect but the healed amount did not appear as a speak string, (which links to my third problem). Lastly, the green floating text which was supposed to show how much the creature healed overall did not show above his head. If you would, it would be great if anyone could look over the script and see what I messed up on.
#8
Posté 18 août 2011 - 09:31





Retour en haut






