Hey all. I'm having trouble with this script. It is supposed to go as follows;
-When Companion/Familiar enters area, a check is made to see if a variable on oPC is true
-If so, and if the Companion/Familiar's tag matches the check then change its appearance
However, this isn't working. I've verified that the string is appropriate for the check. This is the on enter script.
#include "inc_gen"
#include "nwnx_funcs"
void main()
{
object oPC = GetEnteringObject();
string sPC = GetName(oPC);
//Experimental code for choosing your summon appearance.
//2: Familiar Only 3: Companion Only 1: both
int nCheck = GetCampaignInt("CUSTOMSUMMONS", sPC);
object oMaster = GetMaster(oPC);
object oSummon = oPC;
string sMaster = sPC;
string sTag = GetTag(oSummon);
string sTagCheck = GetStringLeft(sTag, 5);
//If animal companion
if(GetIsPC(oMaster) && nCheck == 3 && sTagCheck == "NW_AC")
{
DelayCommand(2.0,ModifySummonAppearance(oSummon, sMaster));
}
//If PC has made selection of familiar
if(GetIsPC(oMaster) && nCheck == 2 && sTagCheck == "NW_FA" )
{
DelayCommand(2.0,ModifySummonAppearance(oSummon, sMaster));
}
//If PC has made selection of both
if(GetIsPC(oMaster) && nCheck == 1 )
{
ModifySummonAppearance(oSummon, sMaster);
}
}
This is inc_gen
#include "nwnx_funcs"
//Changes the appearance of oSummon based on selection made by the PC.
void ModifySummonAppearance(object oSummon, string sMaster);
void ModifySummonAppearance(object oSummon, string sMaster)
{
int nAppearanceCheck = GetCampaignInt("SETTINGS", sMaster + "SUMMON");
object oTemplate = GetObjectByTag("CustomSummon" + IntToString(nAppearanceCheck));
int nVoiceSet = NWNXFuncs_GetSoundSetID(oTemplate);
int nPortrait = GetPortraitId(oTemplate);
int nAppearance = GetAppearanceType(oTemplate);
NWNXFuncs_SetSoundSetID(oSummon, nVoiceSet);
SetPortraitId(oSummon, nPortrait);
SetCreatureAppearanceType(oSummon, nAppearance);
}
I'm sorry for the mess!