Jaysyn904 66a0a3e043 Initial commit
Initial commit.
2024-08-03 14:13:18 -04:00

155 lines
7.2 KiB
Plaintext

//::///////////////////////////////////////////////
//:: Associate: On Spawn In
//:: NW_CH_AC9
//:: Copyright (c) 2001 Bioware Corp.
//:://////////////////////////////////////////////
//
// Modified by Proleric 14-May-2008
//
// Added all optional horse variables (commented out) so that the default can be changed
// globally for horses, without affecting other associates.
//
/*
2007-12-31: Deva Winblood
Modified to look for X3_HORSE_OWNER_TAG and if
it is defined look for an NPC with that tag
nearby or in the module (checks near first).
It will make that NPC this horse's master.
*/
//:://////////////////////////////////////////////
//:: Created By: Preston Watamaniuk
//:: Created On: Nov 19, 2001
//:://////////////////////////////////////////////
#include "X0_INC_HENAI"
#include "x3_inc_horse"
void main()
{
string sTag;
object oNPC;
SetAssociateListenPatterns();//Sets up the special henchmen listening patterns
bkSetListeningPatterns(); // Goes through and sets up which shouts the NPC will listen to.
SetAssociateState(NW_ASC_POWER_CASTING);
SetAssociateState(NW_ASC_HEAL_AT_50);
SetAssociateState(NW_ASC_RETRY_OPEN_LOCKS);
SetAssociateState(NW_ASC_DISARM_TRAPS);
SetAssociateState(NW_ASC_MODE_DEFEND_MASTER, FALSE);
SetAssociateState(NW_ASC_USE_RANGED_WEAPON, FALSE); //User ranged weapons by default if true.
SetAssociateState(NW_ASC_DISTANCE_2_METERS);
// April 2002: Summoned monsters, associates and familiars need to stay
// further back due to their size.
int nType = GetAssociateType(OBJECT_SELF);
switch (nType)
{
case ASSOCIATE_TYPE_ANIMALCOMPANION:
case ASSOCIATE_TYPE_DOMINATED:
case ASSOCIATE_TYPE_FAMILIAR:
case ASSOCIATE_TYPE_SUMMONED:
SetAssociateState(NW_ASC_DISTANCE_4_METERS);
break;
}
sTag=GetLocalString(OBJECT_SELF,"X3_HORSE_OWNER_TAG");
if (GetStringLength(sTag)>0)
{ // look for master
oNPC=GetNearestObjectByTag(sTag);
if (GetIsObjectValid(oNPC)&&GetObjectType(oNPC)==OBJECT_TYPE_CREATURE)
{ // master found
AddHenchman(oNPC);
} // master found
else
{ // look in module
oNPC=GetObjectByTag(sTag);
if (GetIsObjectValid(oNPC)&&GetObjectType(oNPC)==OBJECT_TYPE_CREATURE)
{ // master found
AddHenchman(oNPC);
} // master found
else
{ // master does not exist - remove X3_HORSE_OWNER_TAG
DeleteLocalString(OBJECT_SELF,"X3_HORSE_OWNER_TAG");
} // master does not exist - remove X3_HORSE_OWNER_TAG
} // look in module
} // look for master
/* if (GetAssociate(ASSOCIATE_TYPE_ANIMALCOMPANION, GetMaster()) == OBJECT_SELF ||
GetAssociate(ASSOCIATE_TYPE_DOMINATED, GetMaster()) == OBJECT_SELF ||
GetAssociate(ASSOCIATE_TYPE_FAMILIAR, GetMaster()) == OBJECT_SELF ||
GetAssociate(ASSOCIATE_TYPE_SUMMONED, GetMaster()) == OBJECT_SELF)
{
SetAssociateState(NW_ASC_DISTANCE_4_METERS);
}
*/
// * Feb 2003: Set official campaign henchmen to have no inventory
SetLocalInt(OBJECT_SELF, "X0_L_NOTALLOWEDTOHAVEINVENTORY", 10) ;
//SetAssociateState(NW_ASC_MODE_DEFEND_MASTER);
SetAssociateStartLocation();
// SPECIAL CONVERSATION SETTTINGS
//SetSpawnInCondition(NW_FLAG_SPECIAL_CONVERSATION);
//SetSpawnInCondition(NW_FLAG_SPECIAL_COMBAT_CONVERSATION);
// This causes the creature to say a special greeting in their conversation file
// upon Perceiving the player. Attach the [NW_D2_GenCheck.nss] script to the desired
// greeting in order to designate it. As the creature is actually saying this to
// himself, don't attach any player responses to the greeting.
// CUSTOM CODE FOR HORSES
//
if (HorseGetIsAMount(OBJECT_SELF))
{
// Mount Control
// SetLocalString(OBJECT_SELF, "X3_HORSE_OWNER_TAG", "TagOfNPCOwner"); // Horse becomes henchman of this NPC
// SetLocalInt(OBJECT_SELF, "X3_HORSE_NOT_RIDEABLE_OWNER", TRUE); // Unavailable for riding
// SetLocalInt(OBJECT_SELF, "bX3_IS_MOUNT", TRUE); // Mountable (default for standard horses)
// SetLocalInt(OBJECT_SELF, "X3_NO_MOUNT_ANIMATE", TRUE); // Disable animation during mounting
// SetLocalInt(OBJECT_SELF, "X3_HORSE_RESTRICT_race", TRUE); // Specified race can't ride
//Saddlebags
// SetLocalInt(OBJECT_SELF, "bX3_HAS_SADDLEBAGS", TRUE); // Can use horse's inventory
// Script Hooks
// SetLocalString(OBJECT_SELF, "X3_HORSE_PREMOUNT_SCRIPT", "My Script");
// SetLocalString(OBJECT_SELF, "X3_HORSE_POSTMOUNT_SCRIPT", "My Script");
// SetLocalString(OBJECT_SELF, "X3_HORSE_PREDISMOUNT_SCRIPT", "My Script");
// SetLocalString(OBJECT_SELF, "X3_HORSE_POSTDISMOUNT_SCRIPT", "My Script");
// Script Over-Rides
// SetLocalString(OBJECT_SELF, "X3_HORSE_SCRIPT_MOUNT", "My Script");
// SetLocalString(OBJECT_SELF, "X3_HORSE_SCRIPT_DISMOUNT", "My Script");
// SetLocalString(OBJECT_SELF, "X3_HORSE_SCRIPT_ASSIGN", "My Script");
// Custom Mounts
// SetLocalInt(OBJECT_SELF, "bX3_IS_MOUNT", TRUE); // Custom mount
// SetLocalInt(OBJECT_SELF, "X3_HORSE_TAIL", TRUE); // tailmodels.2da entry to use when mounted
// SetLocalInt(OBJECT_SELF, "X3_HORSE_NULL_APPEARANCE", TRUE); // appearance.2da entry for animation scaling
// SetLocalInt(OBJECT_SELF, "X3_HORSE_FOOTSTEP", TRUE); // footstepsounds.2da entry
// SetLocalFloat(OBJECT_SELF, "X3_HORSE_MOUNT_DURATION", 3.0); // Mount animation duration (seconds)
// SetLocalFloat(OBJECT_SELF, "X3_HORSE_MOUNT_SPEED", 1.5); // Speed increase when mounted
// SetLocalFloat(OBJECT_SELF, "X3_HORSE_DISMOUNT_DURATION", 3.0); // Dismount animation duration (seconds)
// SetLocalFloat(OBJECT_SELF, "X3_TOTAL_MOUNT_ANIMATION_DELAY", 3.0);// Mount animation time remaining (seconds)
}
// END OF CUSTOM CODE FOR HORSES
// CUSTOM USER DEFINED EVENTS
/*
The following settings will allow the user to fire one of the blank user defined events in the NW_D2_DefaultD. Like the
On Spawn In script this script is meant to be customized by the end user to allow for unique behaviors. The user defined
events user 1000 - 1010
*/
//SetSpawnInCondition(NW_FLAG_PERCIEVE_EVENT); //OPTIONAL BEHAVIOR - Fire User Defined Event 1002
//SetSpawnInCondition(NW_FLAG_ATTACK_EVENT); //OPTIONAL BEHAVIOR - Fire User Defined Event 1005
//SetSpawnInCondition(NW_FLAG_DAMAGED_EVENT); //OPTIONAL BEHAVIOR - Fire User Defined Event 1006
//SetSpawnInCondition(NW_FLAG_DISTURBED_EVENT); //OPTIONAL BEHAVIOR - Fire User Defined Event 1008
//SetSpawnInCondition(NW_FLAG_END_COMBAT_ROUND_EVENT); //OPTIONAL BEHAVIOR - Fire User Defined Event 1003
//SetSpawnInCondition(NW_FLAG_ON_DIALOGUE_EVENT); //OPTIONAL BEHAVIOR - Fire User Defined Event 1004
//SetSpawnInCondition(NW_FLAG_DEATH_EVENT); //OPTIONAL BEHAVIOR - Fire User Defined Event 1007
}