// Define the function ChangeToStandardFaction
void ChangeToStandardFaction(object oCreatureToChange, int nStandardFaction)
{
    // Set the faction of the given creature to the specified standard faction.
    SetStandardFactionReputation(nStandardFaction, 100, oCreatureToChange);
    ChangeFaction(oCreatureToChange, GetObjectByTag("NW_FACTION_" + IntToString(nStandardFaction)));
}

// Example usage within another script
void main()
{
    // Example: Change the faction of an NPC with the tag "myNPC" to Hostile
    object oNPC = GetObjectByTag("myNPC");
    ChangeToStandardFaction(oNPC, STANDARD_FACTION_HOSTILE);
}
