Author Topic: Familiar & Companion Appearance  (Read 346 times)

Legacy_4Pop

  • Newbie
  • *
  • Posts: 28
  • Karma: +0/-0
Familiar & Companion Appearance
« on: December 02, 2014, 11:58:10 pm »


               

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!



               
               

               
            

Legacy_Thayan

  • Sr. Member
  • ****
  • Posts: 435
  • Karma: +0/-0
Familiar & Companion Appearance
« Reply #1 on: December 03, 2014, 02:56:45 pm »


               

It looks like you need to have a custom creature setup somewhere else in the module who has the portrait, soundset, and appearance you want to give the familiar. Then, it needs to have the tag of CustomSummonX, where X is apparently a summon setting set by the PC master through some other method/scripts.


 


If you verify that the CustomSummon creature exists, and it still doesn't work, then you'll probably need to look at the script(s) that set the sMaster + "SUMMON" campaign variable.