OnHit apply effect - help required
#1
Posté 29 mars 2011 - 07:09
first - a spell/feat that for a certain period of time would apply a custom set of effects to every object hit by caster's physical attack
second - a spell/feat that would do this (apply the mentioned set of effects) to every object that hits caster with physical attack
and I have to admitt I am at a loss.
I was hoping to find some guidelines in NWN acid sheath spell script but it appears to be a simple DamageShield effect.
#2
Posté 29 mars 2011 - 07:47
NPCs are easy, but for a player you need to do some back flips.
On hit has to be done via an item property. ( Hideous blow for example ) which requires some spells.2da changes, and adding this as an item property as well i think.
#3
Posté 29 mars 2011 - 07:54
itemproperty ipOnHit = ItemPropertyOnHitCastSpellIP_CONST_ONHIT_CASTSPELL_ONHIT_UNIQUEPOWER, nSomeLevel);
AddItemProperty(DURATION_TYPE_TEMPORARY, ipOnHit, oItem, fDuration);
However, to define this Unique Power, you'd need to use tag-based scripting. This means that the tag of the object in question needs to be something you have control over. I guess you could change this on the fly with the SetTag function, but that doesn't seem like a particularly elegant solution.
If you're using a contagious effect like it seems you're planning, this could get complicated fast. However, you should be a little wary of any situation that means you run more and more scripts as time goes on--if it spreads from the caster to their enemy, and from that enemy back to the caster's friends, and from them to the rest of the enemies like some epidemic...the main symptom is going to be smoke from your computer.
Edit: As Pain mentions, if you can use an itemproperty:cast-spell that isn't a "unique power", you don't have to worry about tags.
Modifié par MasterChanger, 29 mars 2011 - 07:56 .
#4
Posté 30 mars 2011 - 03:33
As I understand it, it would be enough to create a script adding the desired effects to the object, save it as a spell, edit spells.2da and then simply use the spellid from spells.2da as nSpell.// Creates an item property that (when applied to a weapon item) causes a spell to be cast
// when a successful strike is made, or (when applied to armor) is struck by an opponent.
// - nSpell uses the IP_CONST_ONHIT_CASTSPELL_* constants
itemproperty ItemPropertyOnHitCastSpell(int nSpell, int nLevel);
The main script should temporarily add this property to caster's items (weapon or armour) via AddItemProperty().
Any idea how to make it affect every physical attack hit, regardless of weapon used (besides the obvious application of the effect to every weapon in inventory)?
Actually, I plan to make a certain NPC 'contagious' for a certain period of time in a way that it would apply the set of effects to every object it hits and to every object it is hit by, I do not plan this 'disease' to spread any further.If you're using a contagious effect like it seems you're planning, this
could get complicated fast. However, you should be a little wary of any
situation that means you run more and more scripts as time goes on--if
it spreads from the caster to their enemy, and from that enemy back to
the caster's friends, and from them to the rest of the enemies like some
epidemic...the main symptom is going to be smoke from your computer.
Modifié par Light-In-The-Darkness, 30 mars 2011 - 04:24 .
#5
Posté 31 mars 2011 - 04:00
Light-In-The-Darkness wrote...
According to NWScript documentation:As I understand it, it would be enough to create a script adding the desired effects to the object, save it as a spell, edit spells.2da and then simply use the spellid from spells.2da as nSpell.// Creates an item property that (when applied to a weapon item) causes a spell to be cast
// when a successful strike is made, or (when applied to armor) is struck by an opponent.
// - nSpell uses the IP_CONST_ONHIT_CASTSPELL_* constants
itemproperty ItemPropertyOnHitCastSpell(int nSpell, int nLevel);
The main script should temporarily add this property to caster's items (weapon or armour) via AddItemProperty().
ItemPropertyOnHitCastSpell doesn't use the the spellid (row # from spells.2da) as int nSpell, it uses the ONHIT_CASTSPELL_* constants as described above. The difference is that these actually refer to a row of iprp_spells.2da. These entries are linked to a spellid, but also specify other info like CasterLvl.
So you'd need:
-an entry in spells.2da
-an entry in iprp_spells.2da
-the impact script (the spell to be cast OnHit)
-some way to create this ItemProperty and place it on the items in question.
#6
Posté 31 mars 2011 - 06:29





Retour en haut






