// 'anico'
/*
console script.
Grants the AnimalCompanion feat.
NOTE: This requires a modified summoning script ( nw_s2_animalcom ) to work.
- iType : the type of companion as referenced by row in Hen_Companion.2da
- sLabel : a first name for your animal companion
Example ...
`
debugmode 1
rs anico(0,"frank")
debugmode 0
`
that's a badger by the name of frank
To revert to a standard Animal Companion run this script like so:
rs anico(-1,"")
*/
//
void main(int iType, string sLabel)
{
object oPc = GetControlledCharacter(OBJECT_SELF);
if (iType == -1) // clear the anico variables
{
if (GetLocalInt(oPc, "AniCoType"))
{
SendMessageToPC(oPc, "<c=green>NOTICE :</c> Your Animal Companion has been cleared.");
DeleteLocalInt(oPc, "AniCoType");
DeleteLocalString(oPc, "AniCoLabel");
}
else
SendMessageToPC(oPc, "<c=green>NOTICE :</c> Your Animal Companion was not set so there's no point in clearing it.");
}
else
{
SendMessageToPC(oPc, "<c=blue>WARNING :</c> What you have done will overrule any"
+ " Animal Companion that you can summon as a Druid or Ranger or Cleric."
+ " To revert that behavior rerun this script with parameters -1 and a"
+ " blank string. Your PC will however keep the Animal Companion feat"
+ " regardless of whether you had it before - but it won't work unless"
+ " your PC has a standard Animal Companion or you run this script to"
+ " reset your companion.");
if (!GetHasFeat(FEAT_ANIMAL_COMPANION, oPc))
FeatAdd(oPc, FEAT_ANIMAL_COMPANION, FALSE, TRUE);
iType += 1; // have to increment so that the spellscript doesn't think "0" (unset) is a badger
SetLocalInt(oPc, "AniCoType", iType);
SetLocalString(oPc, "AniCoLabel", sLabel);
}
}
//::///////////////////////////////////////////////
//:: Summon Animal Companion
//:: 'nw_s2_animalcom'
//:: Copyright (c) 2001 Bioware Corp.
//:://////////////////////////////////////////////
/*
This spellability summons an Animal Companion.
*/
// kevL 2019 apr 24 - adapted for use by any class; requires variables that are
// set by console script 'anico'
int GetAnimalTier(object oPC);
//
void main()
{
object oCaster = OBJECT_SELF;
int iType = GetLocalInt(oCaster, "AniCoType");
if (iType)
{
iType -= 1; // incremented when set; decrement to get the true reference
string sResref = Get2DAString("hen_companion", "BASERESREF_PREFIX", iType);
sResref += IntToString(GetAnimalTier(oCaster));
SummonAnimalCompanion(oCaster, sResref);
object oAnico = GetAssociate(ASSOCIATE_TYPE_ANIMALCOMPANION, oCaster);
if (GetIsObjectValid(oAnico))
{
string sLabel = GetLocalString(oCaster, "AniCoLabel");
SetFirstName(oAnico, sLabel);
}
else
SendMessageToPC(oCaster, "<c=red>ERROR :</c> ( nw_s2_animalcom ) Animal Companion is invalid.");
}
else
SummonAnimalCompanion(); // standard summon
}
//
int GetAnimalTier(object oPC)
{
return GetTotalLevels(oPC, FALSE) / 3 + 1;
}