Hi Guys,
Im trying to get a script to fire when the player is hit by a physical attack, but im noticing that skin items dont seem to be firing their scripts on physical hits.
I have tag based scripting enabled.
My skin tag is called "vamp_hide", and it has the On Hit Cast Spell (unique power self).
so I have a script called "vamp_hide"
the content of the script is as follows...
#include "x2_inc_switches"
void main()
{
WriteTimestampedLogEntry("SKIN TRIGGERED");
int nEvent = GetUserDefinedItemEventNumber(); //Which event triggered this
object oPC; //The player character using the item
object oItem; //The item being used
object oSpellOrigin; //The origin of the spell
object oSpellTarget; //The target of the spell
int iSpell; //The Spell ID number
//Set the return value for the item event script
// * X2_EXECUTE_SCRIPT_CONTINUE - continue calling script after executed script is done
// * X2_EXECUTE_SCRIPT_END - end calling script after executed script is done
int nResult = X2_EXECUTE_SCRIPT_END;
switch (nEvent)
{
case X2_ITEM_EVENT_ONHITCAST:
// * This code runs when the item has the 'OnHitCastSpell: Unique power' property
// * and it hits a target(if it is a weapon) or is being hit (if it is a piece of armor)
// * Note that this event fires for non PC creatures as well.
oItem = GetSpellCastItem(); // The item triggering this spellscript
oPC = OBJECT_SELF; // The player triggering it
oSpellOrigin = OBJECT_SELF ; // Where the spell came from
oSpellTarget = GetSpellTargetObject(); // What the spell is aimed at
SendMessageToPC(oPC,"Item:"+GetName(oItem)+",Player:"+GetName(oPC)+",SpellOrigin:"+GetName(oSpellOrigin)+",SpellTarget:"+GetName(oSpellTarget));
//Your code goes here
break;
}
}
Basically, Im only seeing in my log files a 'Skin Triggered' event which is occuring for the 'on acquired' event of the item. But absolutely nothing is occuring when I get hit.
Am I using the right event here?
or is there something about skins that stop them from firing onhit events?
Modifié par Baaleos, 31 octobre 2010 - 08:42 .