Calling all the ladies and gentlemen to impart their wisdom on an issue I'm having trouble with, but which seems so easy that it's not even funny, even to my eyes. It makes me feel stupid, not to say that couldn't be the case either way. I'm fully aware that I'm probably starting from way too difficult scripts, but I've been trying to tackle this one for so long and I am too stubborn to give up now.
Anyways, onto the topic:
---------------------------------------
// ga_faction_join
/*
This script makes sTarget join a new faction.
sTarget - The target who's faction will change (see Target's note).
sTargetFaction - Either one of the 4 standard factions $COMMONER, $DEFENDER, $HOSTILE, $MERCHANT or
a target who's faction is to be joined (must be a creature)
*/
// ChazM 2/25/05
// DBR 11/09/06 - TargetFactionMember was using wrong target string
#include "ginc_param_const"
#include "nw_i0_generic"
void main (string WGUARD, string $HOSTILE)
{
object oTarget = GetTarget(WGUARD);
int iFaction = GetStandardFaction($HOSTILE);
if (iFaction != -1) {
ChangeToStandardFaction(oTarget, iFaction);
PrintString ("Changed to standard faction " + $HOSTILE);
}
else {
object oTargetFactionMember = GetTarget($HOSTILE);
ChangeFaction(oTarget, oTargetFactionMember);
PrintString ("Changed to same faction as " + GetName(oTarget));
}
AssignCommand(oTarget, DetermineCombatRound());
}
---------------------------------------
(sTarget is changed to WGUARD and sTargetFaction is changed to $HOSTILE from the template script)
I am trying here to change the faction of a creature, whose tag is WGUARD, from $COMMONER to $HOSTILE and I have no idea why it doesn't work! I've attached the script to a chest in the OnInventoryDisturbed thingy.
All sorts of help and insights into the matter are very appreciated!
Tanks,
Anna