Aller au contenu

Photo

Testing for Alchemist Fire on Weapon


  • Veuillez vous connecter pour répondre
4 réponses à ce sujet

#1
BelowTheBelt

BelowTheBelt
  • Members
  • 394 messages

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!

 



#2
Asymmetric

Asymmetric
  • Members
  • 166 messages

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.



#3
MrZork

MrZork
  • Members
  • 940 messages

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

GetHasSpellEffect(464, oWeapon)


#4
BelowTheBelt

BelowTheBelt
  • Members
  • 394 messages

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.



#5
Asymmetric

Asymmetric
  • Members
  • 166 messages

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.