Author Topic: GetAnimalCompanion* vs GetFamiliar*  (Read 464 times)

Legacy_meaglyn

  • Hero Member
  • *****
  • Posts: 1451
  • Karma: +0/-0
GetAnimalCompanion* vs GetFamiliar*
« on: October 14, 2015, 06:49:03 pm »


               

Hi Folks,


 


The Lexicon contains this note on all relevant entries"


 


GetAnimalCompanion* and GetFamiliar* functions are reversed - GetAnimalCompanion* returns for Sorcerer and Wizard familiars and GetFamiliar* returns for Ranger and Druid animal companions.


 


I was wondering if anyone knew if the was still the case with 1.69 or not. It's easy enough to test and I'll do that when I get back in front of the toolset but I just thought I'd throw it out there in case anyone knows anything different.


 


Thx



               
               

               
            

Legacy_MrZork

  • Hero Member
  • *****
  • Posts: 1643
  • Karma: +0/-0
GetAnimalCompanion* vs GetFamiliar*
« Reply #1 on: October 14, 2015, 09:19:14 pm »


               

I just wrote a quick script and tested this with the name-getting functions and a couple of druid and wizard toons (and a druid / wizard). The functions work as they should, giving the names for the correct associate.



// TestAssocNames.nss
// print the names of the first PC's animal companion and familiar.

void main()
    {
    object oPC = GetFirstPC();
    string sComp = GetAnimalCompanionName(oPC);
    string sFam = GetFamiliarName(oPC);
    SendMessageToPC(oPC, GetName(oPC) + "'s animal companion's name is <" + sComp + "> and his famliar's name is <" + sFam + ">.");
    }

               
               

               
            

Legacy_meaglyn

  • Hero Member
  • *****
  • Posts: 1451
  • Karma: +0/-0
GetAnimalCompanion* vs GetFamiliar*
« Reply #2 on: October 14, 2015, 09:37:17 pm »


               

Thanks MrZork.  I'll do that too just for grins. But maybe we can get the online Lexicon updated for those. I think I have an account over there.



               
               

               
            

Legacy_MrZork

  • Hero Member
  • *****
  • Posts: 1643
  • Karma: +0/-0
GetAnimalCompanion* vs GetFamiliar*
« Reply #3 on: October 15, 2015, 01:46:01 am »


               

Thanks to Squatting Monk, I also now can add to the Lexicon. :-)


 


I made changes in the Lexicon for the Get*Name functions. I also added a bit to my code, per below. When I get a few minutes to test, I will see about editing the entries for the other functions.



// TestAssocNames.nss
// print the names of the first PC's animal companion and familiar.

void main()
    {
    object oPC = GetFirstPC();
    string sComp = GetAnimalCompanionName(oPC);
    int iCompType =  GetAnimalCompanionCreatureType(oPC);
    string sFam = GetFamiliarName(oPC);
    int iFamType =  GetFamiliarCreatureType(oPC);
    SendMessageToPC(oPC, GetName(oPC) + "'s animal companion's name is <" + sComp + "> (Type: " + IntToString(iCompType) + ") and his famliar's name is <" + sFam + ">(Type: " + IntToString(iCompType) + ") .");
    }

               
               

               
            

Legacy_meaglyn

  • Hero Member
  • *****
  • Posts: 1451
  • Karma: +0/-0
GetAnimalCompanion* vs GetFamiliar*
« Reply #4 on: October 15, 2015, 02:22:19 am »


               

Thanks! I may never have to test my wiki foo over there '<img'>


 


You've got a typo in your output message... you're printing the iCompType variable for both.  That said I'm still seeing bogus results. Using a wizard only I'm getting 0 for iCompType rather than 255 (ANIMAL_COMPANION_CREATURE_TYPE_NONE). So it looks like this can't be relied upon to determine if the creature is capable of having a familiar or companion.  I'll have to change my code to check for the feats.


 


Edit: drat... or maybe just check the appropriate classes and levels since GetHasFeat checks for usable feats.



               
               

               
            

Legacy_Lightfoot8

  • Hero Member
  • *****
  • Posts: 4797
  • Karma: +0/-0
GetAnimalCompanion* vs GetFamiliar*
« Reply #5 on: October 15, 2015, 02:43:14 am »


               

from the 1.65 patch notes:  


 



 


 


 - Fixed the following scripting commands to return the correct information (they were reversed before): GetAnimalCompanionName(), GetAnimalCompanionCreatureType(), GetFamiliarName(), GetFamiliarCreatureType(). If you recompile any scripts that use these scripting commands, you will need to update your scripts to use the new (proper) functionality.

               
               

               
            

Legacy_MrZork

  • Hero Member
  • *****
  • Posts: 1643
  • Karma: +0/-0
GetAnimalCompanion* vs GetFamiliar*
« Reply #6 on: October 15, 2015, 07:13:40 am »


               

Good catches, both of you.


 


I edited several of the Lexicon pages to reflect the current state of things, per this thread.