@kevL_s,
OK, after doing some careful testing, I think any “charms” require some careful application with “friendly” targets, mainly because any successful charming prevents any conversation from starting properly.; thereby making any effects pointless as they currently work.
However, I do believe altering the 2da to change the target type (via location), then the appropriate spells may well be able to be altered to apply a “benefit”. However, as the N2_GetNPCEasyMark function checks for the specific effect being present, then I would remove this and simply use a variable added at spell cast (and dropping out before applying the effect itself) so that the spell applies a potential benefit (or may make the store owner less friendly if the spell was noticed) that is used directly at the time of store opening (this script).
Unless I edit this post, I think that’s what I will do.
Thanks, Lance.
EDIT: I am now working on any charm type spells (as recognised by the normal N2_GetNPCEasyMark function, except excluding Dominate Animal) so that they will now apply a one minute “influence rating”, which will give a bonus of ten all the while it is in place. i.e. The bonus will not vary, neither will its duration. It will be the basic bonus of the store owner fails the save, and will last one minute for all who then use the merchant. Currently, the “influence” only affects those friendly who are of the merchants faction. (Script updated above to reflect new variable bonus for successfully charmed merchants.)
EXAMPLE CODE ADDED TO SPELL
// NEAREST GROUND TARGET
if(oTarget == OBJECT_INVALID)
{
location lLoc = GetSpellTargetLocation();
oTarget = GetNearestCreatureToLocation(CREATURE_TYPE_IS_ALIVE, CREATURE_ALIVE_TRUE, lLoc);
}
//////////////////////////////////////////////////////////////////////////////////////////////
// ALLOW A MERCHANT INFLUENCE (BUT DO NOT APPLY THE EFFECT OR WILL PREVENT CONV)
// CHARMED STORE OWNERS ARE AFFECTED FOR A MINUTE ONLY
//////////////////////////////////////////////////////////////////////////////////////////////
int iALLOW = 0;
object oMerchant = GetObjectByTag("SETFACTION_MERCHANT");
if(GetFactionEqual(oMerchant, oTarget)){iALLOW = 1;}
if (spellsIsTarget(oTarget, SPELL_TARGET_SELECTIVEHOSTILE, OBJECT_SELF) || iALLOW)
{
Later in the same …
//Make a Will save to negate
if (!MySavingThrow(SAVING_THROW_WILL, oTarget, GetSpellSaveDC(), SAVING_THROW_TYPE_MIND_SPELLS))
{
if(iALLOW)
{
SetLocalInt(oTarget, "INFLUENCED", 10);
}
else
{
eCharm = FIXEDGetScaledEffect( EffectCharmed(), oTarget ); // 11/09/06 - BDF(OEI): this line was missing, causing PCs to get charmed
//Apply the linked effects and the VFX impact
DelayCommand(fDelay, ApplyEffectToObject(DURATION_TYPE_TEMPORARY, eCharm, oTarget, RoundsToSeconds(nDuration)));
DelayCommand(fDelay, ApplyEffectToObject(DURATION_TYPE_INSTANT, eVis, oTarget));
}
}
The “INFLUENCED” var decreases by one each round within the merchants heartbeat.
The spells.2da references have had target bitwise to include ground target where required. E.g. Charm person from 0x2A to 0x2E.