Author Topic: Testing for Alchemist Fire on Weapon  (Read 324 times)

Legacy_BelowTheBelt

  • Hero Member
  • *****
  • Posts: 699
  • Karma: +0/-0
Testing for Alchemist Fire on Weapon
« on: September 24, 2015, 07:27:30 pm »


               

Hey all,


 


Is there a simple check to see if a weapon has Alchemist Fire on it?  I checked GetDamageDealtByType to see if fire was returned, but don't believe it comes back with fire.


 


From looking at the related scripts...


x2_s3_flamingd


x2_s0_flmeweap


 


It seems that the vfx ITEM_VISUAL_FIRE is applied, so possibly check for that (though I believe that GetHasEffect will only return that a vfx is on, rather than what type of vfx)?


 


I suppose I could put on a local int to indicate that it's active, but would rather hear if there are other options out there.


 


Thanks!


 



               
               

               
            

Legacy_Asymmetric

  • Sr. Member
  • ****
  • Posts: 289
  • Karma: +0/-0
Testing for Alchemist Fire on Weapon
« Reply #1 on: September 27, 2015, 01:11:19 am »


               

GetDamageDealtByType() and GetHasEffect() are not what you looking for.


  • GetDamageDealtByType() can be used in creature's OnDamaged event to get the amount of damage dealt by the specified type.

  • GetHasEffect() doesn't work for you either, because what you have is not an effect.

What you need to check for are item properties.


 


If I remember correctly alchemist fire is 1d4 Fire Damage + VisualEffect. The ItemPropertyDamageBonus() works this way: 1d6 and above have a built-in VFX. For 1d4 and below, if you want a visual effect you have to apply an ItemPropertyVisualEffect(ITEM_VISUAL_FIRE) yourself. That's what the spell scripts do. So what you want to know is whether ItemPropertyDamageBonus() or ItemPropertyVisualEffect() are present on the item. ItemPropertyDamageBonus() should be enough though.


 


The easiest solution is to use:



int IPGetItemHasProperty(
    object oItem,
    itemproperty ipCompareTo,
    int nDurationType,
    int bIgnoreSubType = FALSE
);

You'll need to include "x2_inc_itemprop". It will search for the item property ipCompareTo (which you need to create or get from another item) on oItem.



#include "x2_inc_itemprop"

int checkItem(object oItem)
{  
    // I'm not sure if this is correct.
    // Check the alchemist fire scripts for the correct property
    ipCompareTo = ItemPropertyDamageBonus(IP_CONST_DAMAGETYPE_FIRE,
                                          IP_CONST_DAMAGEBONUS_1d4);
    return IPGetItemHasProperty(oItem,
                                ipCompareTo,
                                DURATION_TYPE_TEMPORARY,
                                FALSE);    
}

This will tell you if the item has a temporary item property with 1d4 fire damage. This should be alchemists fire. The spells Darkfire and Flameweapon do 1d6, so no worries there. If a custom weapon deals 1d4 the duration is permanent, so that wouldn't count either. But I don't know your module, there could be other source of temporary 1d4 fire damage.



               
               

               
            

Legacy_MrZork

  • Hero Member
  • *****
  • Posts: 1643
  • Karma: +0/-0
Testing for Alchemist Fire on Weapon
« Reply #2 on: September 27, 2015, 06:04:46 am »


               

Alchemist's Fire is in spells.2da, so the simplest check may be



GetHasSpellEffect(464, oWeapon)


               
               

               
            

Legacy_BelowTheBelt

  • Hero Member
  • *****
  • Posts: 699
  • Karma: +0/-0
Testing for Alchemist Fire on Weapon
« Reply #3 on: September 28, 2015, 01:20:39 am »


               

Thanks, I'll try these out.


 


The GetDamageDealtByType function should be correct for my use, though, as I'm using the check in a creature's OnDamaged event.  


 


Strange that a blade with Alchemist Fire doesn't return as having dealt any fire damage, though.



               
               

               
            

Legacy_Asymmetric

  • Sr. Member
  • ****
  • Posts: 289
  • Karma: +0/-0
Testing for Alchemist Fire on Weapon
« Reply #4 on: September 29, 2015, 07:32:15 pm »


               

Hmm, it should work. Only thing I can think of is, do you check for an an amount, e.g. GetDamageDealtByType(DAMAGE_TYPE_FIRE) > 0 ? It returns -1, if no damage of that type was dealt. GetDamageDealtByType(DAMAGE_TYPE_FIRE) is always true.