Aller au contenu

Photo

Applying poison to a weapon?


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

#1
rjshae

rjshae
  • Members
  • 4 478 messages
I had this crazy idea for a bottled potion that can be applied to a weapon edge and they function for a certain number of charges. The various poison types are available with the EffectPoison function, but unfortunately the "Apply Poison" spell doesn't appear to do anything. I can probably use the Unique Power spell to apply the effect to a weapon, but that only gives a duration-based option. I don't see a handy item property function that could do this.

Anybody have a good suggestion? :happy:

Thank you.

#2
Olblach

Olblach
  • Members
  • 175 messages
Look at the ItemPropertyOnHitProps() function (or the OnHit property in item design).

#3
rjshae

rjshae
  • Members
  • 4 478 messages
Yes that looks like it should work. Thank you. A drawback is that I can only make it duration based rather than charge based. Hopefully the add item property function will work properly with an equipped weapon.

#4
Kaldor Silverwand

Kaldor Silverwand
  • Members
  • 1 585 messages
I had a desire to make some similar potions a couple months back. I've scripted them, but haven't tested them. The Alchemist's Fire script x0_s3_alchem can be used as a template. Here is my Ghoststrike oil script based on it:

// i_bb_it_ghoststrike_oil_ac
// by Brendan Bellina "Kaldor Silverwand"
// Sept, 2010

// Based in part of the Alchemists Fire script x0_s3_alchem

//::///////////////////////////////////////////////
//:: Ghoststrike Oil
//:: bb_it_ghoststrike_oil
//:://////////////////////////////////////////////
/*
Can be applied to a melee weapon to apply
a temporary divine damage effect.
*/
//:://////////////////////////////////////////////

#include "X2_I0_SPELLS"
#include "x2_inc_itemprop"
#include "x2_inc_spellhook"

void AddDivineEffectToWeapon(object oTarget, float fDuration)
{
//forget the fancy on-hit spell and just go with elemental damage item property.
int nBonus = IP_CONST_DAMAGEBONUS_1d4;
itemproperty ipDivine = ItemPropertyDamageBonus(IP_CONST_DAMAGETYPE_DIVINE, nBonus);

// If the spell is cast again, any previous itemproperties matching are removed.
IPSafeAddItemProperty(oTarget, ipDivine, fDuration, X2_IP_ADDPROP_POLICY_REPLACE_EXISTING);
IPSafeAddItemProperty(oTarget, ItemPropertyVisualEffect(ITEM_VISUAL_HOLY), fDuration,X2_IP_ADDPROP_POLICY_REPLACE_EXISTING,FALSE,TRUE);
return;
}

void main()
{
object oPC = GetItemActivator();
object oItem = GetItemActivated();
object oTarget = GetItemActivatedTarget();
location lTarget = GetItemActivatedTargetLocation();

effect eVis = EffectVisualEffect(VFX_COM_HIT_DIVINE);
effect eDur = EffectVisualEffect(VFX_DUR_CESSATE_POSITIVE);
object oMyWeapon;
int nTarget = GetObjectType(oTarget);
int nDuration = 4;
int nCasterLvl = 1;

if(nTarget == OBJECT_TYPE_ITEM)
{
oMyWeapon = oTarget;
int nItem = IPGetIsMeleeWeapon(oMyWeapon);
if(nItem == TRUE)
{
if(GetIsObjectValid(oMyWeapon))
{
//SignalEvent(OBJECT_SELF, EventSpellCastAt(OBJECT_SELF, GetSpellId(), FALSE));

if (nDuration > 0)
{
// haaaack: store caster level on item for the on hit spell to work properly
// SetLocalInt(oMyWeapon,"X2_SPELL_CLEVEL_FLAMING_WEAPON",nCasterLvl);
ApplyEffectToObject(DURATION_TYPE_INSTANT, eVis, GetItemPossessor(oMyWeapon));
ApplyEffectToObject(DURATION_TYPE_TEMPORARY, eDur, GetItemPossessor(oMyWeapon), RoundsToSeconds(nDuration));
AddDivineEffectToWeapon(oMyWeapon, RoundsToSeconds(nDuration));
}
return;
}
}
else
{
FloatingTextStrRefOnCreature(100944,OBJECT_SELF);
}
}
}

Modifié par Kaldor Silverwand, 06 novembre 2010 - 01:49 .