Aller au contenu

Photo

GetAnimalCompanion* vs GetFamiliar*


  • Veuillez vous connecter pour répondre
6 réponses à ce sujet

#1
meaglyn

meaglyn
  • Members
  • 809 messages

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



#2
MrZork

MrZork
  • Members
  • 940 messages

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 + ">.");
    }

  • meaglyn aime ceci

#3
meaglyn

meaglyn
  • Members
  • 809 messages

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.



#4
MrZork

MrZork
  • Members
  • 940 messages

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) + ") .");
    }


#5
meaglyn

meaglyn
  • Members
  • 809 messages

Thanks! I may never have to test my wiki foo over there :)

 

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.


  • MrZork aime ceci

#6
Lightfoot8

Lightfoot8
  • Members
  • 2 535 messages

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.

  • MrZork aime ceci

#7
MrZork

MrZork
  • Members
  • 940 messages

Good catches, both of you.

 

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


  • Lightfoot8 aime ceci