Well not to throw you off of what you are doing with your script..but it might be easier to just apply the effects directly to the player instead of messing around with item properties on an equipped item.
You could do something like this for the beetles OnDeath:
First in the toolset put an invisible object near the beetle. We'll give it the tag "StinkMaker" for this example. You can put it under the ground too if you want to get it out of the way. It's not going to be usueable. This will be the effect creator so that we can easily remove the effects when you get to the bath part.
OnDeath script:
void main()
{
object oPC = GetLastKiller();
if (GetIsObjectValid(GetMaster(oPC)))
{
oPC = GetMaster(oPC);
}
if (!GetIsPC(oPC)) return;
object oECreator = GetNearestObjectByTag("StinkMaker", OBJECT_SELF, 1);
effect eEffect1 = SupernaturalEffect(EffectAbilityDecrease(ABILITY_CHARISMA,
);
effect eEffect2 = SupernaturalEffect(EffectAreaOfEffect(AOE_PER_INVIS_SPHERE, "test_enter_stink", "****", "****"));
AssignCommand(oECreator, ApplyEffectToObject(DURATION_TYPE_PERMANENT, eEffect1, oPC));
AssignCommand(oECreator, ApplyEffectToObject(DURATION_TYPE_PERMANENT, eEffect2, oPC));
SendMessageToPC(oPC, "I stink!");
GiveXPToCreature(oPC, 1500);
AddJournalQuestEntry("jt_Infestation", 7, oPC, TRUE, FALSE);
SetLocalInt(oPC, "QueenBeetleDead", 1);
}
When you create an AreaOfEffect effect you need to fill in the 3 scripts into it's perameters that will run while this effect is on the creature. The OnEnter, OnHeartbeat, and OnExit. If you don't want to use one of these events for your AreaOfEffect then you would just put in "****". In the script above you can see that I just put in on OnEnter script("test_enter_stink") and left the other ones out
For examples sake this is what I used for "test_enter_stink":
void main()
{
object oResponder = GetEnteringObject();
PlayVoiceChat(VOICE_CHAT_CUSS, oResponder);
}
So every time you get near someone(player or npc enters your erea of effect) they will use their cuss voice chat.
Now when you get to the bath taking part you could use something like this to remove the effects:
void main()
{
object oPC = GetLastUsedBy();
effect eEffect = GetFirstEffect(oPC);
while (GetIsEffectValid(eEffect))
{
if (GetEffectCreator(eEffect) == GetObjectByTag("StinkMaker"))
RemoveEffect(oPC, eEffect);
eEffect = GetNextEffect(oPC);
}
}
You could always add extra stuff on to these like little extra visual effecs and what not but hopefully this will help you out.
Good luck.
Modifié par GhostOfGod, 12 mai 2011 - 06:25 .