Randomized Henchmen

Randomized Henchmen
This commit is contained in:
Jaysyn904
2021-10-10 23:01:07 -04:00
parent 79303e9f79
commit 68de4c6610
29 changed files with 31455 additions and 4417 deletions

View File

@@ -10,8 +10,10 @@
#include "69_INC_HENAI"
void main()
{
//RESPAWN WAYPOINT INSTRUCTIONS
//Create a specific respawn location for henchman with a waypoint with TAG "WP_Respawn_'TAG'"
//where 'TAG' is the TAG of the NPC
@@ -50,7 +52,7 @@ void main()
SetLocalInt(OBJECT_SELF, "HenchInvDrop", TRUE);
//Sets the distance from the enemy that the henchman will switch to melee weapons
SetLocalFloat(OBJECT_SELF, "HenchRange", 5.0);
SetLocalFloat(OBJECT_SELF, "HenchRange", 10.0);
//Sets up the special henchmen listening patterns
SetAssociateListenPatterns();
@@ -144,6 +146,8 @@ void main()
//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
if(GetLocalInt(OBJECT_SELF, "HenchInvDrop") == FALSE)
{
HenchmanNoDropItems69(TRUE, OBJECT_SELF);

View File

@@ -5,38 +5,50 @@
// By Thrym of Markshire 5/21/06 //
// //
////////////////////////////////////////////////////////////////////////////////
// //
// FUNCTION: //
// The Nomenclature is an include file placed in the spawn script //
// nw_c2_default9 designed to assign a name to a generic NPC who may //
// wander towns, roads, shops, etc. //
// //
// Utilizing both SetName and RandomName the system will name the NPC in //
// one of two ways ... //
// //
// "SET_NAME": By setting the variable "SET_NAME" on the NPC and //
// assigning it a string the creature will rename itself upon spawning. //
// This is handy for DM's and builders to create more precisely named //
// creatures for the palette and then generize them upon spawn. //
// //
// eg. Ancient White Dragon in the Creator becomes White Dragon on Spawn. //
// //
// "SET_NAME" = "RANDOM": By setting the same variable to the name "RANDOM" //
// the NPC then is given a random name generated by RACE and GENDER using //
// the RandomName function. //
// //
// eg. Male Dwarven Villager in the creator becomes Gloigan on spawn //
// this time and perhaps Rufus on the next spawned Villager. //
// //
// "NAME_TYPE": Setting this int variable to "1" will cause a Full Name //
// to be generated if the "SET_NAME" is set to "RANDOM". //
// //
// eg. Male Dwarven Villager becomes Gloigan Stonecutter or Rufus Mason. //
// //
////////////////////////////////////////////////////////////////////////////////
/*
// FUNCTION:
// The Nomenclature is an include file placed in the spawn script
// nw_c2_default9 designed to assign a name to a generic NPC who may
// wander towns, roads, shops, etc.
//
// Utilizing both SetName and RandomName the system will name the NPC in
// one of two ways ...
//
// "SET_NAME": By setting the variable "SET_NAME" on the NPC and
// assigning it a string the creature will rename itself upon spawning.
// This is handy for DM's and builders to create more precisely named
// creatures for the palette and then generize them upon spawn.
//
// eg. Ancient White Dragon in the Creator becomes White Dragon on Spawn.
//
// "SET_NAME" = "RANDOM": By setting the same variable to the name "RANDOM"
// the NPC then is given a random name generated by RACE and GENDER using
// the RandomName function.
//
// eg. Male Dwarven Villager in the creator becomes Gloigan on spawn
// this time and perhaps Rufus on the next spawned Villager.
//
// "NAME_TYPE": Setting this int variable to "1" will cause a Full Name
// to be generated if the "SET_NAME" is set to "RANDOM".
//
// eg. Male Dwarven Villager becomes Gloigan Stonecutter or Rufus Mason.
"RND_ROGUE"
"RND_BARBARIAN"
"RND_FIGHTER"
"RND_CLERIC" : Setting these to "1" will give the NPC a class appropriate
"RND_MAGE" : title
"RND_DRUID"
"RND_RANGER"
//
//
//////////////////////////////////////////////////////////////////////////////*/
//void main (){}
///// FUNCTION DECLARATIONS ////////////////////////////////////////////////////
// Generates a Random First Name
@@ -66,13 +78,245 @@ void ms_Nomenclature(object oNPC = OBJECT_SELF)
string sTitle = GetLocalString(oNPC, "TITLE");
string sPostfix = GetLocalString(oNPC, "POSTFIX");
int nRndRogue = GetLocalInt(OBJECT_SELF,"RND_ROGUE");
if (nRndRogue == 1)
{
int nResult = d6(1);
if (nResult == 1)
{
sPostfix = "the Quick";
}
else if(nResult == 2)
{
sPostfix = "the Quiet";
}
else if(nResult == 3)
{
sPostfix = "the Sharp";
}
else if(nResult ==4)
{
sPostfix = "the Sneak";
}
else if(nResult == 5)
{
sPostfix = "the Rogue";
}
else
sPostfix = "the Footpad";
}
int nRndBarb = GetLocalInt(OBJECT_SELF,"RND_BARBARIAN");
if (nRndBarb == 1)
{
int nResult = d6(1);
if (nResult == 1)
{
sPostfix = "the Barbarian";
}
else if(nResult == 2)
{
sPostfix = "the Destroyer";
}
else if(nResult == 3)
{
sPostfix = "of the Plains";
}
else if(nResult ==4)
{
sPostfix = "of Tiger Clan";
}
else if(nResult == 5)
{
sPostfix = "of Bear Clan";
}
else
sPostfix = "the Avenger";
}
int nRndFight = GetLocalInt(OBJECT_SELF,"RND_FIGHTER");
if (nRndFight == 1)
{
int nResult = d6(1);
if (nResult == 1)
{
sPostfix = "the Strong";
}
else if(nResult == 2)
{
sPostfix = "the Stout";
}
else if(nResult == 3)
{
sPostfix = "of the Blade";
}
else if(nResult ==4)
{
sPostfix = "of Neverwinter";
}
else if(nResult == 5)
{
sPostfix = "of Amn";
}
else
sPostfix = "the Swordhand";
}
int nRndCleric = GetLocalInt(OBJECT_SELF,"RND_CLERIC");
if (nRndCleric == 1)
{
int nResult = d6(1);
if (nResult == 1)
{
sPostfix = "the Pious";
}
else if(nResult == 2)
{
sPostfix = "the Holy";
}
else if(nResult == 3)
{
sPostfix = "the Priest";
}
else if(nResult ==4)
{
sPostfix = "the Zealous";
}
else if(nResult == 5)
{
sPostfix = "of Phlan";
}
else
sPostfix = "the Wise";
}
int nRndMage = GetLocalInt(OBJECT_SELF,"RND_MAGE");
if (nRndMage == 1)
{
int nResult = d6(1);
if (nResult == 1)
{
sPostfix = "the Mad";
}
else if(nResult == 2)
{
sPostfix = "the Arcane";
}
else if(nResult == 3)
{
sPostfix = "the Black";
}
else if(nResult ==4)
{
sPostfix = "the Wizard";
}
else if(nResult == 5)
{
sPostfix = "of Waterdeep";
}
else
sPostfix = "the Mage";
}
int nRndBard = GetLocalInt(OBJECT_SELF,"RND_BARD");
if (nRndMage == 1)
{
int nResult = d6(1);
if (nResult == 1)
{
sPostfix = "the Dancer";
}
else if(nResult == 2)
{
sPostfix = "the Troubador";
}
else if(nResult == 3)
{
sPostfix = "of the Song";
}
else if(nResult ==4)
{
sPostfix = "the Bard";
}
else if(nResult == 5)
{
sPostfix = "the Raconteur";
}
else
sPostfix = "the Minstrel";
}
int nRndDruid = GetLocalInt(OBJECT_SELF,"RND_DRUID");
if (nRndDruid == 1)
{
int nResult = d6(1);
if (nResult == 1)
{
sPostfix = "the Druid";
}
else if(nResult == 2)
{
sPostfix = "of the Forest";
}
else if(nResult == 3)
{
sPostfix = "of the Wild";
}
else if(nResult ==4)
{
sPostfix = "the Wolflord";
}
else if(nResult == 5)
{
sPostfix = "the Treelord";
}
else
sPostfix = "the Warden";
}
int nRndRanger = GetLocalInt(OBJECT_SELF,"RND_RANGER");
if (nRndRanger == 1)
{
int nResult = d6(1);
if (nResult == 1)
{
sPostfix = "the Ranger";
}
else if(nResult == 2)
{
sPostfix = "of the Forest";
}
else if(nResult == 3)
{
sPostfix = "of the Wild";
}
else if(nResult ==4)
{
sPostfix = "the Strider";
}
else if(nResult == 5)
{
sPostfix = "the Venger";
}
else
sPostfix = "the Warden";
}
if (sRandomName != "")
{
if (sRandomName == "RANDOM")
{
switch (GetLocalInt(oNPC, "NAME_TYPE"))
{
case 1: sRandomName = sTitle + " " + ms_RandomFirstName(oNPC) + " " + ms_RandomLastName(oNPC); break;
case 1: sRandomName = sTitle + " " + ms_RandomFirstName(oNPC) + " " + ms_RandomLastName(oNPC)+ " " + sPostfix; break;
default: sRandomName = sTitle + " " + ms_RandomFirstName(oNPC) + " " + sPostfix; break;
}
}

View File

@@ -0,0 +1,186 @@
//::///////////////////////////////////////////////
//:: Associate: On Spawn In
//:: ra_hen_spw_rogue
//:: Copyright (c) 2021 Project RATDOG
//:://////////////////////////////////////////////
/*
OnSpawn for randomized rogue henchman.
*/
//:://////////////////////////////////////////////
//:: Created By: Jaysyn
//:: Created On: Oct 10, 2021
//:://////////////////////////////////////////////
#include "69_INC_HENAI"
#include "ms_name_inc"
#include "rnd_commoner_inc"
#include "ra_rnd_armor_inc"
void main()
{
// Apply randomizations.
RndLightArmor(OBJECT_SELF);
ms_Nomenclature(OBJECT_SELF);
int nKeepskin = GetLocalInt(OBJECT_SELF,"RA_KEEPSKIN");
if (nKeepskin != 1)
{
rnd_skin(OBJECT_SELF);
}
rnd_skin(OBJECT_SELF);
int nKeephead = GetLocalInt(OBJECT_SELF,"RA_KEEPHEAD");
if (nKeephead != 1)
{
rnd_head(OBJECT_SELF);
}
int nKeeptats = GetLocalInt(OBJECT_SELF,"RA_KEEPTATS");
if (nKeeptats != 1)
{
rnd_tattoo(OBJECT_SELF);
}
//RESPAWN WAYPOINT INSTRUCTIONS
//Create a specific respawn location for henchman with a waypoint with TAG "WP_Respawn_'TAG'"
//where 'TAG' is the TAG of the NPC
//Create a default general respawn location with waypoint with TAG "NW_DEATH_TEMPLE"
//Create a Home waypoint with TAG "WP_Home_'TAG'" where 'TAG' is the TAG of the NPC
// This is where the Hench will go when they quit the PC
//Sets default level up package based on settings in henchman's blueprint
//This may be changed through henchman dialog, do not edit
SetLocalInt(OBJECT_SELF, "ClassPackage", GetCreatureStartingPackage(OBJECT_SELF));
//Set variable for level up, do not edit
SetLocalInt(OBJECT_SELF, "NewClass", -1);
//Sets up the HENCH_LAG for this henchman,
//Replace the 0 with any number the henchman lags(+)
//or leads(-) in level. Save this script as something
//else per this henchman. This allows multileveled
//henchman
//Minimum of -1,-2,-3... Maximum of 1,2,3... Same Level = 0
SetLocalInt(OBJECT_SELF, "HenchLag", 0);
//Sets the Maximum Level the Henchman may level
//Default: 40
SetLocalInt(OBJECT_SELF, "HENCH_MAXLEVEL", 40);
//Sets whether or not PC is allowed into henchman inventory
//TRUE: Inventory is accessible
//FALSE: Inventory is not accessible
//Default: TRUE
SetLocalInt(OBJECT_SELF, "HenchInv", TRUE);
//Sets whether or not initial henchman inventory is no drop
//TRUE: Inventory is droppable
//FALSE: Inventory is not droppable
//Default: TRUE
SetLocalInt(OBJECT_SELF, "HenchInvDrop", TRUE);
//Sets the distance from the enemy that the henchman will switch to melee weapons
SetLocalFloat(OBJECT_SELF, "HenchRange", 10.0);
//Sets up the special henchmen listening patterns
SetAssociateListenPatterns();
// Set additional henchman listening patterns
bkSetListeningPatterns();
//Equips melee weapon by default
//Equips ranged weapons by default if TRUE.
SetAssociateState(NW_ASC_USE_RANGED_WEAPON, FALSE);
//Sets the default distance that the henchman will follow
//the PC, only uncomment one of the following three
SetAssociateState(NW_ASC_DISTANCE_2_METERS);
//SetAssociateState(NW_ASC_DISTANCE_4_METERS);
//SetAssociateState(NW_ASC_DISTANCE_6_METERS);
//End default distances
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);
// April 2002: Summoned monsters, associates and familiars need to stay
// further back due to their size.
if (GetAssociate(ASSOCIATE_TYPE_HENCHMAN, GetMaster()) == OBJECT_SELF ||
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);
}
// 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.
//Set starting location
SetAssociateStartLocation();
// For some general behavior while we don't have a master,
// let's do some immobile animations
// SetSpawnInCondition(NW_FLAG_IMMOBILE_AMBIENT_ANIMATIONS);
// For some general behavior while we don't have a master,
// let's do some mobile animations
// SetSpawnInCondition(NW_FLAG_AMBIENT_ANIMATIONS);
// **** Special Combat Tactics *****//
// * These are special flags that can be set on creatures to
// * make them follow certain specialized combat tactics.
// * NOTE: ONLY ONE OF THESE SHOULD BE SET ON A SINGLE CREATURE.
// * Ranged attacker
// * Will attempt to stay at ranged distance from their
// * target.
// SetCombatCondition(X0_COMBAT_FLAG_RANGED);
// * Defensive attacker
// * Will use defensive combat feats and parry
// SetCombatCondition(X0_COMBAT_FLAG_DEFENSIVE);
// * Ambusher
// * Will go stealthy/invisible and attack, then
// * run away and try to go stealthy again before
// * attacking anew.
// SetCombatCondition(X0_COMBAT_FLAG_AMBUSHER);
// * Cowardly
// * Cowardly creatures will attempt to flee
// * attackers.
// SetCombatCondition(X0_COMBAT_FLAG_COWARDLY);
// 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
ActionEquipMostEffectiveArmor();
if(GetLocalInt(OBJECT_SELF, "HenchInvDrop") == FALSE)
{
HenchmanNoDropItems69(TRUE, OBJECT_SELF);
}
}

View File

@@ -1,5 +1,5 @@
//
// Bandit Random Armor Include
// Randomized Armor Include
// RA_RND_ARMOR_INC
//
// By: Jaysyn
@@ -63,3 +63,67 @@ void RndBanditArmor(object oNPC)
}
}
void RndLightArmor(object oNPC)
{
// Makes sure any original armor isn't dropped as loot.
SetDroppableFlag(GetItemInSlot(INVENTORY_SLOT_CHEST, OBJECT_SELF), 0);
//Randomizes Armor
int nResult = d8(1);
int nStackSize = 1; // Create 1 items;
object oArmor;
string sItem;
if (nResult == 1)
{
sItem = "aarcl002";
}
else if(nResult == 2)
{
sItem = "baleas_cloth019";
}
else if(nResult == 3)
{
sItem = "aarcl004";
}
else if(nResult ==4)
{
sItem = "zep_studdedleath";
}
else if(nResult == 5)
{
sItem = "aarcl004";
}
else if(nResult == 6)
{
sItem = "nw_aarcl001";
}
else if(nResult == 7)
{
sItem = "nw_aarcl002";
}
else
sItem = "nw_aarcl009";
CreateItemOnObject(sItem, OBJECT_SELF, nStackSize);
// Loop the object's inventory and equip the first
object oItem = GetFirstItemInInventory(OBJECT_SELF);
while(GetIsObjectValid(oItem))
{
// Check if armor, of course
if(GetBaseItemType(oItem) == BASE_ITEM_ARMOR)
{
// Equip it and stop the script
DelayCommand(1.0f, ActionEquipItem(oItem, INVENTORY_SLOT_CHEST));
return;
}
oItem = GetNextItemInInventory(OBJECT_SELF);
}
}