Good points. I think what you're trying to do is make an item which targets an enemy and does negative things to them and postive things to you, the item activator. Something along these lines:
#include "x2_inc_switches"
void main()
{
int nEvent =GetUserDefinedItemEventNumber();
if (!nEvent == X2_ITEM_EVENT_ACTIVATE)
return;
object oPC = GetItemActivator();
//target of the positive effects
object oItem = GetItemActivated();
//I always add the above as a matter of style, though it can often be useful
//at some later point. That is if you wanted to destroy the item on some % chance
//or set an int on the item, for instance.
object oTarget = GetItemActivatedTarget();
//target of the ill effects.
if ((GetObjectType(GetItemActivatedTarget())!=OBJECT_TYPE_CREATURE)
)
{
SendMessageToPC(oPC, "You must target a creature for this power to work.");
return;
}
if (WillSave(oPC, 13, SAVING_THROW_WILL))
{
SendMessageToPC(oPC, "[SUCCESS MESSAGE]");
effect eEffect = EffectAttackDecrease(2);
ApplyEffectToObject(DURATION_TYPE_TEMPORARY, eEffect, oTarget, 60.0f);
effect eEffect1 = EffectSavingThrowDecrease(SAVING_THROW_ALL, 2, SAVING_THROW_TYPE_ALL);
ApplyEffectToObject(DURATION_TYPE_TEMPORARY, eEffect1, oTarget, 60.0f);
effect eEffect2 = EffectSkillDecrease(SKILL_ALL_SKILLS, 2);
ApplyEffectToObject(DURATION_TYPE_TEMPORARY, eEffect2, oTarget, 60.0f);
//now all the negative effects applied to the target creature, now apply positive effects
//to the item activator, the Player Character.
effect eEffect3 = EffectAttackIncrease(1);
ApplyEffectToObject(DURATION_TYPE_TEMPORARY, eEffect3, oPC, 60.0f);
effect eEffect4 = EffectSavingThrowIncrease(SAVING_THROW_ALL, 1, SAVING_THROW_TYPE_ALL);
ApplyEffectToObject(DURATION_TYPE_TEMPORARY, eEffect4, oPC, 60.0f);
effect eEffect5 = EffectSkillIncrease(SKILL_ALL_SKILLS, 1);
ApplyEffectToObject(DURATION_TYPE_TEMPORARY, eEffect5, oPC, 60.0f);
}
else
{
SendMessageToPC(oPC, "[FAILURE MESSAGE]");
}
}
//I don't think you want the effects to be supernatural since they are temporary
//here is the description:
// Set the subtype of eEffect to Supernatural and return eEffect.
// (Effects default to magical if the subtype is not set)
// Permanent supernatural effects are not removed by resting!!!!!(therefore they are not temporary-ffbj)
//effect SupernaturalEffect(effect eEffect)
You realize of course that if the itme does not have limited uses the PC will be able to use it multiple times on a single creature. There are ways around that, but just something to keep in mind.
One way would be to reduce the Will Save of the PC activator for a time on each use so enevtually the item would not work too well.
Modifié par ffbj, 26 février 2011 - 12:32 .