Added henchman rental

Many areas, items, and creatures were adjusted for balance and aesthetics.
This commit is contained in:
EpicValor
2023-08-24 15:20:50 -05:00
parent d6cb8322b9
commit 07f4ebed49
2373 changed files with 518431 additions and 7256 deletions

View File

@@ -0,0 +1,34 @@
//::///////////////////////////////////////////////
//:: Associate: End of Combat End
//:: 69_HEN_COMBAT
//:: Copyright (c) 2001 Bioware Corp.
//:://////////////////////////////////////////////
/*
Calls the end of combat script every round
*/
//:://////////////////////////////////////////////
//:: Created By: Preston Watamaniuk
//:: Created On: Oct 16, 2001
//:: Modified: 69MEH69
//:://////////////////////////////////////////////
#include "69_inc_henai"
void main()
{
object oPC = GetMaster();
if(!GetSpawnInCondition(NW_FLAG_SET_WARNINGS))
{
HenchmenCombatRound(OBJECT_INVALID);
}
if(GetIsDead(oPC))
{
HenchRessurect69(oPC);
}
if(GetSpawnInCondition(NW_FLAG_END_COMBAT_ROUND_EVENT))
{
SignalEvent(OBJECT_SELF, EventUserDefined(1003));
}
}

122
_module/nss/69_hen_conv.nss Normal file
View File

@@ -0,0 +1,122 @@
//:://////////////////////////////////////////////////
//:: 69_HEN_CONV
/*
OnDialogue event handler for henchmen/associates.
*/
//:://////////////////////////////////////////////////
//:: Copyright (c) 2002 Floodgate Entertainment
//:: Created By: Naomi Novik
//:: Created On: 01/05/2003
//:: Modified: 69MEH69 Sep2004
//:://////////////////////////////////////////////////
#include "69_inc_henai"
#include "x0_i0_henchman"
//* GeorgZ - Put in a fix for henchmen talking even if they are petrified
int AbleToTalk(object oSelf)
{
if (GetHasEffect(EFFECT_TYPE_CONFUSED, oSelf) || GetHasEffect(EFFECT_TYPE_DOMINATED, oSelf) ||
GetHasEffect(EFFECT_TYPE_PETRIFY, oSelf) || GetHasEffect(EFFECT_TYPE_PARALYZE, oSelf) ||
GetHasEffect(EFFECT_TYPE_STUNNED, oSelf) || GetHasEffect(EFFECT_TYPE_FRIGHTENED, oSelf)
)
{
return FALSE;
}
return TRUE;
}
void main()
{
// * XP2, special handling code for interjections
// * This script only fires if someone inits with me.
// * with that in mind, I am now clearing any interjections
// * that the character might have on themselves.
if (GetLocalInt(GetModule(), "X2_L_XP2") == TRUE)
{
SetLocalInt(OBJECT_SELF, "X2_BANTER_TRY", 0);
SetHasInterjection(GetMaster(OBJECT_SELF), FALSE);
SetLocalInt(OBJECT_SELF, "X0_L_BUSY_SPEAKING_ONE_LINER", 0);
SetOneLiner(FALSE, 0);
}
object oShouter = GetLastSpeaker();
if (GetIsHenchmanDying() == TRUE)
{
return;
}
object oMaster = GetMaster();
int nMatch = GetListenPatternNumber();
object oIntruder;
if (nMatch == -1)
{
// * September 2 2003
// * Added the GetIsCommandable check back in so that
// * Henchman cannot be interrupted when they are walking away
if (GetCommandable(OBJECT_SELF) == TRUE && AbleToTalk(OBJECT_SELF)
&& (GetCurrentAction() != ACTION_OPENLOCK))
{ //SetCommandable(TRUE);
ClearActions(CLEAR_X0_CH_HEN_CONV_26);
string sDialogFileToUse = GetDialogFileToUse(GetLastSpeaker());
BeginConversation(sDialogFileToUse);
}
}
else
{
// listening pattern matched
if (GetIsObjectValid(oMaster))
{
// we have a master, only listen to them
// * Nov 2003 - Added an AbleToTalk, so that henchmen
// * do not respond to orders when 'frozen'
if (GetIsObjectValid(oShouter) && oMaster == oShouter && AbleToTalk(OBJECT_SELF)) {
SetCommandable(TRUE);
bkRespondToHenchmenShout(oShouter, nMatch, oIntruder);
}
}
// we don't have a master, behave in default way
else if (GetIsObjectValid(oShouter)
&& !GetIsPC(oShouter)
&& GetIsFriend(oShouter)) {
object oIntruder = OBJECT_INVALID;
// Determine the intruder if any
if(nMatch == 4) {
oIntruder = GetLocalObject(oShouter, "NW_BLOCKER_INTRUDER");
}
else if (nMatch == 5) {
oIntruder = GetLastHostileActor(oShouter);
if(!GetIsObjectValid(oIntruder)) {
oIntruder = GetAttemptedAttackTarget();
if(!GetIsObjectValid(oIntruder)) {
oIntruder = GetAttemptedSpellTarget();
}
}
}
// Actually respond to the shout
RespondToShout(oShouter, nMatch, oIntruder);
}
}
// Signal user-defined event
if(GetSpawnInCondition(NW_FLAG_ON_DIALOGUE_EVENT)) {
SignalEvent(OBJECT_SELF, EventUserDefined(EVENT_DIALOGUE));
}
}

View File

@@ -0,0 +1,352 @@
//::///////////////////////////////////////////////
//:: Henchman Death Script
//::
//:: 69_hen_death
//::
//:: Copyright (c) 2001 Bioware Corp.
//:://////////////////////////////////////////////
//:: <description>
//:://////////////////////////////////////////////
//::
//:: Created By: 69MEH69 Jul 2004 Henchman Death Option
//:://////////////////////////////////////////////
#include "69_hench_lib"
void HenchmanBleed(object oHench = OBJECT_SELF);
void HenchHeal(object oHench = OBJECT_SELF);
void HenchmanDeath(object oHench = OBJECT_SELF);
void HenchSalvation(object oHench);
void HenchmanLootBag(object oHench);
void main()
{
int HENCH_BLEED = GetLocalInt(GetModule(), "HENCH_BLEED");
int TEST_MODE = GetLocalInt(GetModule(), "TEST_MODE");
object oMaster = GetMaster(OBJECT_SELF);
object oPC = GetLastMaster(OBJECT_SELF);
string sName = GetName(OBJECT_SELF);
object oArea = GetArea(OBJECT_SELF);
string sTag = GetTag(OBJECT_SELF);
string sLastName = GetName(oPC);
//Test
if(TEST_MODE == 1)
{
SendMessageToPC(GetFirstPC(), "My last master is " +sLastName);
}
//Adds up number of dead henchmen under PC's watch
int nHenchDeath = GetLocalInt(oMaster, "Hench_Death");
SetLocalInt(oMaster, "Hench_Death", nHenchDeath + 1);
//Resets henchman familiar/animal companion
SetLocalInt(OBJECT_SELF, "HasCompanion", FALSE);
// I have yet to be hired but have died by unforeseen event
if(!GetIsEnemy(oPC) && !GetIsObjectValid(oMaster))
{
ClearAllActions();
SetHenchmanDying(OBJECT_SELF, FALSE);
SetPlotFlag(OBJECT_SELF, TRUE);
SetAssociateState(NW_ASC_IS_BUSY, TRUE);
SetIsDestroyable(FALSE, TRUE, TRUE);
DelayCommand(30.0, RespawnHenchman69());
}
// I may not be currently hired but am indeed an enemy to my last master
if(GetIsEnemy(oPC) && !GetIsObjectValid(oMaster))
{
ClearAllActions();
//Give XP
ExecuteScript("nw_c2_default7", OBJECT_SELF);
//ChangeToStandardFaction(OBJECT_SELF, STANDARD_FACTION_COMMONER);
ClearPersonalReputation(oPC);
ClearPersonalReputation(OBJECT_SELF, oPC);
//SetFriendly(oPC);
SetIsDestroyable(FALSE, FALSE, TRUE);
DelayCommand(59.0, SetIsDestroyable(TRUE, FALSE, TRUE));
DelayCommand(60.0, DestroyObject(OBJECT_SELF));
}
// * I am a familiar, give 1d6 damage to my master
if(GetAssociate(ASSOCIATE_TYPE_FAMILIAR, oMaster) == OBJECT_SELF)
{
// April 2002: Made it so that familiar death can never kill the player
// only wound them.
int nDam = d6();
if (nDam >= GetCurrentHitPoints(oMaster))
{
nDam = GetCurrentHitPoints(oMaster) - 1;
}
effect eDam = EffectDamage(nDam);
FloatingTextStrRefOnCreature(63489, oMaster, FALSE);
ApplyEffectToObject(DURATION_TYPE_PERMANENT, eDam, oMaster);
}
if(HENCH_BLEED == 0)
{
if(GetIsObjectValid(oMaster))
{
if(GetAssociateType(OBJECT_SELF) == ASSOCIATE_TYPE_HENCHMAN)
{
ClearAllDialogue(oMaster, OBJECT_SELF);
ClearAllActions();
SetLastMaster(oMaster, OBJECT_SELF);
HenchmanDeath(OBJECT_SELF);
SetDidDie(TRUE, OBJECT_SELF);
SetHenchmanDying(OBJECT_SELF, FALSE);
SetPlotFlag(OBJECT_SELF, TRUE);
SetAssociateState(NW_ASC_IS_BUSY, TRUE);
SetIsDestroyable(FALSE, TRUE, TRUE);
//Spawn henchman to location specified in spawn script
DelayCommand(10.0, RespawnHenchman69());
}
}
}//End HENCH_BLEED = 0
else if(HENCH_BLEED == 1)
{
if(GetIsObjectValid(oMaster))
{
ClearAllDialogue(oMaster, OBJECT_SELF);
ClearAllActions();
SetLastMaster(oMaster, OBJECT_SELF);
//Inform player
HenchmanDeath(OBJECT_SELF);
// Mark us as in the process of dying
SetHenchmanDying(OBJECT_SELF, TRUE);
// Mark henchman PLOT & Busy
//SetPlotFlag(oHench, TRUE);
SetAssociateState(NW_ASC_IS_BUSY, FALSE, OBJECT_SELF);
// Make henchman's corpse stick around,
// be raiseable, and selectable
SetIsDestroyable(FALSE, TRUE, TRUE);
SetLocalObject(oArea, "DOA" +sTag, OBJECT_SELF);
if(GetCurrentHitPoints(OBJECT_SELF) <= -10)
{
SetDidDie(TRUE, OBJECT_SELF);
SetHenchmanDying(OBJECT_SELF, FALSE);
PlayVoiceChat(VOICE_CHAT_DEATH); // scream one last time
ApplyEffectToObject(DURATION_TYPE_INSTANT, EffectVisualEffect(VFX_IMP_DEATH), OBJECT_SELF); // make death dramatic
ApplyEffectToObject(DURATION_TYPE_INSTANT, EffectDeath(), OBJECT_SELF); // now kill them
SendMessageToPC(oMaster, sName+ " has died!");
if(GetLocalInt(OBJECT_SELF, "HenchInv"))
{
HenchmanLootBag(OBJECT_SELF);
}
return;
}
DelayCommand(0.5, VoiceHealMe(TRUE));
if(GetCurrentHitPoints(OBJECT_SELF) > 0)
{
SetLocalInt(oArea, "nCHP" +sTag, -1);
}
else
{
SetLocalInt(oArea, "nCHP" +sTag, GetCurrentHitPoints(OBJECT_SELF));
}
HenchSalvation(OBJECT_SELF);
if(GetIsHenchmanDying(OBJECT_SELF) == TRUE && GetDidDie(OBJECT_SELF) == FALSE)
{
SendMessageToPC(oMaster, sName+ " is dying");
DelayCommand(6.0, HenchmanBleed(OBJECT_SELF));
}
}
} //End HENCH_BLEED = 1
else if(HENCH_BLEED == 2)
{
ClearAllDialogue(oMaster, OBJECT_SELF);
ClearAllActions();
SetLastMaster(oMaster, OBJECT_SELF);
HenchmanDeath(OBJECT_SELF);
SetDidDie(TRUE, OBJECT_SELF);
SetHenchmanDying(OBJECT_SELF, FALSE);
DelayCommand(15.0, DestroyObject(OBJECT_SELF));
} //End HENCH_BLEED = 2
else if(HENCH_BLEED == 3)
{
if(GetAssociateType(OBJECT_SELF) == ASSOCIATE_TYPE_HENCHMAN)
{
ClearAllDialogue(oMaster, OBJECT_SELF);
ClearAllActions();
HenchmanDeath(OBJECT_SELF);
SetDidDie(TRUE, OBJECT_SELF);
SetHenchmanDying(OBJECT_SELF, FALSE);
SetPlotFlag(OBJECT_SELF, TRUE);
SetAssociateState(NW_ASC_IS_BUSY, TRUE);
SetIsDestroyable(FALSE, TRUE, TRUE);
//Spawn henchman to location specified in spawn script
DelayCommand(30.0, RespawnHenchman69());
}
}//End HENCH_BLEED = 3
}
void HenchmanBleed(object oHench = OBJECT_SELF)
{
int HENCH_SALVATION = GetLocalInt(GetModule(), "HENCH_SALVATION");
int TEST_MODE = GetLocalInt(GetModule(), "TEST_MODE");
object oPC = GetLastMaster(oHench);
string sTag = GetTag(oHench);
object oArea = GetArea(oHench);
string sName = GetName(oHench);
if(HENCH_SALVATION == 1)
{
HenchSalvation(oHench);
}
/*switch (d6(1))
{
case 1: PlayVoiceChat(VOICE_CHAT_PAIN1); break;
case 2: PlayVoiceChat(VOICE_CHAT_PAIN2); break;
case 3: PlayVoiceChat(VOICE_CHAT_PAIN3); break;
case 4: PlayVoiceChat(VOICE_CHAT_HEALME); break;
case 5: PlayVoiceChat(VOICE_CHAT_NEARDEATH); break;
case 6: PlayVoiceChat(VOICE_CHAT_HELP); break;
}*/
if((GetIsHenchmanDying(oHench) == TRUE) && (GetDidDie(oHench) == FALSE))
{
int nCHP = GetLocalInt(oArea, "nCHP" +sTag);
SetLocalInt(oArea, "nCHP" +sTag, nCHP - 1);
nCHP = GetLocalInt(oArea, "nCHP" +sTag);
string sCHP = IntToString(nCHP);
SendMessageToPC(oPC, sName+ " has " +sCHP+ " hit points!");
//Test
if(TEST_MODE == 1)
{
int nHP = GetCurrentHitPoints(OBJECT_SELF);
string sHP = IntToString(nHP);
SendMessageToPC(oPC, sName+ " has " +sHP+ " hit points");
}
if(GetLocalInt(oArea, "nCHP" +sTag) >= 1)
{
ClearAllActions();
SendMessageToPC(oPC, sName+ " is healed!");
PostRespawnCleanup69(oHench);
PartialRes(oHench);
HireHenchman69(oPC, oHench);
if(GetLocalInt(oArea, "nCHP" +sTag) >= 20)
{
ApplyEffectToObject(DURATION_TYPE_INSTANT, EffectHeal(GetMaxHitPoints(oHench)), oHench);
}
return;
}
else if(GetLocalInt(oArea, "nCHP" +sTag) <= -10)
{
SetDidDie(TRUE, oHench);
SetHenchmanDying(oHench, FALSE);
SendMessageToPC(oPC, sName+ " is beyond healing!");
PlayVoiceChat(VOICE_CHAT_DEATH); //scream one last time
ApplyEffectToObject(DURATION_TYPE_INSTANT, EffectVisualEffect(VFX_IMP_DEATH), oHench); // make death dramatic
ApplyEffectToObject(DURATION_TYPE_INSTANT, EffectDeath(), oHench); // now kill them
if(GetLocalInt(oHench, "HenchInv"))
{
HenchmanLootBag(oHench);
}
return;
}
else
{
SendMessageToPC(oPC, sName+ " is dying");
DelayCommand(6.0, HenchmanBleed(oHench));
}
}
}
void HenchHeal(object oHench = OBJECT_SELF)
{
object oPC = GetLastMaster(oHench);
string sName = GetName(oHench);
object oArea = GetArea(oHench);
string sTag = GetTag(oHench);
int nCHP = GetLocalInt(oArea, "nCHP" +sTag);
SetLocalInt(oArea, "nCHP" +sTag, nCHP + 1);
nCHP = GetLocalInt(oArea, "nCHP" +sTag);
string sCHP = IntToString(nCHP);
SendMessageToPC(oPC, sName+ " has " +sCHP+ " hit points!");
if(nCHP >= 1)
{
PostRespawnCleanup69(oHench);
PartialRes(oHench);
if((GetResurrected(oPC) == TRUE) && (GetDidDie(oHench) == TRUE))
{
HireHenchman69(oPC);
}
else if(GetDidDie(oHench) == FALSE)
{
HireHenchman69(oPC);
}
return;
}
else
{
SendMessageToPC(oPC, sName+ " is healing");
DelayCommand(6.0, HenchHeal(oHench));
}
}
void HenchmanDeath(object oHench = OBJECT_SELF)
{
object oPC = GetLastMaster(oHench);
object oBlood = CreateObject(OBJECT_TYPE_PLACEABLE,"plc_bloodstain", GetLocation(oHench));
//Remove blood after a while
DestroyObject(oBlood,60.0f);
// Henchman death notification
string sHenchName = GetName(oHench);
SendMessageToPC(oPC, sHenchName+ " has fallen!");
RemoveHenchman(oPC, oHench);
}
void HenchSalvation(object oHench = OBJECT_SELF)
{
object oPC = GetLastMaster(oHench);
string sTag = GetTag(oHench);
object oArea = GetArea(oHench);
string sName = GetName(oHench);
int nSalvation = d10(1);
if(nSalvation == 1 && GetDidDie(oHench) == FALSE)
{
int nGender = GetGender(oHench);
string sGender;
if(nGender == GENDER_FEMALE)
{
sGender = "her";
}
else if(nGender == GENDER_MALE)
{
sGender = "his";
}
else
{
sGender = "it's";
}
SetHenchmanDying(oHench, FALSE);
PlayVoiceChat(VOICE_CHAT_LAUGH);
SendMessageToPC(oPC, sName+ " has avoided death and is recovering from " +sGender+ " wounds!");
DelayCommand(6.0, HenchHeal(oHench));
}
}
void HenchmanLootBag(object oHench = OBJECT_SELF)
{
object oPC = GetLastMaster(oHench);
location lLoc = GetStepRightLocation(oHench);
string sTag = GetTag(oHench);
object oLootBag = CreateObject(OBJECT_TYPE_ITEM, "henchmanbackpack", lLoc, FALSE, sTag+ "BAG");
MoveHenchmanItems69(oLootBag, oHench);
}

View File

@@ -0,0 +1,80 @@
//::///////////////////////////////////////////////
//:: Associate: On Percieve
//:: 69_hen_percep
//:: Copyright (c) 2001 Bioware Corp.
//:://////////////////////////////////////////////
//:://////////////////////////////////////////////
//:: Created By: Preston Watamaniuk
//:: Created On: Nov 19, 2001
//:: Modified: 69MEH69 Sep2004
//:://////////////////////////////////////////////
#include "69_INC_HENAI"
#include "69_hench_lib"
void main()
{
//This is the equivalent of a force conversation bubble, should only be used if you want an NPC
//to say something while he is already engaged in combat.
if(GetSpawnInCondition(NW_FLAG_SPECIAL_COMBAT_CONVERSATION))
{
ActionStartConversation(OBJECT_SELF);
}
// * July 2003
// * If in Stealth mode, don't attack enemies. Wait for player to attack or
// * for you to be attacked. (No point hiding anymore if you've been detected)
if(!GetAssociateState(NW_ASC_MODE_STAND_GROUND) && GetActionMode(OBJECT_SELF, ACTION_MODE_STEALTH)== FALSE)
{
//Do not bother checking the last target seen if already fighting
if(!GetIsObjectValid(GetAttemptedAttackTarget()) &&
!GetIsObjectValid(GetAttackTarget()) &&
!GetIsObjectValid(GetAttemptedSpellTarget()))
{
//Check if the last percieved creature was actually seen
if(GetLastPerceptionSeen())
{
if(GetIsEnemy(GetLastPerceived()))
{
SetFacingPoint(GetPosition(GetLastPerceived()));
if(d4(1) == 1)
{
BattleCry(); //In 69_hench_lib
}
HenchmenCombatRound(OBJECT_INVALID);
}
//Linked up to the special conversation check to initiate a special one-off conversation
//to get the PCs attention
else if(GetSpawnInCondition(NW_FLAG_SPECIAL_CONVERSATION) && GetIsPC(GetLastPerceived()))
{
ActionStartConversation(OBJECT_SELF);
}
}
}
}
else if(!GetAssociateState(NW_ASC_MODE_STAND_GROUND) && GetActionMode(OBJECT_SELF, ACTION_MODE_STEALTH))
{
if(GetLastPerceptionSeen())
{
object oPC = GetMaster();
object oSeen =GetLastPerceived();
if(GetIsEnemy(oSeen) && GetLocalInt(OBJECT_SELF,"Scouting") && !GetLocalInt(OBJECT_SELF,"ScoutingReport"))
{
//ClearAllActions();
//SendMessageToPC(oPC, "HenchScout69");
HenchScout69(oSeen);
}
else if((oPC == oSeen) && GetLocalInt(OBJECT_SELF,"ScoutingReport"))
{
//SendMessageToPC(oPC, "HenchReport69");
HenchReport69(oPC);
}
}
}
if(GetSpawnInCondition(NW_FLAG_PERCIEVE_EVENT))
{
SignalEvent(OBJECT_SELF, EventUserDefined(1002));
}
}

View File

@@ -0,0 +1,157 @@
//::///////////////////////////////////////////////
//:: Associate: On Spawn In
//:: 69_hen_spawnin
//:: Copyright (c) 2001 Bioware Corp.
//:://////////////////////////////////////////////
//:://////////////////////////////////////////////
//:: Created By: Preston Watamaniuk
//:: Created On: Nov 19, 2001
//:://////////////////////////////////////////////
#include "69_INC_HENAI"
#include "ms_name_inc"
void main()
{
ExecuteScript("_golemeqgear", OBJECT_SELF);
ms_Nomenclature(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
if(GetLocalInt(OBJECT_SELF, "HenchInvDrop") == FALSE)
{
HenchmanNoDropItems69(TRUE, OBJECT_SELF);
}
}

View File

@@ -0,0 +1,21 @@
//::///////////////////////////////////////////////
//:: 69_hench_cancast
//:: Copyright (c) 2001 Bioware Corp.
//:://////////////////////////////////////////////
/*
Returns true only if Henchman has at least
one level in spell casting class.
*/
//:://////////////////////////////////////////////
//:: Created By:
//:: Created On:
//:://////////////////////////////////////////////
int StartingConditional()
{
if (GetLevelByClass(CLASS_TYPE_CLERIC, OBJECT_SELF) > 0 || GetLevelByClass(CLASS_TYPE_DRUID, OBJECT_SELF) > 0 || GetLevelByClass(CLASS_TYPE_BARD, OBJECT_SELF) > 0 || GetLevelByClass(CLASS_TYPE_SORCERER, OBJECT_SELF) > 0 || GetLevelByClass(CLASS_TYPE_WIZARD, OBJECT_SELF) > 0)
{
return TRUE;
}
return FALSE;
}

View File

@@ -0,0 +1,16 @@
//::///////////////////////////////////////////////////
//:: 69_HENCH_CANLVL
//:: TRUE if the caller can level up (is at least two
//:: levels below the speaker, and not currently
//:: busy).
//:: Copyright (c) 2002 Floodgate Entertainment
//:: Created By: 69MEH69
//:: Created On: JULY 2004
//::///////////////////////////////////////////////////
#include "69_hench_lib"
int StartingConditional()
{
return GetCanLevelUp69(GetPCSpeaker());
}

View File

@@ -0,0 +1,13 @@
// 69_hench_canwork
// Text appears if NPC can work for PC
// Created: 69MEH69 July 2004
#include "69_hench_lib"
int StartingConditional()
{
int iResult;
iResult = GetCanWork69(GetPCSpeaker(), OBJECT_SELF);
return iResult;
}

View File

@@ -0,0 +1,11 @@
//69_hench_creatureno1
//Checks for no summoned creature (familiar)
//Created By: 69MEH69 MAR2005
int StartingConditional()
{
int iResult;
iResult = (GetHasFeat(FEAT_SUMMON_FAMILIAR) && !GetLocalInt(OBJECT_SELF, "HasCompanion"));
return iResult;
}

View File

@@ -0,0 +1,11 @@
//69_hench_creatureno
//Checks for no summoned creature (animal companion)
//Created By: 69MEH69 MAR2005
int StartingConditional()
{
int iResult;
iResult = (GetHasFeat(FEAT_ANIMAL_COMPANION) && !GetLocalInt(OBJECT_SELF, "HasCompanion"));
return iResult;
}

View File

@@ -0,0 +1,9 @@
//69_hench_creaturesummon
//Henchman will summon Familiar/Animal Companion
//Created By: 69MEH69 MAR2005
#include "69_inc_henai"
void main()
{
HenchSummonCreature69();
}

View File

@@ -0,0 +1,9 @@
//69_hench_creatureunsummon
//Henchman will unsummon Familiar/Animal Companion
//Created By: 69MEH69 MAR2005
#include "69_inc_henai"
void main()
{
HenchUnSummonCreature69();
}

View File

@@ -0,0 +1,11 @@
//69_hench_creatureyes1
//Checks for no summoned creature (familiar)
//Created By: 69MEH69 MAR2005
int StartingConditional()
{
int iResult;
iResult = (GetHasFeat(FEAT_SUMMON_FAMILIAR) && GetLocalInt(OBJECT_SELF, "HasCompanion"));
return iResult;
}

View File

@@ -0,0 +1,11 @@
//69_hench_creatureyes2
//Checks for no summoned creature (animal companion)
//Created By: 69MEH69 MAR2005
int StartingConditional()
{
int iResult;
iResult = (GetHasFeat(FEAT_ANIMAL_COMPANION) && GetLocalInt(OBJECT_SELF, "HasCompanion"));
return iResult;
}

View File

@@ -0,0 +1,33 @@
//69_hench_destroyobject
//Created By: 69MEH69 MAR2005
#include "69_inc_henai"
void main()
{
object oMaster = GetMaster();
ClearAllActions();
SetAssociateState(NW_ASC_IS_BUSY);
int bFound = FALSE;
string sName;
location lCenter = GetLocation(OBJECT_SELF);
object oThing = GetFirstObjectInShape(SHAPE_SPHERE,15.0,lCenter,TRUE,OBJECT_TYPE_PLACEABLE);
while(GetIsObjectValid(oThing))
{
if((GetPlotFlag(oThing) == FALSE) && (GetUseableFlag(oThing) == TRUE))
{
bFound = TRUE;
ActionEquipMostDamagingMelee(oThing);
ActionAttack(oThing);
}
oThing = GetNextObjectInShape(SHAPE_SPHERE,15.0,lCenter,TRUE,OBJECT_TYPE_PLACEABLE | OBJECT_TYPE_ITEM);
} // while(GetIsObjectValid(oThing))
ActionDoCommand(SetAssociateState(NW_ASC_IS_BUSY,FALSE));
if(HasRangedWeapon69(OBJECT_SELF) && GetCombatCondition(X0_COMBAT_FLAG_RANGED) == TRUE)
{
bkEquipRanged(oMaster);
}
if(!bFound)
SpeakString("I don't see anything to destroy around here.");
}

View File

@@ -0,0 +1,14 @@
// 69_hench_didie
// Text appears when NPC has died and has worked for NPC
// Created: 69MEH69 July 2004
#include "x0_i0_henchman"
int StartingConditional()
{
int iResult;
iResult = GetPlayerHasHired(GetPCSpeaker()) == TRUE &&
GetDidDie() == TRUE ;
return iResult;
}

View File

@@ -0,0 +1,18 @@
//69_hench_eqmelee
// Henchman equips melee weapon
// Created by: 69MEH69 Sep2004
#include "69_INC_HENAI"
void main()
{
object oPC = GetPCSpeaker();
if(HasMeleeWeapon69(OBJECT_SELF))
{
SetAssociateState(NW_ASC_USE_RANGED_WEAPON, FALSE);
ActionSpeakString("Very well.");
bkEquipMelee(oPC);
}
else
ActionSpeakString("I do not have a melee weapon to equip.");
}

View File

@@ -0,0 +1,18 @@
//69_hench_eqrange
// Henchman equips melee weapon
// Created by: 69MEH69 Sep2004
#include "69_INC_HENAI"
void main()
{
object oPC = GetPCSpeaker();
if(HasRangedWeapon69(OBJECT_SELF))
{
SetAssociateState(NW_ASC_USE_RANGED_WEAPON, TRUE);
ActionSpeakString("Very well.");
bkEquipRanged(oPC);
}
else
ActionSpeakString("I do not have a ranged weapon to equip.");
}

View File

@@ -0,0 +1,17 @@
//69_hench_eqswap
//Swap equipped melee weapons
//Created By: 69MEH69
//Created On: APR2005
void main()
{
object oRight = GetItemInSlot(INVENTORY_SLOT_RIGHTHAND);
object oLeft = GetItemInSlot(INVENTORY_SLOT_LEFTHAND);
ClearAllActions();
ActionSpeakString("Very well.");
ActionUnequipItem(oRight);
ActionUnequipItem(oLeft);
ActionEquipItem(oLeft,INVENTORY_SLOT_RIGHTHAND);
ActionEquipItem(oRight,INVENTORY_SLOT_LEFTHAND);
}

View File

@@ -0,0 +1,26 @@
//:://////////////////////////////////////////////////
//:: 69_HENCH_FIRE
//:: Copyright (c) 2002 Floodgate Entertainment
//:://////////////////////////////////////////////////
/*
Fires the current henchman and leaves the player with
no henchman.
*/
//:://////////////////////////////////////////////////
//:: Created By: Naomi Novik
//:: Created On: 09/13/2002
//:: Modified By: 69MEH69 MAR2005
//:://////////////////////////////////////////////////
#include "x0_i0_henchman"
#include "69_hench_lib"
void main()
{ ClearAllActions();
FireHenchman(GetPCSpeaker());
if(GetLocalInt(OBJECT_SELF, "HasCompanion"))
{
HenchUnSummonCreature69();
}
}

View File

@@ -0,0 +1,21 @@
//:://////////////////////////////////////////////////
//:: 69_HENCH_FIRED
//:: Copyright (c) 2002 Floodgate Entertainment
//:://////////////////////////////////////////////////
/*
Returns TRUE if the player has previously used this
henchman but had fired him/her.
*/
//:://////////////////////////////////////////////////
//:: Created By: 69MEH69
//:: Created On: Sep2004
//:://////////////////////////////////////////////////
#include "69_hench_lib"
int StartingConditional()
{
if (!GetIsHired() && GetPlayerHasHired(GetPCSpeaker()) && !GetDidDie() && GetCanWork69(GetPCSpeaker(), OBJECT_SELF))
return TRUE;
return FALSE;
}

View File

@@ -0,0 +1,21 @@
//69_hench_gomelee
// Henchman equips melee weapon and
// will engage enemies in melee combat
// Created by: 69MEH69 Feb2005
#include "69_INC_HENAI"
void main()
{
object oPC = GetPCSpeaker();
if(HasMeleeWeapon69(OBJECT_SELF))
{
SetAssociateState(NW_ASC_USE_RANGED_WEAPON, FALSE);
SetCombatCondition(X0_COMBAT_FLAG_RANGED, FALSE);
SetLocalInt(OBJECT_SELF, "COMBAT_FLAG_SWITCH", FALSE);
ActionSpeakString("Very well.");
bkEquipMelee(oPC);
}
else
ActionSpeakString("I do not have a melee weapon to equip.");
}

View File

@@ -0,0 +1,21 @@
//69_hench_gorange
// Henchman equips ranged weapon and
// will engage enemies in ranged combat
// Created by: 69MEH69 Oct2004
#include "69_INC_HENAI"
void main()
{
object oPC = GetPCSpeaker();
if(HasRangedWeapon69(OBJECT_SELF))
{
SetAssociateState(NW_ASC_USE_RANGED_WEAPON, TRUE);
SetCombatCondition(X0_COMBAT_FLAG_RANGED, TRUE);
SetLocalInt(OBJECT_SELF, "COMBAT_FLAG_SWITCH", FALSE);
ActionSpeakString("Very well.");
bkEquipRanged(oPC);
}
else
ActionSpeakString("I do not have a ranged weapon to equip.");
}

View File

@@ -0,0 +1,43 @@
//69_hench_hasdual
//Swap equipped melee weapons
//Created By: 69MEH69
//Created On: APR2005
int MatchSingleHandedWeapon(object oItem)
{
switch(GetBaseItemType(oItem))
{
case BASE_ITEM_BATTLEAXE:
case BASE_ITEM_CLUB:
case BASE_ITEM_DAGGER:
case BASE_ITEM_HANDAXE:
case BASE_ITEM_KAMA:
case BASE_ITEM_KATANA:
case BASE_ITEM_KUKRI:
case BASE_ITEM_LIGHTFLAIL:
case BASE_ITEM_HEAVYFLAIL:
case BASE_ITEM_LIGHTHAMMER:
case BASE_ITEM_LIGHTMACE:
case BASE_ITEM_LONGSWORD:
case BASE_ITEM_MORNINGSTAR:
case BASE_ITEM_RAPIER:
case BASE_ITEM_SICKLE:
case BASE_ITEM_SCIMITAR:
case BASE_ITEM_SHORTSWORD:
case BASE_ITEM_WARHAMMER: return TRUE;
break;
default: break;
}
return FALSE;
}
int StartingConditional()
{
if (MatchSingleHandedWeapon(GetItemInSlot(INVENTORY_SLOT_RIGHTHAND, OBJECT_SELF)) &&
MatchSingleHandedWeapon(GetItemInSlot(INVENTORY_SLOT_LEFTHAND, OBJECT_SELF)))
return TRUE;
return FALSE;
}

View File

@@ -0,0 +1,52 @@
//69_hench_heall
//Henchman will attempt to heal the most injured in party
//Created by: 69MEH69
#include "nw_i0_generic"
#include "prc_inc_racial"
void main()
{
ResetHenchmenState();
SetCommandable(TRUE, OBJECT_SELF);
object oTarget = GetFactionMostDamagedMember(OBJECT_SELF);
talent tUse;
if(GetIsObjectValid(oTarget))
{
int nCurrent = GetCurrentHitPoints(oTarget);
int nBase = GetMaxHitPoints(oTarget);
if(MyPRCGetRacialType(oTarget) == RACIAL_TYPE_UNDEAD)
{
if(nCurrent < nBase && !GetIsDead(oTarget))
{
tUse = GetCreatureTalentBest(TALENT_CATEGORY_HARMFUL_TOUCH, TALENT_ANY);
if(GetIsTalentValid(tUse))
{
ClearAllActions();
ActionUseTalentOnObject(tUse, oTarget);
}
}
}
else if(MyPRCGetRacialType(oTarget) != RACIAL_TYPE_UNDEAD)
{
if(nCurrent < nBase && !GetIsDead(oTarget))
{
tUse = GetCreatureTalentBest(TALENT_CATEGORY_BENEFICIAL_HEALING_TOUCH, TALENT_ANY);
if(GetIsTalentValid(tUse))
{
ClearAllActions();
ActionUseTalentOnObject(tUse, oTarget);
}
else
{
ActionSpeakString("I'm out of healing spells.", TALKVOLUME_TALK);
}
}
}
}
else
ActionSpeakString("Everyone seems to be in good health.", TALKVOLUME_TALK);
}

View File

@@ -0,0 +1,16 @@
//::///////////////////////////////////////////////
//:: FileName 69_hench_henchxp
//:://////////////////////////////////////////////
//:://////////////////////////////////////////////
//:: Created By: 69MEH69
//:: Created On: 10/5/04 2:53:41 PM
//:://////////////////////////////////////////////
int StartingConditional()
{
// Inspect local variables
if(!(GetLocalInt(GetModule(), "HENCHXP") == 1))
return FALSE;
return TRUE;
}

View File

@@ -0,0 +1,31 @@
//:://////////////////////////////////////////////////
//:: 69_hench_hire
//:: Copyright (c) 2002 Floodgate Entertainment
//:://////////////////////////////////////////////////
/*
Actions taken when a henchman rejoins his/her current
master.
*/
//:://////////////////////////////////////////////////
//:: Created By: 69MEH69
//:: Created On: Sep2004
//:://////////////////////////////////////////////////
#include "69_hench_lib"
void main()
{
object oPC = GetPCSpeaker();
int nAutoLevelup = GetLocalInt(GetModule(), "nAutoLevelup");
HireHenchman69(oPC);
if(nAutoLevelup == 1 && GetCanLevelUp69(oPC, OBJECT_SELF))
{
DelayCommand(1.0, LevelUpHenchman69(OBJECT_SELF, oPC, 1));
}
DelayCommand(10.5, ExecuteScript("_golemstats", OBJECT_SELF));
}

View File

@@ -0,0 +1,49 @@
// 69_hench_identify
// Henchman tries to identify all items in his and the player's inventory.
// Modified: 69MEH69 Sep2004
void IdentifyAll(object oObject, object oMaster);
void main()
{
object oPC = GetMaster(OBJECT_SELF);
IdentifyAll(oPC, oPC);
IdentifyAll(OBJECT_SELF, oPC);
}
void IdentifyAll(object oObject, object oPC)
{
int nMyLore = GetSkillRank(SKILL_LORE, OBJECT_SELF); // henchman lore rank
int nItemValue; // gold value of item
string sMaxValue = Get2DAString("SkillVsItemCost", "DeviceCostMax", nMyLore); // max value that the henchman can id
int nMaxValue = StringToInt(sMaxValue);
// * Handle overflow (November 2003 - BK)
if (sMaxValue == "")
{
nMaxValue = 120000000;
}
object oItem = GetFirstItemInInventory(oObject);
while(oItem != OBJECT_INVALID)
{
if(!GetIdentified(oItem))
{
SetIdentified(oItem, TRUE); // setting TRUE to get the true value of the item
nItemValue = GetGoldPieceValue(oItem);
SetIdentified(oItem, FALSE); // back to FALSE
if(nMaxValue >= nItemValue)
{
SetIdentified(oItem, TRUE);
SendMessageToPC(oPC, GetName(OBJECT_SELF) + " " + GetStringByStrRef(75930) + " " + GetName(oItem));
}
else
{
SendMessageToPC(oPC, "I cannot identify this item.");
}
}
oItem = GetNextItemInInventory(oObject);
}
}

View File

@@ -0,0 +1,18 @@
//::///////////////////////////////////////////////////
//:: 69_HENCH_INVEN
//:: Opens the henchman's inventory for the player.
//:: Copyright (c) 2002 Floodgate Entertainment
//:: Created By: Naomi Novik
//:: Created On: 01/24/2003
//:: Modified: 69MEH69 Sep2004
//::///////////////////////////////////////////////////
void main()
{
if (GetLocalInt(OBJECT_SELF, "HenchInv") == FALSE) //69MEH69
{
SpeakStringByStrRef(9066);
}
else
OpenInventory(OBJECT_SELF, GetPCSpeaker());
}

View File

@@ -0,0 +1,11 @@
// * Henchman levels up
#include "69_hench_lib"
void main()
{
object oPC = GetPCSpeaker();
if(GetCanLevelUp69(oPC, OBJECT_SELF))
{
LevelUpHenchman69(OBJECT_SELF, oPC);
}
}

1796
_module/nss/69_hench_lib.nss Normal file

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,15 @@
//:://////////////////////////////////////////////////
//:: 69_hench_notevil
/*
TRUE if the NPC is not evil.
*/
//:://////////////////////////////////////////////////
//:: Copyright (c) 2002 Floodgate Entertainment
//:: Created By: 69MEH69
//:: Created On: Sep2004
//:://////////////////////////////////////////////////
int StartingConditional()
{
return (GetAlignmentGoodEvil(OBJECT_SELF) != ALIGNMENT_EVIL);
}

View File

@@ -0,0 +1,77 @@
//Contributed by Mike Daneman aka. Mishenka
//Modified: 69MEH69 Added more items to pick up
#include "69_inc_henai"
void main()
{
object oMaster = GetMaster();
ClearAllActions();
SetAssociateState(NW_ASC_IS_BUSY);
int bFound = FALSE;
string sName;
location lCenter = GetLocation(OBJECT_SELF);
object oThing = GetFirstObjectInShape(SHAPE_SPHERE,15.0,lCenter,TRUE,OBJECT_TYPE_PLACEABLE | OBJECT_TYPE_ITEM);
while(GetIsObjectValid(oThing))
{
if(GetObjectType(oThing)==OBJECT_TYPE_ITEM)
{
bFound = TRUE;
/*switch(GetBaseItemType(oThing)) {
case BASE_ITEM_POTIONS:
case BASE_ITEM_HEALERSKIT:
case BASE_ITEM_SPELLSCROLL:
case BASE_ITEM_ARMOR:*/
sName = GetName(oThing);
TurnToFaceObject(oThing);
ActionPickUpItem(oThing);
ActionDoCommand(SendMessageToPC(oMaster,GetName(OBJECT_SELF)+" picked up "+sName+"."));
/*break;
default:
break;
}*/
}
else // oThing is a placeable
{
if(GetHasInventory(oThing)) // Containers (including corpses)
{
// Don't search locked containers
// Only search trapped containers if you can't see the trap
if(!GetLocked(oThing) && (!GetIsTrapped(oThing)
|| (GetIsTrapped(oThing) && !GetTrapDetectedBy(oThing,OBJECT_SELF))))
{
bFound = TRUE;
ActionMoveToObject(oThing);
ActionDoCommand(AssignCommand(oThing,PlayAnimation(ANIMATION_PLACEABLE_OPEN)));
//ActionInteractObject(oThing);
//ActionDoCommand(DoPlaceableObjectAction(oThing,PLACEABLE_ACTION_USE));
TurnToFaceObject(oThing);
ActionPlayAnimation(ANIMATION_LOOPING_GET_MID,1.0,3.0);
object oItem = GetFirstItemInInventory(oThing);
while(GetIsObjectValid(oItem))
{
/* switch(GetBaseItemType(oItem)) {
case BASE_ITEM_POTIONS:
case BASE_ITEM_HEALERSKIT:
case BASE_ITEM_SPELLSCROLL:
case BASE_ITEM_ARMOR:*/
ActionDoCommand(SendMessageToPC(oMaster,GetName(OBJECT_SELF)+" picked up "+GetName(oItem)+" from "+GetName(oThing)+"."));
ActionTakeItem(oItem,oThing);
/* break;
default:
break;
}*/
oItem = GetNextItemInInventory(oThing);
}
ActionDoCommand(AssignCommand(oThing,PlayAnimation(ANIMATION_PLACEABLE_CLOSE)));
}
}
} // else
oThing = GetNextObjectInShape(SHAPE_SPHERE,15.0,lCenter,TRUE,OBJECT_TYPE_PLACEABLE | OBJECT_TYPE_ITEM);
} // while(GetIsObjectValid(oThing))
ActionDoCommand(SetAssociateState(NW_ASC_IS_BUSY,FALSE));
if(!bFound)
SpeakString("I don't see where I can find any around here.");
}

View File

@@ -0,0 +1,21 @@
//:://////////////////////////////////////////////////
//:: 69_hench_quit
//:: Copyright (c) 2002 Floodgate Entertainment
//:://////////////////////////////////////////////////
/*
Actions taken when a henchman quits/refuses his/her current/former
master.
*/
//:://////////////////////////////////////////////////
//:: Created By: 69MEH69
//:: Created On: Apr2005
//:://////////////////////////////////////////////////
#include "69_hench_lib"
void main()
{
object oPC = GetPCSpeaker();
QuitHenchman69(oPC);
}

View File

@@ -0,0 +1,16 @@
//::///////////////////////////////////////////////
//:: FileName 69_hench_rangeno
//:://////////////////////////////////////////////
//:://////////////////////////////////////////////
//:: Created By: 69MEH69
//:: Created On: Oct2004
//:://////////////////////////////////////////////
#include "69_INC_HENAI"
int StartingConditional()
{
if(!GetCombatCondition(X0_COMBAT_FLAG_RANGED))
return TRUE;
return FALSE;
}

View File

@@ -0,0 +1,16 @@
//::///////////////////////////////////////////////
//:: FileName 69_hench_rangeye
//:://////////////////////////////////////////////
//:://////////////////////////////////////////////
//:: Created By: 69MEH69
//:: Created On: Oct2004
//:://////////////////////////////////////////////
#include "69_INC_HENAI"
int StartingConditional()
{
if(GetCombatCondition(X0_COMBAT_FLAG_RANGED))
return TRUE;
return FALSE;
}

View File

@@ -0,0 +1,23 @@
//69_hench_scout1 (no stealth)
//Henchman will scout enemies and
// attack at first sight
//Created by: 69MEH69 Sep2004
#include "69_inc_henai"
void main()
{
object oClosest = GetNearestCreature(CREATURE_TYPE_REPUTATION, REPUTATION_TYPE_ENEMY,
OBJECT_SELF, 1);
if (GetIsObjectValid(oClosest)) {
ClearAllActions();
SpeakString("Very well.");
SetLocalInt(OBJECT_SELF,"Scouting",TRUE);
SetLocalInt(OBJECT_SELF,"ScoutingReport",FALSE);
DelayCommand(2.0, SetLocalInt(OBJECT_SELF,"Scouting",FALSE));
SetLocalObject(OBJECT_SELF,"ScoutTarget",oClosest);
SetAssociateState(NW_ASC_MODE_DEFEND_MASTER, FALSE);
ActionForceFollowObject(oClosest,5.0);
} else
SetLocalInt(OBJECT_SELF,"Scouting",FALSE);
}

View File

@@ -0,0 +1,26 @@
//69_hench_scout2 (stealth)
//Henchman will go into stealth, scout enemies, and
// not attack until PC attacks
//Created by: 69MEH69 Sep2004
#include "69_inc_henai"
void main()
{
object oClosest = GetNearestCreature(CREATURE_TYPE_REPUTATION, REPUTATION_TYPE_ENEMY,
OBJECT_SELF, 1);
if (GetIsObjectValid(oClosest)) {
ClearAllActions();
SpeakString("Very well");
SetLocalInt(OBJECT_SELF,"Scouting",TRUE);
SetLocalInt(OBJECT_SELF,"ScoutingReport",FALSE);
SetLocalObject(OBJECT_SELF,"ScoutTarget",oClosest);
SetAssociateState(NW_ASC_MODE_DEFEND_MASTER);
SetLocalInt(OBJECT_SELF, "X2_HENCH_STEALTH_MODE", 2);
SetActionMode(OBJECT_SELF, ACTION_MODE_STEALTH, TRUE);
DelayCommand(3.0, ActionForceFollowObject(oClosest,10.0));
//DelayCommand(3.0, ActionForceMoveToObject(oClosest, FALSE, 10.0, 45.0f));
} else{
SetLocalInt(OBJECT_SELF,"Scouting",FALSE);
}
}

View File

@@ -0,0 +1,33 @@
//69_hench_switch
// Henchman is not in soley ranged attack mode
// Created by: 69MEH69 Oct2004
#include "69_INC_HENAI"
void main()
{
object oPC = GetPCSpeaker();
SetCombatCondition(X0_COMBAT_FLAG_RANGED, FALSE);
SetLocalInt(OBJECT_SELF, "COMBAT_FLAG_SWITCH", TRUE);
ActionSpeakString("Very well.");
int nClass = GetClassByPosition(1);
switch(nClass)
{
case CLASS_TYPE_BARBARIAN:
case CLASS_TYPE_FIGHTER:
case CLASS_TYPE_PALADIN:
if(HasMeleeWeapon69(OBJECT_SELF))
{
SetAssociateState(NW_ASC_USE_RANGED_WEAPON, FALSE);
bkEquipMelee(oPC);
}
break;
default:
if(HasRangedWeapon69(OBJECT_SELF))
{
SetAssociateState(NW_ASC_USE_RANGED_WEAPON, TRUE);
bkEquipRanged(oPC);
}
break;
}
}

View File

@@ -0,0 +1,16 @@
//::///////////////////////////////////////////////
//:: FileName 69_hench_switchno
//:://////////////////////////////////////////////
//:://////////////////////////////////////////////
//:: Created By: 69MEH69
//:: Created On: Oct2004
//:://////////////////////////////////////////////
#include "69_INC_HENAI"
int StartingConditional()
{
if(GetLocalInt(OBJECT_SELF, "COMBAT_FLAG_SWITCH"))
return FALSE;
return TRUE;
}

View File

@@ -0,0 +1,11 @@
//69_hench_whatxp
// NPC lets PC know how much XP s/he has
// Created by: 69MEH69 Oct2004
void main()
{
object oPC = GetPCSpeaker();
int nHenchXP = GetLocalInt(OBJECT_SELF, "HENCH_XP");
string sHenchXP = IntToString(nHenchXP);
SendMessageToPC(oPC, "I have " + sHenchXP + " experience points.");
}

View File

@@ -0,0 +1,7 @@
int StartingConditional()
{
int iResult;
iResult = 1-GetLocalInt(OBJECT_SELF,"Scouting");
return iResult;
}

1150
_module/nss/69_inc_henai.nss Normal file

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,240 @@
/*69_leadership
Leadership Library Functions
Created by: 69MEH69
Created on: Sep2004
*/
//void main(){}
//Level of PC when Leadership begins
const int LEADERSHIP_LEVEL = 6;
//Returns Loyalty modifier
int GetHenchLoyalty(object oHench, object oPC);
//Returns TRUE if PC has Leadership (must be level 6 or higher)
int GetHasLeadership(object oPC);
//Returns Leadership Score
int GetLeadershipScore(object oPC);
//Sets maximum number of henchmen based on Leadership
void SetMaxHenchmen69(object oPC);
//Returns maximum number of henchmen based on Leadership
int GetMaxHenchmen69(object oPC);
int GetHenchLoyalty(object oHench, object oPC)
{
int TEST_MODE = GetLocalInt(GetModule(), "TEST_MODE");
int nCharisma = GetAbilityModifier(ABILITY_CHARISMA, oPC);
//Initial roll + charisma
int nLoyalty = d6(3) + nCharisma;
string sLoyalty, sHenchdeath;
//Test
if(TEST_MODE == 1)
{
sLoyalty = IntToString(nLoyalty);
SendMessageToPC(oPC, "Initial nLoyalty = " + sLoyalty);
}
int nHenchAlign = GetAlignmentGoodEvil(oHench);
int nPCAlign = GetAlignmentGoodEvil(oPC);
int nHenchDeath = GetLocalInt(oPC, "Hench_Death");
//Adjustment for alignments
if(nHenchAlign == nPCAlign)
{
++nLoyalty;
}
else
{
--nLoyalty;
}
//Test
if(TEST_MODE == 1)
{
sLoyalty = IntToString(nLoyalty);
SendMessageToPC(oPC, "nLoyalty - Alignment = " + sLoyalty);
}
//Adjustment for number of dead henchmen
nLoyalty = nLoyalty - nHenchDeath;
//Test
if(TEST_MODE == 1)
{
sHenchdeath =IntToString(nHenchDeath);
sLoyalty = IntToString(nLoyalty);
SendMessageToPC(oPC, "Henchmen deaths = " + sHenchdeath);
SendMessageToPC(oPC, "nLoyalty - nHenchDeath = " + sLoyalty);
SendMessageToPC(oPC, "Loyalty score = " + sLoyalty);
}
return nLoyalty;
}
int GetHasLeadership(object oPC)
{
int TEST_MODE = GetLocalInt(GetModule(), "TEST_MODE");
int nLeadership = GetHitDice(oPC);
if(nLeadership >= LEADERSHIP_LEVEL)
{
//Test
if(TEST_MODE == 1)
{
SendMessageToPC(oPC, "Leadership is True");
}
return TRUE;
}
else
{
//Test
if(TEST_MODE == 1)
{
SendMessageToPC(oPC, "Leadership is False");
}
return FALSE;
}
}
int GetLeadershipScore(object oPC)
{
int TEST_MODE = GetLocalInt(GetModule(), "TEST_MODE");
int nPCLevel = GetHitDice(oPC);
int nCharisma = GetAbilityModifier(ABILITY_CHARISMA, oPC);
int nPersuade = GetSkillRank(SKILL_PERSUADE, oPC);
int nLeadershipScore = nPCLevel + nCharisma;
//Test
if(TEST_MODE == 1)
{
string sCharisma = IntToString(nCharisma);
SendMessageToPC(oPC, "Charisma score = " + sCharisma);
string sPersuade = IntToString(nPersuade);
SendMessageToPC(oPC, "Persuade score = " + sPersuade);
string sLeadershipScore = IntToString(nLeadershipScore);
SendMessageToPC(oPC, "Leadership score = " + sLeadershipScore);
}
return nLeadershipScore;
}
void SetMaxHenchmen69(object oPC)
{
int nLeadershipScore = GetLeadershipScore(oPC);
//Primary Code
if(GetHasLeadership(oPC) == FALSE)
{
SetLocalInt(oPC, "MaxHenchmen", 0);
}
else if(nLeadershipScore >= 25)
{
SetLocalInt(oPC, "MaxHenchmen", 10);
}
else if(nLeadershipScore >= 20)
{
SetLocalInt(oPC, "MaxHenchmen", 5);
}
else if(nLeadershipScore >= 15)
{
SetLocalInt(oPC, "MaxHenchmen", 4);
}
else if(nLeadershipScore >= 10)
{
SetLocalInt(oPC, "MaxHenchmen", 3);
}
else if(nLeadershipScore >= 8)
{
SetLocalInt(oPC, "MaxHenchmen", 2);
}
else if(nLeadershipScore >= 2)
{
SetLocalInt(oPC, "MaxHenchmen", 1);
}
else
{
SetLocalInt(oPC, "MaxHenchmen", 0);
}
//End Primary Code
//Secondary Code
//Uncomment following code to use this form
//Comment out the Primary Code
/*
if(GetHasLeadership(oPC) == FALSE)
{
SetLocalInt(oPC, "MaxHenchmen", 0);
return;
}
switch(nLeadershipScore)
{
case 0: case -1: case -2: case -3:
SetLocalInt(oPC, "MaxHenchmen", 0);
break;
case 1:
SetLocalInt(oPC, "MaxHenchmen", 1);
break;
case 2:
SetLocalInt(oPC, "MaxHenchmen", 1);
break;
case 3:
SetLocalInt(oPC, "MaxHenchmen", 1);
break;
case 4:
SetLocalInt(oPC, "MaxHenchmen", 2);
break;
case 5:
SetLocalInt(oPC, "MaxHenchmen", 2);
break;
case 6:
SetLocalInt(oPC, "MaxHenchmen", 2);
break;
case 7:
SetLocalInt(oPC, "MaxHenchmen", 3);
break;
case 8:
SetLocalInt(oPC, "MaxHenchmen", 3);
break;
case 9:
SetLocalInt(oPC, "MaxHenchmen", 3);
break;
case 10:
SetLocalInt(oPC, "MaxHenchmen", 4);
break;
case 11:
SetLocalInt(oPC, "MaxHenchmen", 4);
break;
case 12:
SetLocalInt(oPC, "MaxHenchmen", 4);
break;
case 13: case 14: case 15:
SetLocalInt(oPC, "MaxHenchmen", 5);
break;
case 16: case 17: case 18:
SetLocalInt(oPC, "MaxHenchmen", 6);
break;
default:
SetLocalInt(oPC, "MaxHenchmen", 7);
break;
}*/
//End Secondary Code
}
int GetMaxHenchmen69(object oPC)
{
int TEST_MODE = GetLocalInt(GetModule(), "TEST_MODE");
int nMaxHenchmen = GetLocalInt(oPC, "MaxHenchmen");
//Test
if(TEST_MODE == 1)
{
string sMaxHenchmen = IntToString(nMaxHenchmen);
SendMessageToPC(oPC, "Maximum allowable henchmen = " + sMaxHenchmen);
}
return nMaxHenchmen;
}

View File

@@ -0,0 +1,29 @@
void main()
{
object oHench = (OBJECT_SELF);
object oArmor = GetItemPossessedBy(oHench, "golemarmor");
object oHelmet = GetItemPossessedBy(oHench, "golemhelmet");
object oCloak = GetItemPossessedBy(oHench, "golemcloak");
object oAmulet = GetItemPossessedBy(oHench, "golemamulet");
object oBracer = GetItemPossessedBy(oHench, "golembracer");
object oRing1 = GetItemPossessedBy(oHench, "golemring");
object oRing2 = GetItemPossessedBy(oHench, "golemring2");
object oBoots = GetItemPossessedBy(oHench, "golemboots");
object oBelt = GetItemPossessedBy(oHench, "golembelt");
// Put on the armor
DelayCommand(0.5, AssignCommand(oHench, ActionEquipItem(oArmor, INVENTORY_SLOT_CHEST)));
DelayCommand(0.5, AssignCommand(oHench, ActionEquipItem(oHelmet, INVENTORY_SLOT_HEAD)));
DelayCommand(0.5, AssignCommand(oHench, ActionEquipItem(oCloak, INVENTORY_SLOT_CLOAK)));
DelayCommand(0.5, AssignCommand(oHench, ActionEquipItem(oAmulet, INVENTORY_SLOT_NECK)));
DelayCommand(0.5, AssignCommand(oHench, ActionEquipItem(oBracer, INVENTORY_SLOT_ARMS)));
DelayCommand(0.5, AssignCommand(oHench, ActionEquipItem(oRing1, INVENTORY_SLOT_LEFTRING)));
DelayCommand(0.5, AssignCommand(oHench, ActionEquipItem(oRing2, INVENTORY_SLOT_RIGHTRING)));
DelayCommand(0.5, AssignCommand(oHench, ActionEquipItem(oBoots, INVENTORY_SLOT_BOOTS)));
DelayCommand(0.5, AssignCommand(oHench, ActionEquipItem(oBelt, INVENTORY_SLOT_BELT)));
DelayCommand(10.5, ExecuteScript("_golemeqgear", OBJECT_SELF));
}

View File

@@ -0,0 +1,81 @@
void main()
{
effect eEffect = GetFirstEffect(OBJECT_SELF);
while(GetIsEffectValid(eEffect))
{
if(GetEffectTag(eEffect) == "BUFFS")
RemoveEffect(OBJECT_SELF, eEffect);
eEffect = GetNextEffect(OBJECT_SELF);
}
int nGolemHench = GetStringLeft(GetTag(OBJECT_SELF), 6) == "GOLEMH" ? TRUE : FALSE;
if(nGolemHench)
{
int iHenchHD = GetHitDice(OBJECT_SELF);
int iDeflection = iHenchHD / 2;
int iAbility = iHenchHD / 4;
effect eAC = EffectACIncrease(iDeflection, AC_DEFLECTION_BONUS, AC_VS_DAMAGE_TYPE_ALL);
eAC = ExtraordinaryEffect(eAC);
eAC = SupernaturalEffect(eAC);
ApplyEffectToObject(DURATION_TYPE_PERMANENT, eAC, OBJECT_SELF);
effect eSL = EffectDamageResistance(DAMAGE_TYPE_SLASHING, iDeflection, 0);
eSL = ExtraordinaryEffect(eSL);
eSL = SupernaturalEffect(eSL);
ApplyEffectToObject(DURATION_TYPE_PERMANENT, eSL, OBJECT_SELF);
effect eBL = EffectDamageResistance(DAMAGE_TYPE_BLUDGEONING, iDeflection, 0);
eBL = ExtraordinaryEffect(eBL);
eBL = SupernaturalEffect(eBL);
ApplyEffectToObject(DURATION_TYPE_PERMANENT, eBL, OBJECT_SELF);
effect eDR = EffectDamageResistance(DAMAGE_TYPE_PIERCING, iDeflection, 0);
eDR = ExtraordinaryEffect(eDR);
eDR = SupernaturalEffect(eDR);
ApplyEffectToObject(DURATION_TYPE_PERMANENT, eDR, OBJECT_SELF);
effect eSTR = EffectAbilityIncrease(ABILITY_STRENGTH, iAbility);
eSTR = ExtraordinaryEffect(eSTR);
eSTR = SupernaturalEffect(eSTR);
ApplyEffectToObject(DURATION_TYPE_PERMANENT, eSTR, OBJECT_SELF);
effect eCON = EffectAbilityIncrease(ABILITY_CONSTITUTION, iAbility);
eCON = ExtraordinaryEffect(eCON);
eCON = SupernaturalEffect(eCON);
ApplyEffectToObject(DURATION_TYPE_PERMANENT, eCON, OBJECT_SELF);
effect eDEX = EffectAbilityIncrease(ABILITY_DEXTERITY, iAbility);
eDEX = ExtraordinaryEffect(eDEX);
eDEX = SupernaturalEffect(eDEX);
ApplyEffectToObject(DURATION_TYPE_PERMANENT, eDEX, OBJECT_SELF);
effect eWIS = EffectAbilityIncrease(ABILITY_WISDOM, iAbility);
eWIS = ExtraordinaryEffect(eWIS);
eWIS = SupernaturalEffect(eWIS);
ApplyEffectToObject(DURATION_TYPE_PERMANENT, eWIS, OBJECT_SELF);
effect eINT = EffectAbilityIncrease(ABILITY_INTELLIGENCE, iAbility);
eINT = ExtraordinaryEffect(eINT);
eINT = SupernaturalEffect(eINT);
ApplyEffectToObject(DURATION_TYPE_PERMANENT, eINT, OBJECT_SELF);
effect eCHA = EffectAbilityIncrease(ABILITY_CHARISMA, iAbility);
eCHA = ExtraordinaryEffect(eCHA);
eCHA = SupernaturalEffect(eCHA);
ApplyEffectToObject(DURATION_TYPE_PERMANENT, eCHA, OBJECT_SELF);
eSTR = TagEffect(eSTR, "BUFFS");
eCHA = TagEffect(eCHA, "BUFFS");
eDEX = TagEffect(eDEX, "BUFFS");
eCON = TagEffect(eCON, "BUFFS");
eWIS = TagEffect(eWIS, "BUFFS");
eINT = TagEffect(eINT, "BUFFS");
eAC = TagEffect(eAC, "BUFFS");
eSL = TagEffect(eSL, "BUFFS");
eBL = TagEffect(eBL, "BUFFS");
eDR = TagEffect(eDR, "BUFFS");
}
}

View File

@@ -1,426 +1,412 @@
#include "prc_inc_racial"
void GivePCWands(object oPC)
{
// items to be give to new players
string sWndPCFollow = "dmfi_pc_follow";//PC Autofollow Widget
string sWndPCDice = "dmfi_pc_dicebag";//PC Dicebag
string sWndPCEmote = "dmfi_pc_emote";//PC Emote Wand
CreateItemOnObject(sWndPCFollow, oPC);
CreateItemOnObject(sWndPCDice, oPC);
CreateItemOnObject(sWndPCEmote, oPC);
}
void main()
{
object oPC = GetEnteringObject();
if(!GetIsPC(oPC)) return; // pc or dm check
//:: Don't run on DMs
if(!GetIsPC(oPC))
return; // pc or dm check
if(GetIsDM(oPC)==TRUE) return;
//:: Check for new character via XP
int iXP = GetXP(oPC);
if (iXP <1)
{
SetXP(oPC, 2);// set xp so script doesnt fire again on enter
///enter
object oArea = OBJECT_SELF;
AssignCommand(oPC, ClearAllActions());
ExploreAreaForPlayer(oArea, oPC);
//start
object oItem = GetFirstItemInInventory(oPC);
while(GetIsObjectValid(oItem))
{
// SetPlotFlag(oItem,FALSE);
DestroyObject(oItem);
oItem = GetNextItemInInventory(oPC);
}
///////////// equip players according to class
int iClass = GetClassByPosition (1, oPC);
if(iClass == CLASS_TYPE_BARBARIAN)
if (iXP < 1)
{
CreateItemOnObject("nw_it_torch001", oPC);
CreateItemOnObject("nw_waxgr001", oPC);
CreateItemOnObject("nw_waxhn001", oPC);
CreateItemOnObject("nw_aarcl008", oPC);
CreateItemOnObject("nw_it_medkit002", oPC);
CreateItemOnObject("nw_wthax001", oPC,9);
CreateItemOnObject("nw_it_mpotion020", oPC);
CreateItemOnObject("nw_it_mpotion020", oPC);
CreateItemOnObject("nw_it_mpotion020", oPC);
SendMessageToPC(oPC, "Barbarian EQ");
//:: Set xp so script doesn't fire again on enter
SetXP(oPC, 2);
AssignCommand(oPC, ClearAllActions());
ExploreAreaForPlayer(GetArea(oPC), oPC);
//:: Remove existing gear.
object oItem = GetFirstItemInInventory(oPC);
while(GetIsObjectValid(oItem))
{
SetPlotFlag(oItem,FALSE);
DestroyObject(oItem);
oItem = GetNextItemInInventory(oPC);
}
//:: Equip players according to starting class
int iClass = GetClassByPosition (1, oPC);
if(iClass == CLASS_TYPE_BARBARIAN)
{
CreateItemOnObject("nw_it_torch001", oPC, 2); //:: (2) Torches
CreateItemOnObject("nw_waxgr001", oPC); //:: Greataxe
CreateItemOnObject("nw_waxhn001", oPC); //:: Handaxe
CreateItemOnObject("nw_aarcl008", oPC); //:: Hide Armor
CreateItemOnObject("nw_it_medkit001", oPC, 2); //:: (2) Healer's Kit +1
CreateItemOnObject("nw_wthax001", oPC,9); //:: (9) Throwing Axes
CreateItemOnObject("nw_it_mpotion020", oPC); //:: Potion of Cure Moderate Wounds
CreateItemOnObject("nw_it_mpotion020", oPC); //:: Potion of Cure Moderate Wounds
CreateItemOnObject("nw_it_mpotion020", oPC); //:: Potion of Cure Moderate Wounds
SendMessageToPC(oPC, "Barbarian EQ");
}
if(iClass == CLASS_TYPE_TOTEMIST)
{
CreateItemOnObject("nw_it_torch001", oPC, 2); //:: (2) Torches
CreateItemOnObject("nw_it_mpotion020", oPC, 3); //:: (3) Potions of Cure Moderate Wounds
CreateItemOnObject("nw_aarcl002", oPC); //:: Studded Leather Armor
CreateItemOnObject("nw_ashlw001", oPC); //:: Large Shield
CreateItemOnObject("nw_wswdg001", oPC); //:: Dagger
CreateItemOnObject("x1_wmgrenade006", oPC,5); //:: (5) Tanglefoot Bags
CreateItemOnObject("nw_it_medkit001", oPC, 2); //:: (2) Healer's Kit +1
SendMessageToPC(oPC, "Totemist EQ");
}
if(iClass == CLASS_TYPE_BARD)
{
CreateItemOnObject("nw_aarcl001", oPC); //:: Leather Armor
CreateItemOnObject("nw_it_sparscr312", oPC); //:: Haste Scroll
CreateItemOnObject("nw_it_torch001", oPC, 2); //:: (2) Torches
CreateItemOnObject("nw_it_mpotion020", oPC, 3); //:: (3) Potions of Cure Moderate Wounds
CreateItemOnObject("nw_wbwxl001", oPC); //:: Light Crossbow
CreateItemOnObject("nw_wambo001", oPC,25); //:: (25) Wooden Bolts
CreateItemOnObject("nw_wswdg001", oPC); //:: Dagger
SendMessageToPC(oPC, "Bard EQ");
}
if(iClass == CLASS_TYPE_CLERIC || iClass == CLASS_TYPE_ARCHIVIST || iClass == CLASS_TYPE_FAVOURED_SOUL)
{
CreateItemOnObject("nw_it_torch001", oPC, 2); //:: (2) Torches
CreateItemOnObject("nw_it_mpotion020", oPC, 4); //:: (4) Potions of Cure Moderate Wounds
CreateItemOnObject("nw_wblml001", oPC); //:: Light Mace
CreateItemOnObject("nw_ashsw001", oPC); //:: Small Shield
CreateItemOnObject("nw_aarcl004", oPC); //:: Chain Mail
CreateItemOnObject("x1_wmgrenade005", oPC,5); //:: (5) Vials of Holy Water
SendMessageToPC(oPC, "Divine Servant EQ");
}
if(iClass == CLASS_TYPE_DRUID)
{
CreateItemOnObject("nw_it_torch001", oPC, 2); //:: (2) Torches
CreateItemOnObject("nw_it_mpotion020", oPC, 3); //:: (3) Potions of Cure Moderate Wounds
CreateItemOnObject("nw_wspmsc001", oPC); //:: Sickle
CreateItemOnObject("nw_ashsw001", oPC); //:: Small Shield
CreateItemOnObject("nw_aarcl001", oPC); //:: Leather Armor
CreateItemOnObject("nw_it_medkit001", oPC, 2); //:: (2) Healer's Kit +1
CreateItemOnObject("x1_wmgrenade006", oPC,5); //:: (5) Tanglefoot Bags
SendMessageToPC(oPC, "Druid EQ");
}
if(iClass == CLASS_TYPE_SOHEI)
{
CreateItemOnObject("nw_it_torch001", oPC, 2); //:: (2) Torches
CreateItemOnObject("nw_it_mpotion020", oPC, 3); //:: (3) Potions of Cure Moderate Wounds
CreateItemOnObject("nw_wswls001", oPC); //:: Longsword
CreateItemOnObject("nw_aarcl006", oPC); //:: Half Plate
CreateItemOnObject("nw_ashlw001", oPC); //:: Large Shield
CreateItemOnObject("nw_it_medkit001", oPC, 2); //:: (2) Healer's Kit +1
SendMessageToPC(oPC, "Sohei EQ");
}
if(iClass == CLASS_TYPE_SHAMAN)
{
CreateItemOnObject("nw_it_torch001", oPC, 2); //:: (2) Torches
CreateItemOnObject("nw_it_mpotion020", oPC, 3); //:: (3) Potions of Cure Moderate Wounds
CreateItemOnObject("nw_wswdg001", oPC); //:: Dagger
CreateItemOnObject("nw_wdbqs001", oPC); //:: Quarterstaff
CreateItemOnObject("nw_aarcl001", oPC); //:: Leather Armor
CreateItemOnObject("nw_it_medkit001", oPC, 2); //:: (2) Healer's Kits +1
CreateItemOnObject("x1_wmgrenade006", oPC,5); //:: (5) Tanglefoot Bags
SendMessageToPC(oPC, "Shaman EQ");
}
if(iClass == CLASS_TYPE_SAMURAI || iClass == CLASS_TYPE_CW_SAMURAI)
{
CreateItemOnObject("nw_it_torch001", oPC, 2); //:: (2) Torches
CreateItemOnObject("nw_it_mpotion020", oPC, 3); //:: (3) Potions of Cure Moderate Wounds
CreateItemOnObject("nw_wswka001", oPC); //:: Katana
CreateItemOnObject("nw_aarcl003", oPC); //:: Scale armor
CreateItemOnObject("nw_wswss001", oPC); //:: Short Sword
SendMessageToPC(oPC, "Samurai EQ");
}
if(iClass == CLASS_TYPE_FIGHTER || iClass == CLASS_TYPE_WARBLADE
|| iClass == CLASS_TYPE_DUSKBLADE
|| iClass == CLASS_TYPE_SOULBORN
|| iClass == CLASS_TYPE_PSYWAR
|| iClass == CLASS_TYPE_MARSHAL)
{
CreateItemOnObject("nw_it_torch001", oPC, 2); //:: (2) Torches
CreateItemOnObject("nw_it_mpotion020", oPC, 3); //:: (3) Potions of Cure Moderate Wounds
CreateItemOnObject("nw_wswls001", oPC); //:: Longsword
CreateItemOnObject("nw_aarcl011", oPC); //:: Banded Mail
CreateItemOnObject("nw_ashlw001", oPC); //:: Large Shield
CreateItemOnObject("nw_wswgs001", oPC); //:: Greatsword
CreateItemOnObject("nw_wswdg001", oPC); //:: Dagger
SendMessageToPC(oPC, "Warrior EQ");
}
if(iClass == CLASS_TYPE_KNIGHT)
{
CreateItemOnObject("nw_it_torch001", oPC, 2); //:: (2) Torches
CreateItemOnObject("nw_it_mpotion020", oPC, 3); //:: (3) Potions of Cure Moderate Wounds
CreateItemOnObject("nw_wswls001", oPC); //:: Longsword
CreateItemOnObject("nw_aarcl011", oPC); //:: Banded Mail
CreateItemOnObject("nw_ashlw001", oPC); //:: Large Shield
SendMessageToPC(oPC, "Knight EQ");
}
if(iClass == CLASS_TYPE_MONK)
{
CreateItemOnObject("nw_it_torch001", oPC, 2); //:: (2) Torches
CreateItemOnObject("nw_it_mpotion020", oPC, 3); //:: (3) Potions of Cure Moderate Wounds
CreateItemOnObject("nw_wspka001", oPC); //:: Kama
CreateItemOnObject("nw_wthsh001", oPC, 25); //:: (25) Shuriken
CreateItemOnObject("nw_mcloth018", oPC); //:: Robes of the Shining Hand +1
CreateItemOnObject("nw_it_medkit001", oPC, 2); //:: (2) Healer's Kit +1
SendMessageToPC(oPC, "Monk EQ");
}
if(iClass == CLASS_TYPE_PALADIN || iClass == CLASS_TYPE_CRUSADER)
{
CreateItemOnObject("nw_it_torch001", oPC, 2); //:: (2) Torches
CreateItemOnObject("nw_it_mpotion020", oPC, 3); //:: (3) Potions of Cure Moderate Wounds
CreateItemOnObject("nw_wswls001", oPC); //:: Longsword
CreateItemOnObject("nw_aarcl006", oPC); //:: Half Plate
CreateItemOnObject("nw_ashlw001", oPC); //:: Large Shield
CreateItemOnObject("nw_it_medkit001", oPC, 2); //:: (2) Healer's Kit +1
CreateItemOnObject("x1_wmgrenade005", oPC,5); //:: (5) Vials of Holy Water
SendMessageToPC(oPC, "Holy Warrior EQ");
}
if(iClass == CLASS_TYPE_SCOUT)
{
CreateItemOnObject("nw_it_torch001", oPC, 2); //:: (2) Torches
CreateItemOnObject("nw_it_mpotion020", oPC, 3); //:: (3) Potions of Cure Moderate Wounds
CreateItemOnObject("nw_aarcl001", oPC); //:: Leather Armor
CreateItemOnObject("nw_wbwsh001", oPC); //:: Short Bow
CreateItemOnObject("nw_wamar001", oPC,25); //:: (25) Arrows
CreateItemOnObject("nw_wamar001", oPC,25); //:: (25) Arrows
CreateItemOnObject("nw_wswdg001", oPC); //:: Dagger
SendMessageToPC(oPC, "Scout EQ");
}
if(iClass == CLASS_TYPE_RANGER)
{
CreateItemOnObject("nw_it_torch001", oPC, 2); //:: (2) Torches
CreateItemOnObject("nw_it_mpotion020", oPC, 3); //:: (3) Potions of Cure Moderate Wounds
CreateItemOnObject("nw_aarcl002", oPC); //:: Studded Leather Armor
CreateItemOnObject("nw_wbwln001", oPC); //:: Long bow
CreateItemOnObject("nw_wamar001", oPC,25); //:: (25) Arrows
CreateItemOnObject("nw_wswss001", oPC); //:: Short Sword
CreateItemOnObject("nw_wswdg001", oPC); //:: Dagger
SendMessageToPC(oPC, "Ranger EQ");
}
if(iClass == CLASS_TYPE_HEALER)
{
CreateItemOnObject("nw_it_torch001", oPC, 2); //:: (2) Torches
CreateItemOnObject("nw_it_mpotion020", oPC, 3); //:: (3) Potions of Cure Moderate Wounds
CreateItemOnObject("nw_it_medkit001", oPC, 3); //:: (3) Healer's Kits +1
CreateItemOnObject("nw_aarcl001", oPC); //:: Leather Armor
CreateItemOnObject("nw_wswdg001", oPC); //:: Dagger
CreateItemOnObject("nw_wdbqs001", oPC); //:: Quarterstaff
SendMessageToPC(oPC, "Healer EQ");
}
if(iClass == CLASS_TYPE_HEXBLADE)
{
CreateItemOnObject("nw_it_torch001", oPC, 2); //:: (2) Torches
CreateItemOnObject("nw_it_mpotion020", oPC, 3); //:: (3) Potions of Cure Moderate Wounds
CreateItemOnObject("x1_wmgrenade002", oPC,4); //:: (4) Alchemist's Fire
CreateItemOnObject("nw_aarcl002", oPC); //:: Studded Leather Armor
CreateItemOnObject("nw_wswsc001", oPC); //:: Scimitar
SendMessageToPC(oPC, "Hexblade EQ");
}
if(iClass == CLASS_TYPE_BINDER)
{
CreateItemOnObject("nw_it_torch001", oPC, 2); //:: (2) Torches
CreateItemOnObject("nw_it_mpotion020", oPC, 3); //:: (3) Potions of Cure Moderate Wounds
CreateItemOnObject("x1_wmgrenade003", oPC, 5); //:: (5) Caltrops
CreateItemOnObject("nw_aarcl001", oPC); //:: Leather Armor
CreateItemOnObject("nw_wswdg001", oPC); //:: Dagger
SendMessageToPC(oPC, "Binder EQ");
}
if(iClass == CLASS_TYPE_WARLOCK || iClass == CLASS_TYPE_DRAGONFIRE_ADEPT)
{
CreateItemOnObject("nw_it_torch001", oPC, 2); //:: (2) Torches
CreateItemOnObject("nw_it_mpotion020", oPC, 3); //:: (3) Potions of Cure Moderate Wounds
CreateItemOnObject("x1_wmgrenade001", oPC, 5); //:: (5) Acid Flasks
CreateItemOnObject("nw_aarcl002", oPC); //:: Studded Leather Armor
CreateItemOnObject("nw_wblms001", oPC); //:: Morning Star
SendMessageToPC(oPC, "Warlock EQ");
}
if(iClass == CLASS_TYPE_DRAGON_SHAMAN)
{
CreateItemOnObject("nw_it_torch001", oPC, 2); //:: (2) Torches
CreateItemOnObject("nw_it_mpotion020", oPC, 3); //:: (3) Potions of Cure Moderate Wounds
CreateItemOnObject("x1_wmgrenade007", oPC, 5); //:: (5) Thunderstones
CreateItemOnObject("nw_ashsw001", oPC); //:: Small Shield
CreateItemOnObject("nw_aarcl010", oPC); //:: Breastplate
CreateItemOnObject("nw_wblms001", oPC); //:: Morning Star
SendMessageToPC(oPC, "Dragonfire Shaman EQ");
}
if(iClass == CLASS_TYPE_WILDER)
{
CreateItemOnObject("nw_it_torch001", oPC, 2); //:: (2) Torches
CreateItemOnObject("nw_it_mpotion020", oPC, 3); //:: (3) Potions of Cure Moderate Wounds
CreateItemOnObject("x1_wmgrenade006", oPC, 3); //:: (3) Tanglefoot Bags
CreateItemOnObject("nw_ashsw001", oPC); //:: Small Shield
CreateItemOnObject("nw_aarcl001", oPC); //:: Leather Armor
CreateItemOnObject("nw_wblms001", oPC); //:: Morning Star
SendMessageToPC(oPC, "Wilder EQ");
}
if(iClass == CLASS_TYPE_WARMAGE)
{
CreateItemOnObject("nw_it_torch001", oPC, 2); //:: (2) Torches
CreateItemOnObject("nw_it_mpotion020", oPC, 3); //:: (3) Potions of Cure Moderate Wounds
CreateItemOnObject("x1_wmgrenade002", oPC, 4); //:: (4) Alchemist's Fire
CreateItemOnObject("nw_it_contain002", oPC); //:: Magic Pouch
CreateItemOnObject("x1_it_sparscr103", oPC); //:: Scroll of Shield
CreateItemOnObject("nw_it_sparscr202", oPC); //:: Scroll of Melf's Acid Arrow
CreateItemOnObject("nw_ashsw001", oPC); //:: Small Shield
CreateItemOnObject("nw_aarcl001", oPC); //:: Leather Armor
CreateItemOnObject("nw_wblms001", oPC); //:: Morning Star
SendMessageToPC(oPC, "Warmage EQ");
}
if(iClass == CLASS_TYPE_INCARNATE)
{
CreateItemOnObject("nw_it_torch001", oPC, 2); //:: (2) Torches
CreateItemOnObject("nw_it_mpotion020", oPC, 3); //:: (3) Potions of Cure Moderate Wounds
CreateItemOnObject("x1_wmgrenade006", oPC, 3); //:: (3) Tanglefoot Bags
CreateItemOnObject("nw_ashsw001", oPC); //:: Small Shield
CreateItemOnObject("nw_aarcl004", oPC); //:: Chain Mail
CreateItemOnObject("nw_wblms001", oPC); //:: Morning Star
SendMessageToPC(oPC, "Incarnate EQ");
}
if(iClass == CLASS_TYPE_SOULKNIFE)
{
CreateItemOnObject("nw_it_torch001", oPC, 2); //:: (2) Torches
CreateItemOnObject("nw_it_mpotion020", oPC, 3); //:: (3) Potions of Cure Moderate Wounds
CreateItemOnObject("x1_wmgrenade003", oPC,3); //:: (3) Caltrops
CreateItemOnObject("nw_ashlw001", oPC); //:: Large Shield
CreateItemOnObject("nw_aarcl001", oPC); //:: Leather Armor
CreateItemOnObject("nw_wswdg001", oPC); //:: Dagger
SendMessageToPC(oPC, "Soulknife EQ");
}
if(iClass == CLASS_TYPE_TRUENAMER)
{
CreateItemOnObject("nw_it_torch001", oPC, 2); //:: (2) Torches
CreateItemOnObject("nw_it_mpotion020", oPC, 3); //:: (3) Potions of Cure Moderate Wounds
CreateItemOnObject("x1_wmgrenade002", oPC,3); //:: (3) Alchemist's Fire
CreateItemOnObject("nw_aarcl001", oPC); //:: Leather Armor
CreateItemOnObject("nw_wswdg001", oPC); //:: Dagger
SendMessageToPC(oPC, "Truenamer EQ");
}
if(iClass == CLASS_TYPE_TOTEMIST)
{
CreateItemOnObject("nw_it_torch001", oPC, 2); //:: (2) Torches
CreateItemOnObject("nw_it_mpotion020", oPC, 3); //:: (3) Potions of Cure Moderate Wounds
CreateItemOnObject("x1_wmgrenade001", oPC,3); //:: (3) Acid Flasks
CreateItemOnObject("nw_aarcl001", oPC); //:: Leather Armor
CreateItemOnObject("nw_wswdg001", oPC); //:: Dagger
CreateItemOnObject("nw_ashsw001", oPC); //:: Small Shield
SendMessageToPC(oPC, "Totemist EQ");
}
if(iClass == CLASS_TYPE_SWASHBUCKLER)
{
CreateItemOnObject("nw_it_torch001", oPC, 2); //:: (2) Torches
CreateItemOnObject("nw_it_mpotion020", oPC, 3); //:: (3) Potions of Cure Moderate Wounds
CreateItemOnObject("x1_wmgrenade003", oPC,3); //:: (3) Caltrops
CreateItemOnObject("nw_aarcl001", oPC); //:: Leather Armor
CreateItemOnObject("nw_wswdg001", oPC); //:: Dagger
CreateItemOnObject("nw_wswrp001", oPC); //:: Rapier
SendMessageToPC(oPC, "Swashbuckler EQ");
}
if(iClass == CLASS_TYPE_SWORDSAGE)
{
CreateItemOnObject("nw_it_torch001", oPC, 2); //:: (2) Torches
CreateItemOnObject("nw_it_mpotion020", oPC, 3); //:: (3) Potions of Cure Moderate Wounds
CreateItemOnObject("x1_wmgrenade004", oPC,3); //:: (3) Choking Powder
CreateItemOnObject("nw_aarcl001", oPC); //:: Leather Armor
CreateItemOnObject("nw_wswls001", oPC); //:: Longsword
SendMessageToPC(oPC, "Swordsage EQ");
}
if(iClass == CLASS_TYPE_ROGUE || iClass == CLASS_TYPE_BEGUILER
|| iClass == CLASS_TYPE_PSYCHIC_ROGUE
|| iClass == CLASS_TYPE_NINJA
|| iClass == CLASS_TYPE_FACTOTUM)
{
CreateItemOnObject("nw_it_torch001", oPC, 2); //:: (2) Torches
CreateItemOnObject("nw_it_mpotion020", oPC, 3); //:: (3) Potions of Cure Moderate Wounds
CreateItemOnObject("x1_wmgrenade003", oPC, 5); //:: (5) Caltrops
CreateItemOnObject("nw_aarcl001", oPC); //:: Leather Armor
CreateItemOnObject("nw_it_picks001", oPC, 2); //:: (2) Lock Picks +1
CreateItemOnObject("nw_it_trap001", oPC); //:: Minor Spike Trap Kit
CreateItemOnObject("nw_wswss001", oPC); //:: Short Sword
CreateItemOnObject("nw_wswdg001", oPC); //:: Dagger
SendMessageToPC(oPC, "Rogue EQ");
}
if(iClass == CLASS_TYPE_DREAD_NECROMANCER)
{
CreateItemOnObject("nw_it_torch001", oPC, 2); //:: (2) Torches
CreateItemOnObject("nw_it_mpotion020", oPC, 3); //:: (3) Potions of Cure Moderate Wounds
CreateItemOnObject("x1_wmgrenade004", oPC,3); //:: (3) Choking Powder
CreateItemOnObject("nw_wblms001", oPC); //:: Morning Star
CreateItemOnObject("nw_aarcl002", oPC); //:: Studded Leather Armor
SendMessageToPC(oPC, "Dread Necromancer EQ");
}
if(iClass == CLASS_TYPE_PSION)
{
CreateItemOnObject("nw_it_torch001", oPC, 2); //:: (2) Torches
CreateItemOnObject("nw_it_mpotion020", oPC, 3); //:: (3) Potions of Cure Moderate Wounds
CreateItemOnObject("nw_wdbqs001", oPC); //:: Quarterstaff
CreateItemOnObject("nw_cloth005", oPC); //:: Wizard's Robe
CreateItemOnObject("nw_it_contain002", oPC); //:: Magic Pouch
SendMessageToPC(oPC, "Psion EQ");
}
if(iClass == CLASS_TYPE_WIZARD || iClass == CLASS_TYPE_SORCERER || iClass == CLASS_TYPE_SHADOWCASTER)
{
CreateItemOnObject("nw_it_torch001", oPC, 2); //:: (2) Torches
CreateItemOnObject("nw_it_mpotion020", oPC, 3); //:: (3) Potions of Cure Moderate Wounds
CreateItemOnObject("nw_wdbqs001", oPC); //:: Quarterstaff
CreateItemOnObject("nw_cloth005", oPC); //:: Wizard's Robe
CreateItemOnObject("nw_it_contain002", oPC); //:: Magic Pouch
CreateItemOnObject("x1_it_sparscr103", oPC); //:: Scroll of Shield
CreateItemOnObject("nw_it_sparscr202", oPC); //:: Scroll of Melf's Acid Arrow
CreateItemOnObject("nw_it_sparscr107", oPC); //:: Scroll of Charm Person
CreateItemOnObject("nw_it_sparscr106", oPC); //:: Scroll of Identify
SendMessageToPC(oPC, "Arcane EQ");
}
//:: Give PC DMFI gear
GivePCWands(oPC);
//:: Equip Armor
DelayCommand(0.0f, ClearAllActions());
DelayCommand(0.0f, ActionEquipMostEffectiveArmor());
}
if(iClass == CLASS_TYPE_BARD)
{
CreateItemOnObject("nw_aarcl009", oPC);
CreateItemOnObject("nw_it_sparscr312", oPC);
CreateItemOnObject("nw_it_sparscr202 ", oPC);
CreateItemOnObject("nw_it_torch001", oPC);
CreateItemOnObject("nw_it_mpotion020", oPC);
CreateItemOnObject("nw_it_mpotion020", oPC);
CreateItemOnObject("nw_it_mpotion020", oPC);
CreateItemOnObject("nw_wbwxl001", oPC);
CreateItemOnObject("nw_wambo001", oPC,25);
CreateItemOnObject("nw_wswdg001", oPC);
SendMessageToPC(oPC, "Bard EQ");
}
if(iClass == CLASS_TYPE_CLERIC || iClass == CLASS_TYPE_ARCHIVIST || iClass == CLASS_TYPE_FAVOURED_SOUL)
{
CreateItemOnObject("nw_it_torch001", oPC);
CreateItemOnObject("nw_it_mpotion020", oPC);
CreateItemOnObject("nw_it_mpotion020", oPC);
CreateItemOnObject("nw_it_mpotion020", oPC);
CreateItemOnObject("nw_it_mpotion020", oPC);
CreateItemOnObject("nw_it_mpotion020", oPC);
CreateItemOnObject("nw_wblml001", oPC);
CreateItemOnObject("nw_ashsw001", oPC);
CreateItemOnObject("nw_aarcl004", oPC);
CreateItemOnObject("x1_wmgrenade005", oPC,9);
SendMessageToPC(oPC, "Cleric EQ");
}
if(iClass == CLASS_TYPE_DRUID)
{
CreateItemOnObject("nw_it_torch001", oPC);
CreateItemOnObject("nw_it_mpotion020", oPC);
CreateItemOnObject("nw_it_mpotion020", oPC);
CreateItemOnObject("nw_it_mpotion020", oPC);
CreateItemOnObject("nw_wspmsc002", oPC);
CreateItemOnObject("nw_aarcl001", oPC);
CreateItemOnObject("nw_it_medkit002", oPC);
CreateItemOnObject("x1_wmgrenade006", oPC,9);
SendMessageToPC(oPC, "Druid EQ");
}
if(iClass == CLASS_TYPE_SOHEI)
{
CreateItemOnObject("nw_it_torch001", oPC);
CreateItemOnObject("nw_it_mpotion020", oPC);
CreateItemOnObject("nw_it_mpotion020", oPC);
CreateItemOnObject("nw_it_mpotion020", oPC);
CreateItemOnObject("nw_wswdg001", oPC);
CreateItemOnObject("nw_wswss001", oPC);
CreateItemOnObject("nw_aarcl001", oPC);
CreateItemOnObject("nw_it_medkit002", oPC, 2);
CreateItemOnObject("x1_wmgrenade006", oPC, 2);
SendMessageToPC(oPC, "Sohei EQ");
}
if(iClass == CLASS_TYPE_SHAMAN)
{
CreateItemOnObject("nw_it_torch001", oPC);
CreateItemOnObject("nw_it_mpotion020", oPC);
CreateItemOnObject("nw_it_mpotion020", oPC);
CreateItemOnObject("nw_it_mpotion020", oPC);
CreateItemOnObject("nw_wswdg001", oPC);
CreateItemOnObject("nw_wdbqs001", oPC);
CreateItemOnObject("nw_aarcl001", oPC);
CreateItemOnObject("nw_it_medkit002", oPC, 2);
CreateItemOnObject("x1_wmgrenade006", oPC, 2);
SendMessageToPC(oPC, "Shaman EQ");
}
if(iClass == CLASS_TYPE_SAMURAI || iClass == CLASS_TYPE_CW_SAMURAI)
{
CreateItemOnObject("nw_it_torch001", oPC);
CreateItemOnObject("nw_it_mpotion020", oPC);
CreateItemOnObject("nw_it_mpotion020", oPC);
CreateItemOnObject("nw_it_mpotion020", oPC);
if (iClass != CLASS_TYPE_SAMURAI) {CreateItemOnObject("nw_wswka001", oPC);} // Katana
CreateItemOnObject("nw_aarcl003", oPC); // Scale armor
CreateItemOnObject("nw_wswgs001", oPC); // Shortsword
SendMessageToPC(oPC, "Samurai EQ");
}
if(iClass == CLASS_TYPE_FIGHTER || iClass == CLASS_TYPE_WARBLADE
|| iClass == CLASS_TYPE_CRUSADER
|| iClass == CLASS_TYPE_DUSKBLADE
|| iClass == CLASS_TYPE_SOULBORN
|| iClass == CLASS_TYPE_MARSHAL)
{
CreateItemOnObject("nw_it_torch001", oPC);
CreateItemOnObject("nw_it_mpotion020", oPC);
CreateItemOnObject("nw_it_mpotion020", oPC);
CreateItemOnObject("nw_it_mpotion020", oPC);
CreateItemOnObject("nw_wswls001", oPC);
CreateItemOnObject("nw_aarcl011", oPC);
CreateItemOnObject("nw_ashlw001", oPC);
CreateItemOnObject("nw_wswgs001", oPC);
CreateItemOnObject("nw_wswdg001", oPC);
SendMessageToPC(oPC, "Warrior EQ");
}
if(iClass == CLASS_TYPE_KNIGHT)
{
CreateItemOnObject("nw_it_torch001", oPC);
CreateItemOnObject("nw_it_mpotion020", oPC);
CreateItemOnObject("nw_it_mpotion020", oPC);
CreateItemOnObject("nw_it_mpotion020", oPC);
CreateItemOnObject("nw_wswls001", oPC);
CreateItemOnObject("nw_aarcl011", oPC);
CreateItemOnObject("nw_ashlw001", oPC);
SendMessageToPC(oPC, "Knight EQ");
}
if(iClass == CLASS_TYPE_MONK)
{
CreateItemOnObject("nw_it_torch001", oPC);
CreateItemOnObject("nw_it_mpotion020", oPC);
CreateItemOnObject("nw_it_mpotion020", oPC);
CreateItemOnObject("nw_it_mpotion020", oPC);
CreateItemOnObject("nw_wspka001", oPC);
CreateItemOnObject("nw_wthsh001", oPC,25);
CreateItemOnObject("nw_mcloth018", oPC);
CreateItemOnObject("nw_it_medkit002", oPC);
SendMessageToPC(oPC, "Monk EQ");
}
if(iClass == CLASS_TYPE_PALADIN)
{
CreateItemOnObject("nw_it_torch001", oPC);
CreateItemOnObject("nw_it_mpotion020", oPC);
CreateItemOnObject("nw_it_mpotion020", oPC);
CreateItemOnObject("nw_it_mpotion020", oPC);
CreateItemOnObject("nw_wswls001", oPC);
CreateItemOnObject("nw_aarcl006", oPC);
CreateItemOnObject("nw_ashlw001", oPC);
CreateItemOnObject("nw_it_medkit002", oPC);
SendMessageToPC(oPC, "Paladin EQ");
}
if(iClass == CLASS_TYPE_SCOUT)
{
CreateItemOnObject("nw_it_torch001", oPC);
CreateItemOnObject("nw_it_mpotion020", oPC);
CreateItemOnObject("nw_it_mpotion020", oPC);
CreateItemOnObject("nw_it_mpotion020", oPC);
CreateItemOnObject("nw_aarcl001", oPC);
CreateItemOnObject("nw_wbwsh001", oPC);
CreateItemOnObject("nw_wamar001", oPC,25);
CreateItemOnObject("nw_wamar001", oPC,25);
CreateItemOnObject("nw_wswdg001", oPC);
SendMessageToPC(oPC, "Scout EQ");
}
if(iClass == CLASS_TYPE_RANGER)
{
CreateItemOnObject("nw_it_torch001", oPC);
CreateItemOnObject("nw_it_mpotion020", oPC);
CreateItemOnObject("nw_it_mpotion020", oPC);
CreateItemOnObject("nw_it_mpotion020", oPC);
CreateItemOnObject("nw_aarcl001", oPC);
CreateItemOnObject("nw_wbwsh001", oPC);
CreateItemOnObject("nw_wamar001", oPC,25);
CreateItemOnObject("nw_wswss001", oPC);
CreateItemOnObject("nw_wswdg001", oPC);
SendMessageToPC(oPC, "Ranger EQ");
}
if(iClass == CLASS_TYPE_HEALER)
{
CreateItemOnObject("nw_it_torch001", oPC);
CreateItemOnObject("nw_it_mpotion020", oPC);
CreateItemOnObject("nw_it_mpotion020", oPC,2);
CreateItemOnObject("nw_it_medkit001", oPC,2);
CreateItemOnObject("nw_aarcl001", oPC);
CreateItemOnObject("nw_wswdg001", oPC);
SendMessageToPC(oPC, "Healer EQ");
}
if(iClass == CLASS_TYPE_HEXBLADE)
{
CreateItemOnObject("nw_it_torch001", oPC);
CreateItemOnObject("nw_it_mpotion020", oPC);
CreateItemOnObject("nw_it_mpotion020", oPC,2);
CreateItemOnObject("x1_wmgrenade002", oPC,4);
CreateItemOnObject("nw_aarcl001", oPC);
CreateItemOnObject("nw_wswsc001", oPC);
SendMessageToPC(oPC, "Hexblade EQ");
}
if(iClass == CLASS_TYPE_BINDER)
{
CreateItemOnObject("nw_it_torch001", oPC);
CreateItemOnObject("nw_it_mpotion020", oPC);
CreateItemOnObject("nw_it_mpotion020", oPC,2);
CreateItemOnObject("x1_wmgrenade003", oPC,9);
CreateItemOnObject("nw_aarcl001", oPC);
CreateItemOnObject("nw_wswdg001", oPC);
SendMessageToPC(oPC, "Binder EQ");
}
if(iClass == CLASS_TYPE_WARLOCK || iClass == CLASS_TYPE_DRAGONFIRE_ADEPT)
{
CreateItemOnObject("nw_it_torch001", oPC);
CreateItemOnObject("nw_it_mpotion020", oPC);
CreateItemOnObject("nw_it_mpotion020", oPC, 2);
CreateItemOnObject("x1_wmgrenade006", oPC, 3);
CreateItemOnObject("nw_aarcl001", oPC); // Leather Mail
CreateItemOnObject("nw_wblms001", oPC); // Morning Star
SendMessageToPC(oPC, "Warlock EQ");
}
if(iClass == CLASS_TYPE_DRAGON_SHAMAN)
{
CreateItemOnObject("nw_it_torch001", oPC);
CreateItemOnObject("nw_it_mpotion020", oPC);
CreateItemOnObject("nw_it_mpotion020", oPC, 2);
CreateItemOnObject("x1_wmgrenade006", oPC, 3);
CreateItemOnObject("nw_ashsw001", oPC); // Small Shield
CreateItemOnObject("nw_aarcl006", oPC); // Chain mail
CreateItemOnObject("nw_wblms001", oPC); // Morning Star
SendMessageToPC(oPC, "Dragonfire Shaman EQ");
}
if(iClass == CLASS_TYPE_WILDER)
{
CreateItemOnObject("nw_it_torch001", oPC);
CreateItemOnObject("nw_it_mpotion020", oPC);
CreateItemOnObject("nw_it_mpotion020", oPC, 2);
CreateItemOnObject("x1_wmgrenade006", oPC, 3);
CreateItemOnObject("nw_ashsw001", oPC); // Small Shield
CreateItemOnObject("nw_aarcl001", oPC); // Leather Mail
CreateItemOnObject("nw_wblms001", oPC); // Morning Star
SendMessageToPC(oPC, "Wilder EQ");
}
if(iClass == CLASS_TYPE_WARMAGE)
{
CreateItemOnObject("nw_it_torch001", oPC);
CreateItemOnObject("nw_it_mpotion020", oPC);
CreateItemOnObject("nw_it_mpotion020", oPC, 2);
CreateItemOnObject("x1_wmgrenade005", oPC, 3);
CreateItemOnObject("nw_it_contain002", oPC);
CreateItemOnObject("x1_it_sparscr103", oPC);
CreateItemOnObject("nw_it_sparscr202", oPC);
CreateItemOnObject("nw_ashsw001", oPC); // Small Shield
CreateItemOnObject("nw_aarcl001", oPC); // Leather Mail
CreateItemOnObject("nw_wblms001", oPC); // Morning Star
SendMessageToPC(oPC, "Warmage EQ");
}
if(iClass == CLASS_TYPE_INCARNATE)
{
CreateItemOnObject("nw_it_torch001", oPC);
CreateItemOnObject("nw_it_mpotion020", oPC);
CreateItemOnObject("nw_it_mpotion020", oPC, 2);
CreateItemOnObject("x1_wmgrenade006", oPC, 3);
CreateItemOnObject("nw_aarcl004", oPC); // Chain Mail
CreateItemOnObject("nw_wblms001", oPC); // Morning Star
SendMessageToPC(oPC, "Incarnate EQ");
}
if(iClass == CLASS_TYPE_SOULKNIFE)
{
CreateItemOnObject("nw_it_torch001", oPC);
CreateItemOnObject("nw_it_mpotion020", oPC);
CreateItemOnObject("nw_it_mpotion020", oPC,2);
CreateItemOnObject("x1_wmgrenade003", oPC,3);
CreateItemOnObject("nw_ashlw001", oPC);
CreateItemOnObject("nw_aarcl001", oPC);
SendMessageToPC(oPC, "Soulknife EQ");
}
if(iClass == CLASS_TYPE_TRUENAMER)
{
CreateItemOnObject("nw_it_torch001", oPC);
CreateItemOnObject("nw_it_mpotion020", oPC);
CreateItemOnObject("nw_it_mpotion020", oPC,3);
CreateItemOnObject("x1_wmgrenade002", oPC,3);
CreateItemOnObject("nw_aarcl001", oPC);
CreateItemOnObject("nw_wswdg001", oPC);
SendMessageToPC(oPC, "Truenamer EQ");
}
if(iClass == CLASS_TYPE_TOTEMIST)
{
CreateItemOnObject("nw_it_torch001", oPC);
CreateItemOnObject("nw_it_mpotion020", oPC);
CreateItemOnObject("nw_it_mpotion020", oPC,2);
CreateItemOnObject("x1_wmgrenade001", oPC,3);
CreateItemOnObject("nw_aarcl001", oPC);
CreateItemOnObject("nw_wswdg001", oPC);
CreateItemOnObject("nw_ashsw001", oPC);
SendMessageToPC(oPC, "Totemist EQ");
}
if(iClass == CLASS_TYPE_SWASHBUCKLER)
{
CreateItemOnObject("nw_it_torch001", oPC);
CreateItemOnObject("nw_it_mpotion020", oPC);
CreateItemOnObject("nw_it_mpotion020", oPC,2);
CreateItemOnObject("x1_wmgrenade003", oPC,3);
CreateItemOnObject("nw_aarcl001", oPC);
CreateItemOnObject("nw_wswdg001", oPC);
CreateItemOnObject("nw_wswrp001", oPC);
SendMessageToPC(oPC, "Swashbuckler EQ");
}
if(iClass == CLASS_TYPE_SWORDSAGE)
{
CreateItemOnObject("nw_it_torch001", oPC);
CreateItemOnObject("nw_it_mpotion020", oPC);
CreateItemOnObject("nw_it_mpotion020", oPC,2);
CreateItemOnObject("x1_wmgrenade004", oPC,3);
CreateItemOnObject("nw_aarcl001", oPC);
CreateItemOnObject("nw_wswls001", oPC);
SendMessageToPC(oPC, "Swordsage EQ");
}
if(iClass == CLASS_TYPE_ROGUE || iClass == CLASS_TYPE_BEGUILER
|| iClass == CLASS_TYPE_PSYCHIC_ROGUE
|| iClass == CLASS_TYPE_FACTOTUM)
{
CreateItemOnObject("nw_it_torch001", oPC);
CreateItemOnObject("nw_it_mpotion020", oPC);
CreateItemOnObject("nw_it_mpotion020", oPC,2);
CreateItemOnObject("x1_wmgrenade003", oPC,9);
CreateItemOnObject("nw_aarcl001", oPC);
CreateItemOnObject("nw_it_picks002", oPC);
CreateItemOnObject("nw_it_trap001", oPC);
CreateItemOnObject("nw_wswss001", oPC);
CreateItemOnObject("nw_wswdg001", oPC);
SendMessageToPC(oPC, "Rogue EQ");
}
if(iClass == CLASS_TYPE_SORCERER || iClass == CLASS_TYPE_DREAD_NECROMANCER || iClass == CLASS_TYPE_SHADOWCASTER )
{
CreateItemOnObject("nw_it_torch001", oPC);
CreateItemOnObject("nw_it_mpotion020", oPC);
CreateItemOnObject("nw_it_mpotion020", oPC);
CreateItemOnObject("nw_it_mpotion020", oPC);
CreateItemOnObject("nw_wswdg001", oPC);
CreateItemOnObject("nw_wthdt001", oPC,9);
CreateItemOnObject("nw_cloth008", oPC);//robe
CreateItemOnObject("nw_it_contain002", oPC);
CreateItemOnObject("x1_it_sparscr103", oPC);
CreateItemOnObject("nw_it_sparscr202", oPC);
SendMessageToPC(oPC, "Sorcerer EQ");
}
if(iClass == CLASS_TYPE_PSION)
{
CreateItemOnObject("nw_it_torch001", oPC);
CreateItemOnObject("nw_it_mpotion020", oPC);
CreateItemOnObject("nw_it_mpotion020", oPC);
CreateItemOnObject("nw_it_mpotion020", oPC);
CreateItemOnObject("nw_wdbqs001", oPC);
CreateItemOnObject("nw_cloth005", oPC);//robe
CreateItemOnObject("nw_it_contain002", oPC);
SendMessageToPC(oPC, "Psion EQ");
}
if(iClass == CLASS_TYPE_WIZARD)
{
CreateItemOnObject("nw_it_torch001", oPC);
CreateItemOnObject("nw_it_mpotion020", oPC);
CreateItemOnObject("nw_it_mpotion020", oPC);
CreateItemOnObject("nw_it_mpotion020", oPC);
CreateItemOnObject("nw_wdbqs001", oPC);
CreateItemOnObject("nw_cloth005", oPC);//robe
CreateItemOnObject("nw_it_contain002", oPC);
CreateItemOnObject("x1_it_sparscr103", oPC);
CreateItemOnObject("nw_it_sparscr202", oPC);
CreateItemOnObject("nw_it_sparscr107", oPC);
CreateItemOnObject("nw_it_sparscr106", oPC);
SendMessageToPC(oPC, "Wizard EQ");
}
}
//end of script
}
}

View File

@@ -165,14 +165,14 @@ void sp_ModInit()
// Animations
SetLocalInt(OBJECT_SELF, "anim01", ANIMATION_FIREFORGET_BOW);
SetLocalInt(OBJECT_SELF, "anim02", ANIMATION_FIREFORGET_DRINK);
SetLocalInt(OBJECT_SELF, "anim03", ANIMATION_FIREFORGET_GREETING);
SetLocalInt(OBJECT_SELF, "anim03", ANIMATION_FIREFORGET_HEAD_TURN_RIGHT);
SetLocalInt(OBJECT_SELF, "anim04", ANIMATION_FIREFORGET_HEAD_TURN_LEFT);
SetLocalInt(OBJECT_SELF, "anim05", ANIMATION_FIREFORGET_HEAD_TURN_RIGHT);
SetLocalInt(OBJECT_SELF, "anim06", ANIMATION_FIREFORGET_PAUSE_BORED);
SetLocalInt(OBJECT_SELF, "anim05", ANIMATION_FIREFORGET_PAUSE_BORED);
SetLocalInt(OBJECT_SELF, "anim06", ANIMATION_FIREFORGET_DODGE_SIDE);
SetLocalInt(OBJECT_SELF, "anim07", ANIMATION_FIREFORGET_PAUSE_SCRATCH_HEAD);
SetLocalInt(OBJECT_SELF, "anim08", ANIMATION_FIREFORGET_READ);
SetLocalInt(OBJECT_SELF, "anim09", ANIMATION_FIREFORGET_STEAL);
SetLocalInt(OBJECT_SELF, "anim11", ANIMATION_FIREFORGET_TAUNT);
SetLocalInt(OBJECT_SELF, "anim11", ANIMATION_FIREFORGET_GREETING);
SetLocalInt(OBJECT_SELF, "anim12", ANIMATION_FIREFORGET_VICTORY1);
SetLocalInt(OBJECT_SELF, "anim13", ANIMATION_FIREFORGET_VICTORY2);
SetLocalInt(OBJECT_SELF, "anim14", ANIMATION_FIREFORGET_VICTORY3);

View File

@@ -0,0 +1,4 @@
void main()
{
SetLocalInt(OBJECT_SELF, "Deekin_Spell_Cast", SPELL_FLAME_WEAPON);
}

View File

@@ -0,0 +1,4 @@
void main()
{
SetLocalInt(OBJECT_SELF, "Deekin_Spell_Cast", SPELL_MASS_HEAL);
}

View File

@@ -0,0 +1,4 @@
void main()
{
SetLocalInt(OBJECT_SELF, "Deekin_Spell_Cast", SPELL_TENSERS_TRANSFORMATION);
}

View File

@@ -0,0 +1,4 @@
void main()
{
SetLocalInt(OBJECT_SELF, "Deekin_Spell_Cast", SPELL_TENSERS_TRANSFORMATION);
}

View File

@@ -0,0 +1,11 @@
//::Distancecheck2
//::BY: Xovian
#include "nw_i0_generic"
int StartingConditional()
{
if(GetAssociateState(NW_ASC_DISTANCE_2_METERS)&&(GetAssociateState(NW_ASC_DISTANCE_4_METERS)==FALSE)&&(GetAssociateState(NW_ASC_DISTANCE_6_METERS)==FALSE))
{
return FALSE;
}
return TRUE;
}

View File

@@ -0,0 +1,11 @@
//::Distancecheck4
//::BY: Xovian
#include "nw_i0_generic"
int StartingConditional()
{
if(GetAssociateState(NW_ASC_DISTANCE_4_METERS)&&(GetAssociateState(NW_ASC_DISTANCE_2_METERS)==FALSE)&&(GetAssociateState(NW_ASC_DISTANCE_6_METERS)==FALSE))
{
return FALSE;
}
return TRUE;
}

View File

@@ -0,0 +1,11 @@
//::Distancecheck6
//::BY: Xovian
#include "nw_i0_generic"
int StartingConditional()
{
if(GetAssociateState(NW_ASC_DISTANCE_6_METERS)&&(GetAssociateState(NW_ASC_DISTANCE_2_METERS)==FALSE)&&(GetAssociateState(NW_ASC_DISTANCE_2_METERS)==FALSE))
{
return FALSE;
}
return TRUE;
}

View File

@@ -0,0 +1,12 @@
void main()
{
object oTarget;
oTarget = GetWaypointByTag("POST_GOLEMHCLERIC");
location lTarget = GetLocation(oTarget);
DelayCommand(0.0, ApplyEffectAtLocation(DURATION_TYPE_TEMPORARY, EffectVisualEffect(VFX_FNF_SUMMON_MONSTER_3), lTarget, 5.0));
DelayCommand(0.1, ApplyEffectAtLocation(DURATION_TYPE_TEMPORARY, EffectVisualEffect(VFX_DUR_LIGHT_RED_20), lTarget, 30.0));
// Spawn "resrefhere".
CreateObject(OBJECT_TYPE_CREATURE, "golemcleric", lTarget);
}

View File

@@ -0,0 +1,14 @@
void main()
{
// Get the creature who triggered this event.
object oObject = GetEnteringObject();
if ( !GetIsPC(oObject) || GetIsDMPossessed(oObject) )
return;
if ( GetLocalInt( oObject, "HenchFired" ))
// Destroy an object
DestroyObject(oObject, 2.0);
}

View File

@@ -0,0 +1,11 @@
void main()
{
object oTarget;
oTarget = GetWaypointByTag("POST_GOLEMHFIGHTER");
location lTarget = GetLocation(oTarget);
DelayCommand(0.0, ApplyEffectAtLocation(DURATION_TYPE_TEMPORARY, EffectVisualEffect(VFX_FNF_SUMMON_MONSTER_3), lTarget, 5.0));
DelayCommand(0.1, ApplyEffectAtLocation(DURATION_TYPE_TEMPORARY, EffectVisualEffect(VFX_DUR_LIGHT_RED_20), lTarget, 30.0));
// Spawn "resrefhere".
CreateObject(OBJECT_TYPE_CREATURE, "golemfighter", lTarget);
}

View File

@@ -0,0 +1,12 @@
void main()
{
// Get the PC who is in this conversation.
object oPC = GetPCSpeaker();
// Get PC's HD * 500.
int nGold = GetHitDice(oPC) * 500;
{
SetCustomToken(222, (IntToString(nGold)));
}
}

View File

@@ -0,0 +1,23 @@
/*
* Script generated by LS Script Generator, v.TK.0
*
* For download info, please visit:
* http://nwvault.ign.com/View.php?view=Other.Detail&id=1502
*/
// Put this under "Text Appears When" in the conversation editor.
int StartingConditional()
{
// Get the PC who is involved in this conversation
object oPC = GetPCSpeaker();
int nGold = GetHitDice(oPC) * 500;
// The PC must have at least 100 gold.
if ( GetGold(oPC) >= nGold )
return FALSE;
// If we make it this far, we have passed all tests.
return TRUE;
}

View File

@@ -0,0 +1,16 @@
void main()
{
// Get the PC who is in this conversation.
object oPC = GetPCSpeaker();
// Get PC's HD.
int nGold = GetHitDice(oPC) * 500;
{
// Take oPC level * 500 gold from the PC.
TakeGoldFromCreature(nGold, oPC, TRUE);
}
}

View File

@@ -0,0 +1,11 @@
void main()
{
object oTarget;
oTarget = GetWaypointByTag("POST_GOLEMHROGUE");
location lTarget = GetLocation(oTarget);
DelayCommand(0.0, ApplyEffectAtLocation(DURATION_TYPE_TEMPORARY, EffectVisualEffect(VFX_FNF_SUMMON_MONSTER_3), lTarget, 5.0));
DelayCommand(0.1, ApplyEffectAtLocation(DURATION_TYPE_TEMPORARY, EffectVisualEffect(VFX_DUR_LIGHT_RED_20), lTarget, 30.0));
// Spawn "resrefhere".
CreateObject(OBJECT_TYPE_CREATURE, "golemrogue", lTarget);
}

View File

@@ -0,0 +1,9 @@
// check to see if the henchman has a spell memorized
int StartingConditional()
{
int iResult;
iResult = GetHasSpell(SPELL_FLAME_WEAPON, OBJECT_SELF);
return iResult;
}

View File

@@ -0,0 +1,9 @@
// check to see if the henchman has a spell memorized
int StartingConditional()
{
int iResult;
iResult = GetHasSpell(SPELL_MASS_HEAL, OBJECT_SELF);
return iResult;
}

View File

@@ -0,0 +1,9 @@
// check to see if the henchman has a spell memorized
int StartingConditional()
{
int iResult;
iResult = GetHasSpell(SPELL_TENSERS_TRANSFORMATION, OBJECT_SELF);
return iResult;
}

View File

@@ -0,0 +1,11 @@
//::healcheck25
//::BY: Xovian
#include "nw_i0_generic"
int StartingConditional()
{
if(GetAssociateState(NW_ASC_HEAL_AT_25)&&(GetAssociateState(NW_ASC_HEAL_AT_50)==FALSE)&&(GetAssociateState(NW_ASC_HEAL_AT_75)==FALSE))
{
return FALSE;
}
return TRUE;
}

View File

@@ -0,0 +1,11 @@
//::healcheck50
//::BY: Xovian
#include "nw_i0_generic"
int StartingConditional()
{
if(GetAssociateState(NW_ASC_HEAL_AT_50)&&(GetAssociateState(NW_ASC_HEAL_AT_25)==FALSE)&&(GetAssociateState(NW_ASC_HEAL_AT_75)==FALSE))
{
return FALSE;
}
return TRUE;
}

View File

@@ -0,0 +1,11 @@
//::healcheck75
//::BY: Xovian
#include "nw_i0_generic"
int StartingConditional()
{
if(GetAssociateState(NW_ASC_HEAL_AT_75)&&(GetAssociateState(NW_ASC_HEAL_AT_25)==FALSE)&&(GetAssociateState(NW_ASC_HEAL_AT_50)==FALSE))
{
return FALSE;
}
return TRUE;
}

View File

@@ -0,0 +1,4 @@
void main()
{
SetLocalInt(OBJECT_SELF, "Deekin_Spell_Cast", SPELL_PROTECTION_FROM_EVIL);
}

View File

@@ -0,0 +1,8 @@
// "Use the <CUSTOM7102>."
int StartingConditional()
{
if (GetLocalInt(OBJECT_SELF, "NO_OF_TRAPS") >= 2)
return TRUE;
return FALSE;
}

View File

@@ -0,0 +1,8 @@
// Has three traps
int StartingConditional()
{
if (GetLocalInt(OBJECT_SELF, "NO_OF_TRAPS") >= 3)
return TRUE;
return FALSE;
}

View File

@@ -0,0 +1,8 @@
// Has four traps
int StartingConditional()
{
if (GetLocalInt(OBJECT_SELF, "NO_OF_TRAPS") >= 4)
return TRUE;
return FALSE;
}

View File

@@ -0,0 +1,8 @@
// Has five traps
int StartingConditional()
{
if (GetLocalInt(OBJECT_SELF, "NO_OF_TRAPS") >= 5)
return TRUE;
return FALSE;
}

View File

@@ -0,0 +1,8 @@
// Has six traps
int StartingConditional()
{
if (GetLocalInt(OBJECT_SELF, "NO_OF_TRAPS") >= 6)
return TRUE;
return FALSE;
}

View File

@@ -0,0 +1,8 @@
// Has seven traps
int StartingConditional()
{
if (GetLocalInt(OBJECT_SELF, "NO_OF_TRAPS") >= 7)
return TRUE;
return FALSE;
}

View File

@@ -0,0 +1,8 @@
// Has seven traps
int StartingConditional()
{
if (GetLocalInt(OBJECT_SELF, "NO_OF_TRAPS") >= 8)
return TRUE;
return FALSE;
}

View File

@@ -0,0 +1,15 @@
// "I want you to set a trap here."
int StartingConditional()
{
if (GetSkillRank(SKILL_SET_TRAP, OBJECT_SELF, TRUE) < 1) return FALSE;
object oItem = GetFirstItemInInventory();
while (GetIsObjectValid(oItem))
{
if (GetBaseItemType(oItem) == BASE_ITEM_TRAPKIT) return TRUE;
oItem = GetNextItemInInventory();
}
return FALSE;
}

View File

@@ -0,0 +1,43 @@
//::///////////////////////////////////////////////
//:: Name hen_chose1_at
//:: Copyright (c) 2001 Bioware Corp.
//:://////////////////////////////////////////////
/*
"Use the <CUSTOM7701>."
*/
//:://////////////////////////////////////////////
//:: Created By: nereng
//:: Created On: 03.05.06
//:://////////////////////////////////////////////
void main()
{
object oChosenTrap = GetLocalObject(OBJECT_SELF, "TRAP1");
SetLocalObject(OBJECT_SELF, "TRAP_TO_SET", oChosenTrap);
// Figuring out the base trap number is a bit tricky. It is
// the end number of the tag minus 1, EXCEPT for acid splash
// and negative traps which have changed places somewhere.
string sTagR2 = GetStringRight(GetTag(oChosenTrap), 2);
int nTagR2 = StringToInt(sTagR2);
nTagR2 --;
// Switching acid splash and negative trap numbers
switch (nTagR2)
{
case 32:
case 33:
case 34:
case 35:
nTagR2 = nTagR2 + 8;
break;
case 40:
case 41:
case 42:
case 43:
nTagR2 = nTagR2 - 8;
break;
}
SetLocalInt(OBJECT_SELF, "TRAP_BASE_NUMBER", nTagR2);
}

View File

@@ -0,0 +1,30 @@
// "Use the <CUSTOM7102>."
void main()
{
object oChosenTrap = GetLocalObject(OBJECT_SELF, "TRAP2");
SetLocalObject(OBJECT_SELF, "TRAP_TO_SET", oChosenTrap);
// Figuring out the base trap number is a bit tricky...
string sTagR2 = GetStringRight(GetTag(oChosenTrap), 2);
int nTagR2 = StringToInt(sTagR2);
nTagR2 --;
// Switching acid splash and negative trap numbers
switch (nTagR2)
{
case 32:
case 33:
case 34:
case 35:
nTagR2 = nTagR2 + 8;
break;
case 40:
case 41:
case 42:
case 43:
nTagR2 = nTagR2 - 8;
break;
}
SetLocalInt(OBJECT_SELF, "TRAP_BASE_NUMBER", nTagR2);
}

View File

@@ -0,0 +1,28 @@
void main()
{
object oChosenTrap = GetLocalObject(OBJECT_SELF, "TRAP3");
SetLocalObject(OBJECT_SELF, "TRAP_TO_SET", oChosenTrap);
// Figuring out the base trap number is a bit tricky...
string sTagR2 = GetStringRight(GetTag(oChosenTrap), 2);
int nTagR2 = StringToInt(sTagR2);
nTagR2 --;
// Switching acid splash and negative trap numbers
switch (nTagR2)
{
case 32:
case 33:
case 34:
case 35:
nTagR2 = nTagR2 + 8;
break;
case 40:
case 41:
case 42:
case 43:
nTagR2 = nTagR2 - 8;
break;
}
SetLocalInt(OBJECT_SELF, "TRAP_BASE_NUMBER", nTagR2);
}

View File

@@ -0,0 +1,28 @@
void main()
{
object oChosenTrap = GetLocalObject(OBJECT_SELF, "TRAP4");
SetLocalObject(OBJECT_SELF, "TRAP_TO_SET", oChosenTrap);
// Figuring out the base trap number is a bit tricky...
string sTagR2 = GetStringRight(GetTag(oChosenTrap), 2);
int nTagR2 = StringToInt(sTagR2);
nTagR2 --;
// Switching acid splash and negative trap numbers
switch (nTagR2)
{
case 32:
case 33:
case 34:
case 35:
nTagR2 = nTagR2 + 8;
break;
case 40:
case 41:
case 42:
case 43:
nTagR2 = nTagR2 - 8;
break;
}
SetLocalInt(OBJECT_SELF, "TRAP_BASE_NUMBER", nTagR2);
}

View File

@@ -0,0 +1,28 @@
void main()
{
object oChosenTrap = GetLocalObject(OBJECT_SELF, "TRAP5");
SetLocalObject(OBJECT_SELF, "TRAP_TO_SET", oChosenTrap);
// Figuring out the base trap number is a bit tricky...
string sTagR2 = GetStringRight(GetTag(oChosenTrap), 2);
int nTagR2 = StringToInt(sTagR2);
nTagR2 --;
// Switching acid splash and negative trap numbers
switch (nTagR2)
{
case 32:
case 33:
case 34:
case 35:
nTagR2 = nTagR2 + 8;
break;
case 40:
case 41:
case 42:
case 43:
nTagR2 = nTagR2 - 8;
break;
}
SetLocalInt(OBJECT_SELF, "TRAP_BASE_NUMBER", nTagR2);
}

View File

@@ -0,0 +1,28 @@
void main()
{
object oChosenTrap = GetLocalObject(OBJECT_SELF, "TRAP6");
SetLocalObject(OBJECT_SELF, "TRAP_TO_SET", oChosenTrap);
// Figuring out the base trap number is a bit tricky...
string sTagR2 = GetStringRight(GetTag(oChosenTrap), 2);
int nTagR2 = StringToInt(sTagR2);
nTagR2 --;
// Switching acid splash and negative trap numbers
switch (nTagR2)
{
case 32:
case 33:
case 34:
case 35:
nTagR2 = nTagR2 + 8;
break;
case 40:
case 41:
case 42:
case 43:
nTagR2 = nTagR2 - 8;
break;
}
SetLocalInt(OBJECT_SELF, "TRAP_BASE_NUMBER", nTagR2);
}

View File

@@ -0,0 +1,28 @@
void main()
{
object oChosenTrap = GetLocalObject(OBJECT_SELF, "TRAP7");
SetLocalObject(OBJECT_SELF, "TRAP_TO_SET", oChosenTrap);
// Figuring out the base trap number is a bit tricky...
string sTagR2 = GetStringRight(GetTag(oChosenTrap), 2);
int nTagR2 = StringToInt(sTagR2);
nTagR2 --;
// Switching acid splash and negative trap numbers
switch (nTagR2)
{
case 32:
case 33:
case 34:
case 35:
nTagR2 = nTagR2 + 8;
break;
case 40:
case 41:
case 42:
case 43:
nTagR2 = nTagR2 - 8;
break;
}
SetLocalInt(OBJECT_SELF, "TRAP_BASE_NUMBER", nTagR2);
}

View File

@@ -0,0 +1,28 @@
void main()
{
object oChosenTrap = GetLocalObject(OBJECT_SELF, "TRAP8");
SetLocalObject(OBJECT_SELF, "TRAP_TO_SET", oChosenTrap);
// Figuring out the base trap number is a bit tricky...
string sTagR2 = GetStringRight(GetTag(oChosenTrap), 2);
int nTagR2 = StringToInt(sTagR2);
nTagR2 --;
// Switching acid splash and negative trap numbers
switch (nTagR2)
{
case 32:
case 33:
case 34:
case 35:
nTagR2 = nTagR2 + 8;
break;
case 40:
case 41:
case 42:
case 43:
nTagR2 = nTagR2 - 8;
break;
}
SetLocalInt(OBJECT_SELF, "TRAP_BASE_NUMBER", nTagR2);
}

View File

@@ -0,0 +1,30 @@
//::///////////////////////////////////////////////
//:: Name hen_gentokens_at
//:: Copyright (c) 2001 Bioware Corp.
//:://////////////////////////////////////////////
/*
"Which trap should I set?"
*/
//:://////////////////////////////////////////////
//:: Created By: nereng
//:: Created On: 03.05.06
//:://////////////////////////////////////////////
void main()
{
// Generate custom tokens
int i = 1;
object oItem = GetFirstItemInInventory();
while(oItem != OBJECT_INVALID)
{
if (GetBaseItemType(oItem) == BASE_ITEM_TRAPKIT)
{
SetCustomToken(7100 + i, GetName(oItem));
// Storing it as a local object for later reference
SetLocalObject(OBJECT_SELF, "TRAP" + IntToString(i), oItem);
// Need to know how many traps there are
SetLocalInt(OBJECT_SELF, "NO_OF_TRAPS", i);
i++;
}
oItem = GetNextItemInInventory();
}
}

View File

@@ -0,0 +1,9 @@
// check to see if the henchman has the ability to summon a companion
int StartingConditional()
{
int iResult;
iResult = GetHasFeat(FEAT_ANIMAL_COMPANION, OBJECT_SELF);
return iResult;
}

View File

@@ -0,0 +1,9 @@
// check to see if the henchman has the ability to summon a familiar
int StartingConditional()
{
int iResult;
iResult = GetHasFeat(FEAT_SUMMON_FAMILIAR, OBJECT_SELF);
return iResult;
}

View File

@@ -0,0 +1,48 @@
//::///////////////////////////////////////////////
//:: Name hen_settrloc_at
//:: Copyright (c) 2001 Bioware Corp.
//:://////////////////////////////////////////////
/*
"Very well. Stand back!"
*/
//:://////////////////////////////////////////////
//:: Created By: nereng
//:: Created On: 03.05.06
//:://////////////////////////////////////////////
#include "x0_i0_assoc"
void DoCreateTrapAtLocation()
{
string sTag = "HenchmanTrap"; // Tag of the trap
string sDisarmed = ""; // script to run on disarmed
string sTriggered = ""; // script to run on triggered
location lLoc = GetLocation(GetMaster()); // The PC Master's location
float fSize = GetLocalFloat(OBJECT_SELF, "TRAP_SIZE");
int nFaction = STANDARD_FACTION_MERCHANT; // faction of the trap
int nTrapType = GetLocalInt(OBJECT_SELF, "TRAP_BASE_NUMBER"); // type of trap
CreateTrapAtLocation(nTrapType, lLoc, fSize, sTag, nFaction, sDisarmed, sTriggered);
}
void main()
{
//int nTrapType = GetLocalInt(OBJECT_SELF, "TRAP_BASE_NUMBER"); // type of trap
object oTrapkit = GetLocalObject(OBJECT_SELF, "TRAP_TO_SET");
// precaution against tricky players!
if (GetIsObjectValid(oTrapkit) == FALSE)
{
SpeakString("Huh?! I wonder where that kit has gone?");
return;
}
DestroyObject(oTrapkit);
DeleteLocalObject(OBJECT_SELF, "TRAP_TO_SET");
SetAssociateState(NW_ASC_IS_BUSY, TRUE);
ActionMoveToObject(GetMaster());
ActionPlayAnimation(ANIMATION_LOOPING_GET_LOW, 1.0, 3.0);
ActionDoCommand(DoCreateTrapAtLocation());
ActionDoCommand(PlaySound("gui_traparm"));
ActionDoCommand(SetAssociateState(NW_ASC_IS_BUSY, FALSE));
//ActionDoCommand(PlayVoiceChat(VOICE_CHAT_TASKCOMPLETE));
}

View File

@@ -0,0 +1,17 @@
// "I am not skillful enough to set that trap."
int StartingConditional()
{
int nBase = GetLocalInt(OBJECT_SELF, "TRAP_BASE_NUMBER");
string sDC = Get2DAString("traps", "SetDC", nBase);
int nDC = StringToInt(sDC);
int nSkill = GetSkillRank(SKILL_SET_TRAP) + 20;
string sSkill = IntToString(nSkill);
if (nSkill < nDC)
{
SendMessageToPC(GetMaster(), "SetTrapDC: " + sDC + " Skill: " + sSkill);
return TRUE;
}
return FALSE;
}

View File

@@ -0,0 +1,5 @@
// "Make it large."
void main()
{
SetLocalFloat(OBJECT_SELF, "TRAP_SIZE", 3.0);
}

View File

@@ -0,0 +1,5 @@
// "Make it medium."
void main()
{
SetLocalFloat(OBJECT_SELF, "TRAP_SIZE", 2.0);
}

View File

@@ -0,0 +1,5 @@
// "Make it small."
void main()
{
SetLocalFloat(OBJECT_SELF, "TRAP_SIZE", 1.0);
}

View File

@@ -0,0 +1,157 @@
/*
Henchman Inventory And Battle AI
This file contains functions used in the default On* scripts
for henchman actions during noncombat. This includes dealing
with traps, locks, items, and containers
*/
#include "hench_i0_generic"
// void main() { }
// Removes master force trap and locks
void ClearForceOptions();
// force associate to open given lock
void OpenLock(object oLock);
// force associate to disarm given trap
void ForceTrap(object oTrap);
// true if free to work with trap, locks, items
int GetIAmNotDoingAnything();
// checks if associate should do any actions with
// traps, locks, or items
int HenchCheckArea(int nClearActions = FALSE);
// finds nears trap or locked item
object HenchGetLockedOrTrappedObject(object oMaster);
// strings for actions
const string sLockMasterFailed = "tk_master_lock_failed";
const string sForceTrap = "tk_force_trap";
void ClearForceOptions()
{
DeleteLocalObject(OBJECT_SELF, sLockMasterFailed);
DeleteLocalInt(OBJECT_SELF, sForceTrap);
}
void OpenLock(object oLock)
{
if (GetIsObjectValid(oLock))
{
SetLocalObject(OBJECT_SELF, sLockMasterFailed, oLock);
ExecuteScript("hench_o0_act", OBJECT_SELF);
}
}
void ForceTrap(object oTrap)
{
if (GetIsObjectValid(oTrap))
{
SetLocalObject(OBJECT_SELF, sLockMasterFailed, oTrap);
SetLocalInt(OBJECT_SELF, sForceTrap, TRUE);
ExecuteScript("hench_o0_act", OBJECT_SELF);
}
}
int GetIAmNotDoingAnything()
{
int currentAction = GetCurrentAction(OBJECT_SELF);
return !IsInConversation(OBJECT_SELF)
&& !GetIsObjectValid(GetAttemptedAttackTarget())
&& !GetIsObjectValid(GetAttemptedSpellTarget())
&& currentAction != ACTION_REST
&& currentAction != ACTION_DISABLETRAP
&& currentAction != ACTION_OPENLOCK
&& currentAction != ACTION_USEOBJECT
&& currentAction != ACTION_RECOVERTRAP
&& currentAction != ACTION_EXAMINETRAP
&& currentAction != ACTION_PICKUPITEM
&& currentAction != ACTION_HEAL
&& currentAction != ACTION_TAUNT;
}
int HenchCheckArea(int nClearActions = FALSE)
{
// only execute if we have something to do
if (!GetAssociateState(NW_ASC_MODE_STAND_GROUND) && !GetLocalInt(OBJECT_SELF, sHenchDontAttackFlag) &&
GetIAmNotDoingAnything() &&
((GetHasSkill(SKILL_DISABLE_TRAP) && !GetLocalInt(OBJECT_SELF, sHenchNoDisarmTraps)) ||
GetLocalInt(OBJECT_SELF, sHenchAutoOpenLocks) ||
GetLocalInt(OBJECT_SELF, sHenchAutoPickup) || GetLocalInt(OBJECT_SELF, sHenchAutoOpenChest) ||
GetIsObjectValid(GetLocalObject(OBJECT_SELF, sLockMasterFailed))))
{
if (!GetLocalInt(OBJECT_SELF, "tk_doing_action"))
{
ExecuteScript("hench_o0_act", OBJECT_SELF);
return GetLocalInt(OBJECT_SELF, "tk_action_result");
}
else
{
ActionDoCommand(ExecuteScript("hench_o0_act", OBJECT_SELF));
return TRUE;
}
}
else
{
ClearForceOptions();
}
return FALSE;
}
//::///////////////////////////////////////////////
//:: Get Locked or Trapped Object
//:: Copyright (c) 2001 Bioware Corp.
//:://////////////////////////////////////////////
/*
Finds the closest locked or trapped object to the object
passed in up to a maximum of 10 objects.
*/
//:://////////////////////////////////////////////
//:: Created By: Pausanias
//:: Created On: ??????
//:://////////////////////////////////////////////
object HenchGetLockedOrTrappedObject(object oMaster)
{
int nCnt = 1;
int bValid = TRUE;
object oRealMaster = GetRealMaster();
object oLastObject = GetNearestObjectToLocation(OBJECT_TYPE_DOOR | OBJECT_TYPE_PLACEABLE | OBJECT_TYPE_TRIGGER, GetLocation(oMaster), nCnt);
while (GetIsObjectValid(oLastObject) && bValid)
{
//COMMENT THIS BACK IN WHEN DOOR ACTION WORKS ON PLACABLE.
//object oItem = GetFirstItemInInventory(oLastObject);
if(GetLocked(oLastObject) ||
(GetIsTrapped(oLastObject) &&
(GetTrapDetectedBy(oLastObject,OBJECT_SELF) ||
GetTrapDetectedBy(oLastObject,oRealMaster))))
{
return oLastObject;
}
nCnt++;
if(nCnt == 10)
{
bValid = FALSE;
}
oLastObject = GetNearestObjectToLocation(OBJECT_TYPE_DOOR | OBJECT_TYPE_PLACEABLE | OBJECT_TYPE_TRIGGER, GetLocation(oMaster), nCnt);
}
return OBJECT_INVALID;
}

View File

@@ -0,0 +1,32 @@
/*
Henchman Inventory And Battle AI
This file contains some modifications of the default
associate functions.
*/
#include "hench_i0_act"
const float henchMaxScoutDistance = 50.0;
// Modified form of ResetHenchmenState
// sets the henchmen to commandable, deletes locals
// having to do with doors and clears actions
// Modified by Tony K to clear more things
void HenchResetHenchmenState();
void HenchResetHenchmenState()
{
SetCommandable(TRUE);
DeleteLocalObject(OBJECT_SELF, "NW_GENERIC_DOOR_TO_BASH");
DeleteLocalInt(OBJECT_SELF, "NW_GENERIC_DOOR_TO_BASH_HP");
DeleteLocalInt(OBJECT_SELF, henchBuffCountStr);
DeleteLocalInt(OBJECT_SELF, henchHealCountStr);
SetAssociateState(NW_ASC_IS_BUSY, FALSE);
ClearForceOptions();
ClearAllActions();
}

View File

@@ -0,0 +1,220 @@
/*
Henchman Inventory And Battle AI
This file contains scripts used settings in conversations
*/
// void main() { }
#include "x0_i0_assoc"
const string sHenchAutoRecoverTraps = "AutoRecoverTraps";
const string sHenchAutoOpenLocks = "AutoOpenLocks";
const string sHenchAutoPickup = "AutoPickup";
const string sHenchAutoOpenChest = "AutoOpenChest";
const string sHenchNoDisarmTraps = "NoDisarmTraps";
const string sHenchStealthMode = "X2_HENCH_STEALTH_MODE";
const string sHenchStopCasting = "X2_L_STOPCASTING";
const string sHenchDontDispel = "X2_HENCH_DO_NOT_DISPEL";
const string sHenchSpellChallenge = "NewHenchChallenge";
const string sHenchDisableAutoHide = "HenchDisableAutoHide";
const string sHenchDontSummon = "DontSummon";
const string sHenchDontCastMelee = "DoNotCastMelee";
const string sHenchFamiliarChallenge = "NewFamiliarChallenge";
const string sHenchFamiliarToDeath = "FamiliarToTheDeath";
const string sHenchAniCompChallenge = "NewAniCompChallenge";
const string sHenchAniCompToDeath = "AniCompToTheDeath";
const string sHenchDualWieldState = "DualWieldState";
const string sHenchLightOffHand = "LightOffHand";
const string sHenchHenchRange = "HenchRange";
const string sHenchFamiliarPreStr = "Fam";
const string sHenchAniCompPreStr = "Ani";
const string sHenchSummonPreStr = "Sum";
const string sHenchDominatePreStr = "Dom";
const string sHenchDefSettingsSet = "HENCH_DEF_SETTINGS_SET";
string HenchGetAssocString(int iAssocType)
{
if (iAssocType == ASSOCIATE_TYPE_FAMILIAR)
{
return sHenchFamiliarPreStr;
}
else if (iAssocType == ASSOCIATE_TYPE_ANIMALCOMPANION)
{
return sHenchAniCompPreStr;
}
else if (iAssocType == ASSOCIATE_TYPE_SUMMONED)
{
return sHenchSummonPreStr;
}
else if (iAssocType == ASSOCIATE_TYPE_DOMINATED)
{
return sHenchDominatePreStr;
}
return "null";
}
void HenchSetAssociateInt(string sName, int iValue)
{
SetLocalInt(OBJECT_SELF, sName, iValue);
int iAssocType = GetAssociateType(OBJECT_SELF);
if ((iAssocType == ASSOCIATE_TYPE_NONE) ||
(iAssocType == ASSOCIATE_TYPE_HENCHMAN))
{
return;
}
SetLocalInt(GetPCSpeaker(), HenchGetAssocString(iAssocType) + sName, iValue);
}
void HenchSetAssociateFloat(string sName, float fValue)
{
SetLocalFloat(OBJECT_SELF, sName, fValue);
int iAssocType = GetAssociateType(OBJECT_SELF);
if ((iAssocType == ASSOCIATE_TYPE_NONE) ||
(iAssocType == ASSOCIATE_TYPE_HENCHMAN))
{
return;
}
SetLocalFloat(GetPCSpeaker(), HenchGetAssocString(iAssocType) + sName, fValue);
}
void HenchSetDefSettings()
{
int iAssocType = GetAssociateType(OBJECT_SELF);
if ((iAssocType == ASSOCIATE_TYPE_NONE) ||
(iAssocType == ASSOCIATE_TYPE_HENCHMAN))
{
return;
}
string preDefStr = HenchGetAssocString(iAssocType);
object oPC = GetPCSpeaker();
SetLocalInt(oPC, preDefStr + sAssociateMasterConditionVarname, GetLocalInt(OBJECT_SELF, sAssociateMasterConditionVarname));
SetLocalInt(oPC, preDefStr + sHenchStealthMode, GetLocalInt(OBJECT_SELF, sHenchStealthMode));
SetLocalInt(oPC, preDefStr + sHenchStopCasting, GetLocalInt(OBJECT_SELF, sHenchStopCasting));
SetLocalInt(oPC, preDefStr + sHenchDontDispel, GetLocalInt(OBJECT_SELF, sHenchDontDispel));
}
void HenchGetDefSettings()
{
if (GetLocalInt(OBJECT_SELF, sHenchDefSettingsSet))
{
return;
}
SetLocalInt(OBJECT_SELF, sHenchDefSettingsSet, TRUE);
int iAssocType = GetAssociateType(OBJECT_SELF);
if ((iAssocType == ASSOCIATE_TYPE_NONE) ||
(iAssocType == ASSOCIATE_TYPE_HENCHMAN))
{
return;
}
string preDefStr = HenchGetAssocString(iAssocType);
object oPC = GetMaster();
if (!GetIsObjectValid(oPC) || !GetIsPC(oPC))
{
return;
}
object oTarget;
object oSource;
string preSrcStr;
// check if the PC has never had settings copied
// for associate type
if (!GetLocalInt(oPC, preDefStr + sHenchDefSettingsSet))
{
SetLocalInt(oPC, preDefStr + sHenchDefSettingsSet, TRUE);
oTarget = oPC;
oSource = OBJECT_SELF;
preSrcStr = preDefStr;
preDefStr = "";
}
else
{
oTarget = OBJECT_SELF;
oSource = oPC;
preSrcStr = "";
}
SetLocalInt(oTarget, preSrcStr + sAssociateMasterConditionVarname,
GetLocalInt(oSource, preDefStr + sAssociateMasterConditionVarname));
SetLocalInt(oTarget, preSrcStr + sHenchStealthMode,
GetLocalInt(oSource, preDefStr + sHenchStealthMode));
SetLocalInt(oTarget, preSrcStr + sHenchStopCasting,
GetLocalInt(oSource, preDefStr + sHenchStopCasting));
SetLocalInt(oTarget, preSrcStr + sHenchDontDispel,
GetLocalInt(oSource, preDefStr + sHenchDontDispel));
SetLocalInt(oTarget, preSrcStr + sHenchDisableAutoHide,
GetLocalInt(oSource, preDefStr + sHenchDisableAutoHide));
if (GetHasSkill(SKILL_DISABLE_TRAP))
{
SetLocalInt(oTarget, preSrcStr + sHenchNoDisarmTraps,
GetLocalInt(oSource, preDefStr + sHenchNoDisarmTraps));
SetLocalInt(oTarget, preSrcStr + sHenchAutoRecoverTraps,
GetLocalInt(oSource, preDefStr + sHenchAutoRecoverTraps));
}
if (GetHasSkill(SKILL_OPEN_LOCK))
{
SetLocalInt(oTarget, preSrcStr + sHenchAutoOpenLocks,
GetLocalInt(oSource, preDefStr + sHenchAutoOpenLocks));
}
SetLocalInt(oTarget, preSrcStr + sHenchAutoPickup,
GetLocalInt(oSource, preDefStr + sHenchAutoPickup));
if (GetSkillRank(SKILL_SEARCH) * 3 / 4 >= GetHitDice(OBJECT_SELF))
{
SetLocalInt(oTarget, preSrcStr + sHenchAutoOpenChest,
GetLocalInt(oSource, preDefStr + sHenchAutoOpenChest));
}
SetLocalFloat(oTarget, preSrcStr + sHenchSpellChallenge,
GetLocalFloat(oSource, preDefStr + sHenchSpellChallenge));
SetLocalInt(oTarget, preSrcStr + sHenchDualWieldState,
GetLocalInt(oSource, preDefStr + sHenchDualWieldState));
SetLocalInt(oTarget, preSrcStr + sHenchLightOffHand,
GetLocalInt(oSource, preDefStr + sHenchLightOffHand));
SetLocalFloat(oTarget, preSrcStr + sHenchHenchRange,
GetLocalFloat(oSource, preDefStr + sHenchHenchRange));
}
void HenchSetAssociateFlee(float fChallenge, int bFightToDeath)
{
object oPC = GetPCSpeaker();
int iAssocType = GetAssociateType(OBJECT_SELF);
// Set the variables
if (iAssocType == ASSOCIATE_TYPE_FAMILIAR)
{
SetLocalFloat(oPC, sHenchFamiliarChallenge, fChallenge);
SetLocalInt(oPC, sHenchFamiliarToDeath, bFightToDeath);
}
else if (iAssocType == ASSOCIATE_TYPE_ANIMALCOMPANION)
{
SetLocalFloat(oPC, sHenchAniCompChallenge, fChallenge);
SetLocalInt(oPC, sHenchAniCompToDeath, bFightToDeath);
}
}

View File

@@ -0,0 +1,220 @@
/*
Henchman Inventory And Battle AI
This file contains scripts used settings in conversations
*/
// void main() { }
#include "x0_i0_assoc"
const string sHenchAutoRecoverTraps = "AutoRecoverTraps";
const string sHenchAutoOpenLocks = "AutoOpenLocks";
const string sHenchAutoPickup = "AutoPickup";
const string sHenchAutoOpenChest = "AutoOpenChest";
const string sHenchNoDisarmTraps = "NoDisarmTraps";
const string sHenchStealthMode = "X2_HENCH_STEALTH_MODE";
const string sHenchStopCasting = "X2_L_STOPCASTING";
const string sHenchDontDispel = "X2_HENCH_DO_NOT_DISPEL";
const string sHenchSpellChallenge = "NewHenchChallenge";
const string sHenchDisableAutoHide = "HenchDisableAutoHide";
const string sHenchDontSummon = "DontSummon";
const string sHenchDontCastMelee = "DoNotCastMelee";
const string sHenchFamiliarChallenge = "NewFamiliarChallenge";
const string sHenchFamiliarToDeath = "FamiliarToTheDeath";
const string sHenchAniCompChallenge = "NewAniCompChallenge";
const string sHenchAniCompToDeath = "AniCompToTheDeath";
const string sHenchDualWieldState = "DualWieldState";
const string sHenchLightOffHand = "LightOffHand";
const string sHenchHenchRange = "HenchRange";
const string sHenchFamiliarPreStr = "Fam";
const string sHenchAniCompPreStr = "Ani";
const string sHenchSummonPreStr = "Sum";
const string sHenchDominatePreStr = "Dom";
const string sHenchDefSettingsSet = "HENCH_DEF_SETTINGS_SET";
string HenchGetAssocString(int iAssocType)
{
if (iAssocType == ASSOCIATE_TYPE_FAMILIAR)
{
return sHenchFamiliarPreStr;
}
else if (iAssocType == ASSOCIATE_TYPE_ANIMALCOMPANION)
{
return sHenchAniCompPreStr;
}
else if (iAssocType == ASSOCIATE_TYPE_SUMMONED)
{
return sHenchSummonPreStr;
}
else if (iAssocType == ASSOCIATE_TYPE_DOMINATED)
{
return sHenchDominatePreStr;
}
return "null";
}
void HenchSetAssociateInt(string sName, int iValue)
{
SetLocalInt(OBJECT_SELF, sName, iValue);
int iAssocType = GetAssociateType(OBJECT_SELF);
if ((iAssocType == ASSOCIATE_TYPE_NONE) ||
(iAssocType == ASSOCIATE_TYPE_HENCHMAN))
{
return;
}
SetLocalInt(GetPCSpeaker(), HenchGetAssocString(iAssocType) + sName, iValue);
}
void HenchSetAssociateFloat(string sName, float fValue)
{
SetLocalFloat(OBJECT_SELF, sName, fValue);
int iAssocType = GetAssociateType(OBJECT_SELF);
if ((iAssocType == ASSOCIATE_TYPE_NONE) ||
(iAssocType == ASSOCIATE_TYPE_HENCHMAN))
{
return;
}
SetLocalFloat(GetPCSpeaker(), HenchGetAssocString(iAssocType) + sName, fValue);
}
void HenchSetDefSettings()
{
int iAssocType = GetAssociateType(OBJECT_SELF);
if ((iAssocType == ASSOCIATE_TYPE_NONE) ||
(iAssocType == ASSOCIATE_TYPE_HENCHMAN))
{
return;
}
string preDefStr = HenchGetAssocString(iAssocType);
object oPC = GetPCSpeaker();
SetLocalInt(oPC, preDefStr + sAssociateMasterConditionVarname, GetLocalInt(OBJECT_SELF, sAssociateMasterConditionVarname));
SetLocalInt(oPC, preDefStr + sHenchStealthMode, GetLocalInt(OBJECT_SELF, sHenchStealthMode));
SetLocalInt(oPC, preDefStr + sHenchStopCasting, GetLocalInt(OBJECT_SELF, sHenchStopCasting));
SetLocalInt(oPC, preDefStr + sHenchDontDispel, GetLocalInt(OBJECT_SELF, sHenchDontDispel));
}
void HenchGetDefSettings()
{
if (GetLocalInt(OBJECT_SELF, sHenchDefSettingsSet))
{
return;
}
SetLocalInt(OBJECT_SELF, sHenchDefSettingsSet, TRUE);
int iAssocType = GetAssociateType(OBJECT_SELF);
if ((iAssocType == ASSOCIATE_TYPE_NONE) ||
(iAssocType == ASSOCIATE_TYPE_HENCHMAN))
{
return;
}
string preDefStr = HenchGetAssocString(iAssocType);
object oPC = GetMaster();
if (!GetIsObjectValid(oPC) || !GetIsPC(oPC))
{
return;
}
object oTarget;
object oSource;
string preSrcStr;
// check if the PC has never had settings copied
// for associate type
if (!GetLocalInt(oPC, preDefStr + sHenchDefSettingsSet))
{
SetLocalInt(oPC, preDefStr + sHenchDefSettingsSet, TRUE);
oTarget = oPC;
oSource = OBJECT_SELF;
preSrcStr = preDefStr;
preDefStr = "";
}
else
{
oTarget = OBJECT_SELF;
oSource = oPC;
preSrcStr = "";
}
SetLocalInt(oTarget, preSrcStr + sAssociateMasterConditionVarname,
GetLocalInt(oSource, preDefStr + sAssociateMasterConditionVarname));
SetLocalInt(oTarget, preSrcStr + sHenchStealthMode,
GetLocalInt(oSource, preDefStr + sHenchStealthMode));
SetLocalInt(oTarget, preSrcStr + sHenchStopCasting,
GetLocalInt(oSource, preDefStr + sHenchStopCasting));
SetLocalInt(oTarget, preSrcStr + sHenchDontDispel,
GetLocalInt(oSource, preDefStr + sHenchDontDispel));
SetLocalInt(oTarget, preSrcStr + sHenchDisableAutoHide,
GetLocalInt(oSource, preDefStr + sHenchDisableAutoHide));
if (GetHasSkill(SKILL_DISABLE_TRAP))
{
SetLocalInt(oTarget, preSrcStr + sHenchNoDisarmTraps,
GetLocalInt(oSource, preDefStr + sHenchNoDisarmTraps));
SetLocalInt(oTarget, preSrcStr + sHenchAutoRecoverTraps,
GetLocalInt(oSource, preDefStr + sHenchAutoRecoverTraps));
}
if (GetHasSkill(SKILL_OPEN_LOCK))
{
SetLocalInt(oTarget, preSrcStr + sHenchAutoOpenLocks,
GetLocalInt(oSource, preDefStr + sHenchAutoOpenLocks));
}
SetLocalInt(oTarget, preSrcStr + sHenchAutoPickup,
GetLocalInt(oSource, preDefStr + sHenchAutoPickup));
if (GetSkillRank(SKILL_SEARCH) * 3 / 4 >= GetHitDice(OBJECT_SELF))
{
SetLocalInt(oTarget, preSrcStr + sHenchAutoOpenChest,
GetLocalInt(oSource, preDefStr + sHenchAutoOpenChest));
}
SetLocalFloat(oTarget, preSrcStr + sHenchSpellChallenge,
GetLocalFloat(oSource, preDefStr + sHenchSpellChallenge));
SetLocalInt(oTarget, preSrcStr + sHenchDualWieldState,
GetLocalInt(oSource, preDefStr + sHenchDualWieldState));
SetLocalInt(oTarget, preSrcStr + sHenchLightOffHand,
GetLocalInt(oSource, preDefStr + sHenchLightOffHand));
SetLocalFloat(oTarget, preSrcStr + sHenchHenchRange,
GetLocalFloat(oSource, preDefStr + sHenchHenchRange));
}
void HenchSetAssociateFlee(float fChallenge, int bFightToDeath)
{
object oPC = GetPCSpeaker();
int iAssocType = GetAssociateType(OBJECT_SELF);
// Set the variables
if (iAssocType == ASSOCIATE_TYPE_FAMILIAR)
{
SetLocalFloat(oPC, sHenchFamiliarChallenge, fChallenge);
SetLocalInt(oPC, sHenchFamiliarToDeath, bFightToDeath);
}
else if (iAssocType == ASSOCIATE_TYPE_ANIMALCOMPANION)
{
SetLocalFloat(oPC, sHenchAniCompChallenge, fChallenge);
SetLocalInt(oPC, sHenchAniCompToDeath, bFightToDeath);
}
}

View File

@@ -0,0 +1,770 @@
/*
Henchman Inventory And Battle AI
This file contains routines used in equipping monsters
and henchman. Contains modified EquipAppropriateWeapons
function (renamed HenchEquipAppropriateWeapons)
*/
#include "hench_i0_generic"
// void main() { }
// internal weapon state settings
const int HENCH_AI_WEAPON_INIT = 0x00000001;
const int HENCH_AI_HAS_MELEE = 0x00000002;
const int HENCH_AI_HAS_MELEE_WEAPON = 0x00000004;
const int HENCH_AI_HAS_RANGED_WEAPON = 0x00000008;
const string HENCH_AI_WEAPON = "HENCH_AI_WEAPON";
const string HENCH_AI_STORED_MELEE = "HenchStoredMeleeWeapon";
const string HENCH_AI_STORED_RANGED = "HenchStoredRangedWeapon";
const string HENCH_AI_STORED_SHIELD = "StoredShield";
const string HENCH_AI_SHIELD_STATUS = "HaveShieldStatus";
const string HENCH_AI_STORED_OFF_HAND = "StoredOffHand";
const string HENCH_AI_OFF_HAND_STATUS = "HaveOffhandStatus";
const string HENCH_AI_SWITCHED_TO_MELEE = "SwitchedToMelee";
const string HENCH_AI_COMBAT_EQUIP = "HenchCombatEquip";
// void main() { }
// cache weapon state information on self
void SetWeaponState(int nCondition, int bValid = TRUE);
// un-equip weapons from left and right hands
void UnequipWeapons();
// equip best shield available
void EquipShield(int bIndicateStatus);
// get cached weapon state information
int GetInitWeaponStatus();
// equip best melee weapon(s) against target AND check for shield
int EquipMeleeWeapons(object oTarget, int bIndicateStatus, int iCallNumber);
// equip best ranged weapon(s) against target
int EquipRangedWeapon(object oTarget, int bIndicateStatus, int iCallNumber);
// equip best weapons based on target and threshold distance
int HenchEquipAppropriateWeapons(object oTarget, float fThresholdDistance, int bIndicateSwitch, int bPolymorphed);
// continue weapon equipping that is in progress
void ActionContinueEquip(object oTarget, int bIndicateStatus, int iCallNumber);
// wrapper to equip default weapons
void HenchEquipDefaultWeapons(object oCreature = OBJECT_SELF, int bShowStatus = FALSE);
// clear all cached weapon state information
void ClearWeaponStates(object oCreature = OBJECT_SELF);
// equip weapons on self
void ActionChangeEquippedWeapons();
// equip weapons on target creature
void ChangeEquippedWeapons(object oCreature);
void SetWeaponState(int nCondition, int bValid = TRUE)
{
int nStatus = GetLocalInt(OBJECT_SELF, HENCH_AI_WEAPON);
if (bValid)
{
nStatus = nStatus | nCondition;
SetLocalInt(OBJECT_SELF, HENCH_AI_WEAPON, nStatus);
}
else
{
nStatus = nStatus & ~nCondition;
SetLocalInt(OBJECT_SELF, HENCH_AI_WEAPON, nStatus);
}
}
void UnequipWeapons()
{
object oRight = GetItemInSlot(INVENTORY_SLOT_RIGHTHAND);
if (GetIsObjectValid(oRight))
{
ActionUnequipItem(oRight);
}
object oLeft = GetItemInSlot(INVENTORY_SLOT_LEFTHAND);
if (GetIsObjectValid(oLeft))
{
ActionUnequipItem(oLeft);
}
}
void EquipShield(int bIndicateStatus)
{
int iHaveShieldStatus = GetLocalInt(OBJECT_SELF, HENCH_AI_SHIELD_STATUS);
object oShield = GetItemInSlot(INVENTORY_SLOT_LEFTHAND);
if (iHaveShieldStatus == 2)
{
// not really a shield, get rid of
if (GetIsObjectValid(oShield))
{
ActionUnequipItem(oShield);
}
return;
}
if (iHaveShieldStatus == 1)
{
object oStoredShield = GetLocalObject(OBJECT_SELF, HENCH_AI_STORED_SHIELD);
if (oStoredShield == oShield)
{
return;
}
if (GetIsObjectValid(oStoredShield) && (GetItemPossessor(oStoredShield) == OBJECT_SELF))
{
ActionEquipItem(oStoredShield, INVENTORY_SLOT_LEFTHAND);
return;
}
}
int nMaxValue = 0;
int iCreatureSize = GetCreatureSize(OBJECT_SELF);
object oRealMaster = GetRealMaster();
int bNoPCMaster = !(GetIsObjectValid(oRealMaster) && GetIsPC(oRealMaster));
if (GetIsObjectValid(oShield))
{
int nSize = 1; // note start at one less so easy compare with creature size
switch (GetBaseItemType(oShield))
{
case BASE_ITEM_TOWERSHIELD:
nSize ++;
case BASE_ITEM_LARGESHIELD:
nSize ++;
case BASE_ITEM_SMALLSHIELD:
if (bNoPCMaster || GetIdentified(oShield))
{
int bPlotFlag = GetPlotFlag(oShield);
if (bPlotFlag)
{
SetPlotFlag(oShield, FALSE);
}
nMaxValue = GetGoldPieceValue(oShield);
if (bPlotFlag)
{
SetPlotFlag(oShield, TRUE);
}
}
else
{
nMaxValue = 2;
}
break;
/* case BASE_ITEM_TORCH:
nMaxValue = 1;
break; */
default:
// not a shield - remove
ActionUnequipItem(oShield);
oShield = OBJECT_INVALID;
break;
}
}
int iNewShield = FALSE;
int tempValue;
int bHasShieldProf = GetHasFeat(FEAT_SHIELD_PROFICIENCY);
int bCantUseShield = FALSE;
// int bCanUseTorch = (iCreatureSize > 1) && GetCreatureUseItems(OBJECT_SELF);
object oItem = GetFirstItemInInventory();
while (GetIsObjectValid(oItem))
{
// skip past any items in a container
if (GetHasInventory(oItem))
{
object oContainer = oItem;
object oSubItem = GetFirstItemInInventory(oContainer);
oItem = GetNextItemInInventory();
while (GetIsObjectValid(oSubItem))
{
oItem = GetNextItemInInventory();
oSubItem = GetNextItemInInventory(oContainer);
}
continue;
}
int nSize = 1; // note start at one less so easy compare with creature size
switch (GetBaseItemType(oItem))
{
case BASE_ITEM_TOWERSHIELD:
nSize ++;
case BASE_ITEM_LARGESHIELD:
nSize ++;
case BASE_ITEM_SMALLSHIELD:
if (bHasShieldProf && (iCreatureSize >= nSize))
{
if (bNoPCMaster || GetIdentified(oItem))
{
int bPlotFlag = GetPlotFlag(oItem);
if (bPlotFlag)
{
SetPlotFlag(oItem, FALSE);
}
tempValue = GetGoldPieceValue(oItem);
if (bPlotFlag)
{
SetPlotFlag(oItem, TRUE);
}
}
else
{
tempValue = 2;
}
if (tempValue > nMaxValue)
{
nMaxValue = tempValue;
oShield = oItem;
iNewShield = TRUE;
}
}
else
{
bCantUseShield = TRUE;
}
break;
/* case BASE_ITEM_TORCH:
if (bCanUseTorch && (1 > nMaxValue))
{
nMaxValue = 1;
oShield = oItem;
iNewShield = TRUE;
} */
break;
default:
break;
}
oItem = GetNextItemInInventory();
}
if (nMaxValue > 0)
{
SetLocalInt(OBJECT_SELF, HENCH_AI_SHIELD_STATUS, 1);
SetLocalObject(OBJECT_SELF, HENCH_AI_STORED_SHIELD, oShield);
}
else
{
SetLocalInt(OBJECT_SELF, HENCH_AI_SHIELD_STATUS, 2);
DeleteLocalObject(OBJECT_SELF, HENCH_AI_STORED_SHIELD);
}
if (iNewShield)
{
ActionEquipItem(oShield, INVENTORY_SLOT_LEFTHAND);
}
else if (bCantUseShield && bIndicateStatus)
{
SpeakString(sHenchCantUseShield);
}
}
int GetMeleeWeaponSize(object oItem)
{
if (GetWeaponRanged(oItem))
{
return 0;
}
int nBase = GetBaseItemType(oItem);
if (nBase == BASE_ITEM_TORCH)
{
return 0;
}
string sWeaponSizeStr = "HENCH_AI_WEAPON_SIZE_" + IntToString(nBase);
object oModule = GetModule();
int iWeaponSize = GetLocalInt(oModule, sWeaponSizeStr);
if (iWeaponSize == 0)
{
iWeaponSize = StringToInt(Get2DAString("baseitems", "WeaponSize", nBase));
if (iWeaponSize == 0)
{
iWeaponSize = -1;
}
SetLocalInt(oModule, sWeaponSizeStr, iWeaponSize);
}
if (iWeaponSize > 0)
{
return iWeaponSize;
}
return 0;
}
int GetInitWeaponStatus()
{
int nResult = GetLocalInt(OBJECT_SELF, HENCH_AI_WEAPON);
if (nResult)
{
return nResult;
}
int bHasMeleeWeapon;
int bHasMeleeAttack;
int bHasRangedWeapon;
object oItem = GetItemInSlot(INVENTORY_SLOT_RIGHTHAND);
if (GetIsObjectValid(oItem))
{
if (GetWeaponRanged(oItem))
{
bHasRangedWeapon = TRUE;
}
else if (GetMeleeWeaponSize(oItem) > 0)
{
bHasMeleeWeapon = TRUE;
}
}
oItem = GetFirstItemInInventory();
while (GetIsObjectValid(oItem) && !(bHasMeleeWeapon && bHasRangedWeapon))
{
// skip past any items in a container
if (GetHasInventory(oItem))
{
object oContainer = oItem;
object oSubItem = GetFirstItemInInventory(oContainer);
oItem = GetNextItemInInventory();
while (GetIsObjectValid(oSubItem))
{
oItem = GetNextItemInInventory();
oSubItem = GetNextItemInInventory(oContainer);
}
continue;
}
if (!bHasRangedWeapon && GetWeaponRanged(oItem))
{
bHasRangedWeapon = TRUE;
}
else if (!bHasMeleeWeapon && GetMeleeWeaponSize(oItem) > 0)
{
bHasMeleeWeapon = TRUE;
}
oItem = GetNextItemInInventory();
}
if (!bHasMeleeWeapon)
{
if (GetHasFeat(FEAT_IMPROVED_UNARMED_STRIKE))
{
bHasMeleeAttack = TRUE;
}
else if (GetIsObjectValid(GetItemInSlot(INVENTORY_SLOT_CWEAPON_R)))
{
bHasMeleeAttack = TRUE;
}
else if (GetIsObjectValid(GetItemInSlot(INVENTORY_SLOT_CWEAPON_B)))
{
bHasMeleeAttack = TRUE;
}
else if (GetIsObjectValid(GetItemInSlot(INVENTORY_SLOT_CWEAPON_L)))
{
bHasMeleeAttack = TRUE;
}
}
else
{
bHasMeleeAttack = TRUE;
}
if (bHasMeleeAttack)
{
nResult = HENCH_AI_WEAPON_INIT | HENCH_AI_HAS_MELEE;
}
else
{
nResult = HENCH_AI_WEAPON_INIT;
}
if (bHasMeleeWeapon)
{
nResult = nResult | HENCH_AI_HAS_MELEE_WEAPON;
}
if (bHasRangedWeapon)
{
nResult = nResult | HENCH_AI_HAS_RANGED_WEAPON;
}
SetLocalInt(OBJECT_SELF, HENCH_AI_WEAPON, nResult);
return nResult;
}
int EquipMeleeWeapons(object oTarget, int bIndicateStatus, int iCallNumber)
{
// float time = IntToFloat(GetTimeSecond()) + IntToFloat(GetTimeMillisecond()) /1000.0;
// Jug_Debug(GetName(OBJECT_SELF) + " equip melee vs. " + GetName(oTarget) + " call number " + IntToString(iCallNumber) + " time " + FloatToString(time));
int nWeaponStatus = GetInitWeaponStatus();
if (iCallNumber == 1)
{
if (!(nWeaponStatus & HENCH_AI_HAS_MELEE_WEAPON))
{
if ((nWeaponStatus & HENCH_AI_HAS_MELEE))
{
// no weapons, has creature attacks, make sure ranged weapons removed
UnequipWeapons();
}
return TRUE;
}
ActionEquipMostDamagingMelee(oTarget);
return FALSE;
}
object oRight = GetItemInSlot(INVENTORY_SLOT_RIGHTHAND);
int iCreatureSize = GetCreatureSize(OBJECT_SELF);
int iRWeaponSize = GetMeleeWeaponSize(oRight);
if (iRWeaponSize > iCreatureSize)
{
// two handed weapon - done
return TRUE;
}
// for dual weapon selection, must wait until right weapon is equipped
if (!GetIsObjectValid(oRight))
{
if (nWeaponStatus & HENCH_AI_HAS_MELEE)
{
return TRUE;
}
else
{
SetWeaponState(HENCH_AI_HAS_MELEE_WEAPON, FALSE);
return TRUE;
}
}
int dualWieldState = GetLocalInt(OBJECT_SELF, sHenchDualWieldState);
if (dualWieldState == 0)
{
dualWieldState = GetHasFeat(FEAT_TWO_WEAPON_FIGHTING) ? 1 : 2;
}
if (dualWieldState == 2)
{
EquipShield(bIndicateStatus);
return TRUE;
}
// already have something in left
object oOrigLeft = GetItemInSlot(INVENTORY_SLOT_LEFTHAND);
int iHaveOffHandStatus = GetLocalInt(OBJECT_SELF, HENCH_AI_OFF_HAND_STATUS);
if (iHaveOffHandStatus == 2)
{
EquipShield(bIndicateStatus);
return TRUE;
}
if (iHaveOffHandStatus == 1)
{
object oStoredOffHand = GetLocalObject(OBJECT_SELF, HENCH_AI_STORED_OFF_HAND);
if (oStoredOffHand == oOrigLeft)
{
return TRUE;
}
if (GetIsObjectValid(oStoredOffHand) && (GetItemPossessor(oStoredOffHand) == OBJECT_SELF) &&
oRight != oStoredOffHand)
{
ActionEquipItem(oStoredOffHand, INVENTORY_SLOT_LEFTHAND);
return TRUE;
}
}
object oLeft = OBJECT_INVALID;
int nLeftPrevEquip = GetIsObjectValid(oOrigLeft);
int nMaxValue = 0;
int iMaxWeaponSize = iCreatureSize;
if (GetLocalInt(OBJECT_SELF, sHenchLightOffHand) && (iRWeaponSize >= iCreatureSize))
{
iMaxWeaponSize--;
}
int iCurWeaponSize;
if (nLeftPrevEquip)
{
iCurWeaponSize = GetMeleeWeaponSize(oOrigLeft);
if (iCurWeaponSize != 0 && iCurWeaponSize <= iMaxWeaponSize)
{
if (GetIdentified(oOrigLeft))
{
int bPlotFlag = GetPlotFlag(oOrigLeft);
if (bPlotFlag)
{
SetPlotFlag(oOrigLeft, FALSE);
}
nMaxValue = GetGoldPieceValue(oOrigLeft);
if (bPlotFlag)
{
SetPlotFlag(oOrigLeft, TRUE);
}
}
else
{
nMaxValue = 1;
}
oLeft = oOrigLeft;
}
}
// Then look for more than 1 single handed melee weapon
int iNewOffHand = FALSE;
object oItem = GetFirstItemInInventory();
while (GetIsObjectValid(oItem))
{
// skip past any items in a container
if (GetHasInventory(oItem))
{
object oContainer = oItem;
object oSubItem = GetFirstItemInInventory(oContainer);
oItem = GetNextItemInInventory();
while (GetIsObjectValid(oSubItem))
{
oItem = GetNextItemInInventory();
oSubItem = GetNextItemInInventory(oContainer);
}
continue;
}
int nItemType = GetBaseItemType(oItem);
if (nItemType != BASE_ITEM_LIGHTFLAIL && nItemType != BASE_ITEM_MORNINGSTAR &&
nItemType != BASE_ITEM_WHIP)
{
iCurWeaponSize = GetMeleeWeaponSize(oItem);
if (iCurWeaponSize != 0 && iCurWeaponSize <= iMaxWeaponSize)
{
int tempValue;
if (GetIdentified(oItem))
{
int bPlotFlag = GetPlotFlag(oItem);
if (bPlotFlag)
{
SetPlotFlag(oItem, FALSE);
}
tempValue = GetGoldPieceValue(oItem);
if (bPlotFlag)
{
SetPlotFlag(oItem, TRUE);
}
}
else
{
tempValue = 1;
}
if (tempValue > nMaxValue)
{
nMaxValue = tempValue;
oLeft = oItem;
iNewOffHand = TRUE;
}
}
}
oItem = GetNextItemInInventory();
}
if (nMaxValue > 0)
{
SetLocalInt(OBJECT_SELF, HENCH_AI_OFF_HAND_STATUS, 1);
SetLocalObject(OBJECT_SELF, HENCH_AI_STORED_OFF_HAND, oLeft);
}
else
{
SetLocalInt(OBJECT_SELF, HENCH_AI_OFF_HAND_STATUS, 2);
DeleteLocalObject(OBJECT_SELF, HENCH_AI_STORED_OFF_HAND);
}
if (iNewOffHand)
{
ActionEquipItem(oLeft, INVENTORY_SLOT_LEFTHAND);
}
else if (GetIsObjectValid(oOrigLeft) && oOrigLeft == oLeft)
{
// nothing to do
}
else
{
EquipShield(bIndicateStatus);
}
return TRUE;
}
int EquipRangedWeapon(object oTarget, int bIndicateStatus, int iCallNumber)
{
// float time = IntToFloat(GetTimeSecond()) + IntToFloat(GetTimeMillisecond()) /1000.0;
//Jug_Debug(GetName(OBJECT_SELF) + " equip ranged vs. " + GetName(oTarget) + " call number " + IntToString(iCallNumber) + " time " + FloatToString(time));
if (iCallNumber == 1)
{
ActionEquipMostDamagingRanged(oTarget);
return FALSE;
}
object oRight = GetItemInSlot(INVENTORY_SLOT_RIGHTHAND);
if (!GetWeaponRanged(oRight))
{
if (iCallNumber == 2)
{
ActionWait(0.3);
return FALSE;
}
// object oRealMaster = GetRealMaster();
// if (GetIsObjectValid(oRealMaster) && GetIsPC(oRealMaster))
// {
// SpeakString(sHenchCantUseRanged);
// }
// Jug_Debug(GetName(OBJECT_SELF) + " turning off ranged weapons");
SetWeaponState(HENCH_AI_HAS_RANGED_WEAPON, FALSE);
SetLocalInt(OBJECT_SELF, "UseRangedWeapons", FALSE);
return EquipMeleeWeapons(oTarget, bIndicateStatus, 1);
}
switch (GetBaseItemType(oRight))
{
case BASE_ITEM_DART:
case BASE_ITEM_SHURIKEN:
case BASE_ITEM_SLING:
case BASE_ITEM_THROWINGAXE:
EquipShield(bIndicateStatus);
break;
}
return TRUE;
}
//::///////////////////////////////////////////////
//:: Equip Appropriate Weapons
//:: Copyright (c) 2001 Bioware Corp.
//:://////////////////////////////////////////////
/*
Makes the user get his best weapons. If the
user is a Henchmen then he checks the player
preference.
*/
//:://////////////////////////////////////////////
//:: Created By: Preston Watamaniuk
//:: Created On: April 2, 2002
//:://////////////////////////////////////////////
int HenchEquipAppropriateWeapons(object oTarget, float fThresholdDistance, int bIndicateSwitch, int bPolymorphed)
{
// Jug_Debug(GetName(OBJECT_SELF) + " trying out equip");
if (bPolymorphed)
{
return TRUE;
}
int nWeaponStatus = GetInitWeaponStatus();
int bUseRanged;
if (nWeaponStatus & HENCH_AI_HAS_RANGED_WEAPON)
{
// has ranged weapons
object oRealMaster = GetRealMaster();
if(GetIsObjectValid(oRealMaster) && GetIsPC(oRealMaster) && !GetAssociateState(NW_ASC_USE_RANGED_WEAPON))
{
bUseRanged = FALSE;
}
else
{
if (nWeaponStatus & HENCH_AI_HAS_MELEE)
{
// if has melee weapons (includes creature weapons & monk class)
// if z distance is greater than two then assume cliff
// TODO add size of creatures for distance?
bUseRanged = (GetDistanceToObject(oTarget) > fThresholdDistance) ||
(fabs(GetPosition(OBJECT_SELF).z - GetPosition(oTarget).z) > 2.0);
}
else
{
bUseRanged = TRUE;
}
}
}
else
{
bUseRanged = FALSE;
}
if (bIndicateSwitch && GetAssociateState(NW_ASC_USE_RANGED_WEAPON))
{
if (!(nWeaponStatus & HENCH_AI_HAS_RANGED_WEAPON))
{
DeleteLocalInt(OBJECT_SELF, HENCH_AI_SWITCHED_TO_MELEE);
}
else
{
int bSwitchedToMelee = GetLocalInt(OBJECT_SELF, HENCH_AI_SWITCHED_TO_MELEE);
if (bUseRanged && bSwitchedToMelee)
{
SpeakString(sHenchSwitchToMissle);
DeleteLocalInt(OBJECT_SELF, HENCH_AI_SWITCHED_TO_MELEE);
}
else if (!bUseRanged && !bSwitchedToMelee)
{
SpeakString(sHenchSwitchToRanged);
SetLocalInt(OBJECT_SELF, HENCH_AI_SWITCHED_TO_MELEE, TRUE);
}
}
}
SetLocalInt(OBJECT_SELF, "UseRangedWeapons", bUseRanged);
if (bUseRanged)
{
object oRight = GetItemInSlot(INVENTORY_SLOT_RIGHTHAND);
if (!GetWeaponRanged(oRight))
{
object oLeft = GetItemInSlot(INVENTORY_SLOT_LEFTHAND);
if (GetIsObjectValid(oLeft))
{
// get rid of weapon or shield
// shield or weapon in left hand prevents switch to ranged
ActionUnequipItem(oLeft);
ActionWait(0.3);
}
}
return EquipRangedWeapon(oTarget, bIndicateSwitch, 1);
}
else
{
return EquipMeleeWeapons(oTarget, bIndicateSwitch, 1);
}
}
void ActionContinueEquip(object oTarget, int bIndicateStatus, int iCallNumber)
{
if (GetLocalInt(OBJECT_SELF, "UseRangedWeapons"))
{
if (!EquipRangedWeapon(oTarget, bIndicateStatus, iCallNumber))
{
ActionDoCommand(ActionContinueEquip(oTarget, bIndicateStatus, iCallNumber + 1));
}
}
else
{
if (!EquipMeleeWeapons(oTarget, bIndicateStatus, iCallNumber))
{
ActionDoCommand(ActionContinueEquip(oTarget, bIndicateStatus, iCallNumber + 1));
}
}
}
const string sHenchShowWeaponStatus = "HenchShowWeaponStatus";
void HenchEquipDefaultWeapons(object oCreature = OBJECT_SELF, int bShowStatus = FALSE)
{
if (bShowStatus)
{
SetLocalInt(oCreature, sHenchShowWeaponStatus, TRUE);
}
ExecuteScript("hench_o0_equip", oCreature);
}
void ClearWeaponStates(object oCreature = OBJECT_SELF)
{
DeleteLocalInt(oCreature, HENCH_AI_SWITCHED_TO_MELEE);
DeleteLocalInt(oCreature, HENCH_AI_SHIELD_STATUS);
DeleteLocalObject(oCreature, HENCH_AI_STORED_SHIELD);
DeleteLocalInt(oCreature, HENCH_AI_OFF_HAND_STATUS);
DeleteLocalObject(oCreature, HENCH_AI_STORED_OFF_HAND);
DeleteLocalInt(oCreature, HENCH_AI_WEAPON);
}

View File

@@ -0,0 +1,654 @@
/*
Henchman Inventory And Battle AI
This file contains miscellaneous functions used by
many scripts.
*/
// void main() { }
#include "nw_i0_generic"
#include "x0_i0_voice"
#include "hench_i0_strings"
#include "hench_i0_options"
#include "hench_i0_conv"
// This constant somewhat matches taking a henchmen hit dice and converting to CR rating
const float HENCH_HITDICE_TO_CR = 0.7;
// general effects on self
const int HENCH_HAS_ETHEREAL_EFFECT = 0x001;
const int HENCH_HAS_CONCEALMENT_EFFECT = 0x002;
const int HENCH_HAS_INVISIBILITY_EFFECT = 0x004;
const int HENCH_HAS_SANTUARY_EFFECT = 0x008;
const int HENCH_HAS_DAZED_EFFECT = 0x010;
const int HENCH_HAS_CONFUSED_EFFECT = 0x020;
const int HENCH_HAS_CHARMED_EFFECT = 0x040;
const int HENCH_HAS_POLYMORPH_EFFECT = 0x080;
const int HENCH_HAS_HASTE_EFFECT = 0x100;
const int HENCH_HAS_TIMESTOP_EFFECT = 0x200;
const string sHenchSummonedFamiliar = "HenchSummonedFamiliar";
const string sHenchSummonedAniComp = "HenchSummonedAniComp";
const string sHenchPseudoSummon = "HenchPseudoSummon";
const string sHenchDontAttackFlag = "DoNotAttack";
const string sHenchScoutingFlag = "Scouting";
const string sHenchScoutTarget = "ScoutTarget";
const string sHenchRunningAway = "RunningAway";
const int HENCH_HEAL_SELF_UNKNOWN = 0;
const int HENCH_HEAL_SELF_CANT = 1;
const int HENCH_HEAL_SELF_WAIT = 2;
const int HENCH_HEAL_SELF_IN_PROG = 3;
const string HENCH_HEAL_SELF_STATE = "HenchHealSelfState";
// As MyPrintString, but to screen instead of log
void Jug_Debug(string sString);
// returns TRUE if any one of the two effect types are present
int GetHasAnyEffect2(int nEffectType1, int nEffectType2, object oTarget = OBJECT_SELF);
// returns TRUE if the target is disabled
int GetIsDisabled(object oTarget);
// returns TRUE if the target is disabled or has another effect
int GetIsDisabled1(int nOtherEffect, object oTarget);
// returns TRUE if the target is disabled or has another effect
int GetIsDisabled2(int nOtherEffect1, int nOtherEffect2, object oTarget);
// returns TRUE if racial type is a humanoid
int GetIsHumanoid(int nRacial);
// returns TRUE if creature can use items from their inventory
int GetCreatureUseItems(object oCreature);
// returns TRUE if the item property is present in any one of the equipped items
int GetCreatureHasItemProperty(int nItemProperty, object oCreature = OBJECT_SELF);
// set array access for objects
void SetObjectArray(object oSource, string sName, int iElem, object oElem);
// get array access for objects
object GetObjectArray(object oSource, string sName, int iElem);
// set array access for ints
void SetIntArray(object oSource, string sName, int iElem, int iState);
// get array access for ints
int GetIntArray(object oSource, string sName, int iElem);
// set array access for floats
void SetFloatArray(object oSource, string sName, int iElem, float fVal);
// get array access for floats
float GetFloatArray(object oSource, string sName, int iElem);
// returns TRUE if object1 and object are on opposite sides of door
int IsOnOppositeSideOfDoor(object oDoor, object obj1, object obj2);
// stores the last spell cast (no timeout)
void HenchSetLastGenericSpellCast(int nSpell);
// returns the highest level master of oAssociate
// returns OBJECT_INVALID if no master
object GetRealMaster(object oAssociate = OBJECT_SELF);
// returns the highest level master of oAssociate
// returns OBJECT_SELF if no master
object GetTopMaster(object oAssociate = OBJECT_SELF);
// converts a prestige class into the best matching primary class
int HenchConvertClass(int nClass, object oCharacter);
// returns the class type that best represents oCharacter
int HenchDetermineClassToUse(object oCharacter = OBJECT_SELF);
// Cleans all temporary values used during combat
void CleanCombatVars();
// As MyPrintString, but to screen instead of log
void Jug_Debug(string sString)
{
SendMessageToPC(GetFirstPC(), sString);
}
int GetHasAnyEffect2(int nEffectType1, int nEffectType2, object oTarget = OBJECT_SELF)
{
effect eCheck = GetFirstEffect(oTarget);
while(GetIsEffectValid(eCheck))
{
int nTestEffect = GetEffectType(eCheck);
if(nTestEffect == nEffectType1)
{
return TRUE;
}
if(nTestEffect == nEffectType2)
{
return TRUE;
}
eCheck = GetNextEffect(oTarget);
}
return FALSE;
}
int GetIsDisabled(object oTarget)
{
effect eCheck = GetFirstEffect(oTarget);
while(GetIsEffectValid(eCheck))
{
switch (GetEffectType(eCheck))
{
case EFFECT_TYPE_PARALYZE:
case EFFECT_TYPE_STUNNED:
case EFFECT_TYPE_FRIGHTENED:
case EFFECT_TYPE_SLEEP:
case EFFECT_TYPE_DAZED:
case EFFECT_TYPE_CONFUSED:
case EFFECT_TYPE_TURNED:
case EFFECT_TYPE_PETRIFY:
return TRUE;
}
eCheck = GetNextEffect(oTarget);
}
return FALSE;
}
int GetIsDisabled1(int nOtherEffect, object oTarget)
{
effect eCheck = GetFirstEffect(oTarget);
while(GetIsEffectValid(eCheck))
{
int nTestEffect = GetEffectType(eCheck);
switch (nTestEffect)
{
case EFFECT_TYPE_PARALYZE:
case EFFECT_TYPE_STUNNED:
case EFFECT_TYPE_FRIGHTENED:
case EFFECT_TYPE_SLEEP:
case EFFECT_TYPE_DAZED:
case EFFECT_TYPE_CONFUSED:
case EFFECT_TYPE_TURNED:
case EFFECT_TYPE_PETRIFY:
return TRUE;
}
if (nTestEffect == nOtherEffect)
{
return TRUE;
}
eCheck = GetNextEffect(oTarget);
}
return FALSE;
}
int GetIsDisabled2(int nOtherEffect1, int nOtherEffect2, object oTarget)
{
effect eCheck = GetFirstEffect(oTarget);
while(GetIsEffectValid(eCheck))
{
int nTestEffect = GetEffectType(eCheck);
switch (nTestEffect)
{
case EFFECT_TYPE_PARALYZE:
case EFFECT_TYPE_STUNNED:
case EFFECT_TYPE_FRIGHTENED:
case EFFECT_TYPE_SLEEP:
case EFFECT_TYPE_DAZED:
case EFFECT_TYPE_CONFUSED:
case EFFECT_TYPE_TURNED:
case EFFECT_TYPE_PETRIFY:
return TRUE;
}
if (nTestEffect == nOtherEffect1)
{
return TRUE;
}
if (nTestEffect == nOtherEffect2)
{
return TRUE;
}
eCheck = GetNextEffect(oTarget);
}
return FALSE;
}
int GetIsHumanoid(int nRacial)
{
return
(nRacial == RACIAL_TYPE_DWARF) ||
(nRacial == RACIAL_TYPE_ELF) ||
(nRacial == RACIAL_TYPE_GNOME) ||
(nRacial == RACIAL_TYPE_HUMANOID_GOBLINOID) ||
(nRacial == RACIAL_TYPE_HALFLING) ||
(nRacial == RACIAL_TYPE_HUMAN) ||
(nRacial == RACIAL_TYPE_HALFELF) ||
(nRacial == RACIAL_TYPE_HALFORC) ||
(nRacial == RACIAL_TYPE_HUMANOID_MONSTROUS) ||
(nRacial == RACIAL_TYPE_HUMANOID_ORC) ||
(nRacial == RACIAL_TYPE_HUMANOID_REPTILIAN);
}
int GetCreatureUseItems(object oCreature)
{
if (GetIsPlayableRacialType(oCreature))
{
return TRUE;
}
int nRace = GetRacialType(oCreature);
if ((nRace >= RACIAL_TYPE_HUMANOID_GOBLINOID && nRace <= RACIAL_TYPE_HUMANOID_REPTILIAN) ||
nRace == RACIAL_TYPE_FEY || nRace == RACIAL_TYPE_GIANT)
{
return TRUE;
}
int nAppearanceType = GetAppearanceType(oCreature);
if (nRace == RACIAL_TYPE_UNDEAD)
{
return nAppearanceType != APPEARANCE_TYPE_DRACOLICH &&
nAppearanceType != APPEARANCE_TYPE_SKELETAL_DEVOURER &&
nAppearanceType != APPEARANCE_TYPE_ALLIP;
}
if (nAppearanceType >= APPEARANCE_TYPE_DWARF && nAppearanceType <= APPEARANCE_TYPE_HUMAN)
{
return TRUE;
}
if (nRace == RACIAL_TYPE_ABERRATION)
{
return nAppearanceType == APPEARANCE_TYPE_MINDFLAYER ||
nAppearanceType == APPEARANCE_TYPE_MINDFLAYER_2 ||
nAppearanceType == APPEARANCE_TYPE_MINDFLAYER_ALHOON ||
nAppearanceType == APPEARANCE_TYPE_DRIDER ||
nAppearanceType == APPEARANCE_TYPE_DRIDER_CHIEF ||
nAppearanceType == APPEARANCE_TYPE_DRIDER_FEMALE ||
GetCreatureUseItemsOverride(oCreature);
}
if (nRace == RACIAL_TYPE_OUTSIDER)
{
return nAppearanceType == APPEARANCE_TYPE_SUCCUBUS ||
nAppearanceType == APPEARANCE_TYPE_AZER_MALE ||
nAppearanceType == APPEARANCE_TYPE_AZER_FEMALE ||
nAppearanceType == APPEARANCE_TYPE_RAKSHASA_TIGER_FEMALE ||
nAppearanceType == APPEARANCE_TYPE_RAKSHASA_TIGER_FEMALE ||
GetCreatureUseItemsOverride(oCreature);
}
return GetCreatureUseItemsOverride(oCreature);
}
int GetCreatureHasItemProperty(int nItemProperty, object oCreature = OBJECT_SELF)
{
int i;
for (i = 0; i < NUM_INVENTORY_SLOTS; i++)
{
object oItem = GetItemInSlot(i, oCreature);
if(GetItemHasItemProperty(oItem, nItemProperty))
{
return TRUE;
}
}
return FALSE;
}
void SetObjectArray(object oSource, string sName, int iElem, object oElem)
{
string sFull = sName+IntToString(iElem);
SetLocalObject(oSource,sFull,oElem);
}
object GetObjectArray(object oSource, string sName, int iElem)
{
string sFull = sName+IntToString(iElem);
return GetLocalObject(oSource,sFull);
}
void SetIntArray(object oSource, string sName, int iElem, int iState)
{
string sFull = sName+IntToString(iElem);
SetLocalInt(oSource,sFull,iState);
}
int GetIntArray(object oSource, string sName, int iElem)
{
string sFull = sName+IntToString(iElem);
return GetLocalInt(oSource,sFull);
}
void SetFloatArray(object oSource, string sName, int iElem, float fVal)
{
string sFull = sName+IntToString(iElem);
SetLocalFloat(oSource,sFull,fVal);
}
float GetFloatArray(object oSource, string sName, int iElem)
{
string sFull = sName+IntToString(iElem);
return GetLocalFloat(oSource,sFull);
}
int IsOnOppositeSideOfDoor(object oDoor, object obj1, object obj2)
{
float fDoorAngle = GetFacing(oDoor);
vector vDoor = GetPositionFromLocation(GetLocation(oDoor));
vector v1 = GetPositionFromLocation(GetLocation(obj1));
vector v2 = GetPositionFromLocation(GetLocation(obj2));
float fAngle1 = VectorToAngle(v1 - vDoor);
float fAngle2 = VectorToAngle(v2 - vDoor);
fAngle1 -= fDoorAngle;
fAngle2 -= fDoorAngle;
if (fAngle1 < 0.0)
{
fAngle1 += 360.0;
}
if (fAngle2 < 0.0)
{
fAngle2 += 360.0;
}
int bSide1 = fAngle1 < 90.0 || fAngle1 > 270.0;
int bSide2 = fAngle2 < 90.0 || fAngle2 > 270.0;
return bSide1 != bSide2;
}
void HenchSetLastGenericSpellCast(int nSpell)
{
SetLocalInt(OBJECT_SELF, "NW_GENERIC_LAST_SPELL", nSpell);
}
//69MEH69 GetRealMaster Code
object GetRealMaster(object oAssociate = OBJECT_SELF)
{
object oMaster = GetMaster(oAssociate);
if (GetIsObjectValid(oMaster))
{
while (GetIsObjectValid(GetMaster(oMaster)))
{
oMaster = GetMaster(oMaster);
}
}
return oMaster;
}
object GetTopMaster(object oAssociate = OBJECT_SELF)
{
object oRetVal = oAssociate;
object oMaster = GetMaster(oAssociate);
while (GetIsObjectValid(oMaster))
{
oRetVal = oMaster;
oMaster = GetMaster(oMaster);
}
return oRetVal;
}
object GetTopAssociate(object oAssociate = OBJECT_SELF)
{
object oRetVal = oAssociate;
object oMaster = GetMaster(oAssociate);
if (GetIsObjectValid(oMaster))
{
while (GetIsObjectValid(GetMaster(oMaster)))
{
oRetVal = oMaster;
oMaster = GetMaster(oMaster);
}
}
return oRetVal;
}
int HenchConvertClass(int nClass, object oCharacter)
{
switch(nClass)
{
case CLASS_TYPE_SHADOWDANCER:
case CLASS_TYPE_ASSASSIN:
return CLASS_TYPE_ROGUE;
case CLASS_TYPE_HARPER:
case CLASS_TYPE_ARCANE_ARCHER:
case CLASS_TYPE_DRAGON_DISCIPLE:
return CLASS_TYPE_BARD;
case CLASS_TYPE_SHIFTER:
return CLASS_TYPE_DRUID;
case CLASS_TYPE_PALE_MASTER:
return GetClassByPosition(1, oCharacter);
}
return nClass;
}
int HenchDetermineClassToUse(object oCharacter = OBJECT_SELF)
{
int nClass;
int nTotal = GetHitDice(oCharacter);
if (nTotal < 1)
{
nTotal = 1;
}
int nClassLevel1 = GetLevelByPosition(1, oCharacter);
int nClass1 = GetClassByPosition(1, oCharacter);
// quick exit
if (nClassLevel1 >= nTotal)
{
return nClass1;
}
int nClassLevel2 = GetLevelByPosition(2, oCharacter);
int nClass2 = GetClassByPosition(2, oCharacter);
int nClassLevel3 = GetLevelByPosition(3, oCharacter);
int nClass3 = GetClassByPosition(3, oCharacter);
// blackguard over everthing else
if (nClass1 == CLASS_TYPE_BLACKGUARD || nClass2 == CLASS_TYPE_BLACKGUARD ||
nClass3 == CLASS_TYPE_BLACKGUARD)
{
return CLASS_TYPE_BLACKGUARD;
}
if (nClass1 == CLASS_TYPE_DIVINE_CHAMPION || nClass2 == CLASS_TYPE_DIVINE_CHAMPION ||
nClass3 == CLASS_TYPE_DIVINE_CHAMPION)
{
return CLASS_TYPE_DIVINE_CHAMPION;
}
if (nClass1 == CLASS_TYPE_WEAPON_MASTER || nClass2 == CLASS_TYPE_WEAPON_MASTER ||
nClass3 == CLASS_TYPE_WEAPON_MASTER)
{
return CLASS_TYPE_WEAPON_MASTER;
}
if (nClass1 == CLASS_TYPE_DWARVEN_DEFENDER || nClass2 == CLASS_TYPE_DWARVEN_DEFENDER ||
nClass3 == CLASS_TYPE_DWARVEN_DEFENDER)
{
return CLASS_TYPE_DWARVEN_DEFENDER;
}
// adjust classes to remove prestige
nClass1 = HenchConvertClass(nClass1, oCharacter);
nClass2 = HenchConvertClass(nClass2, oCharacter);
nClass3 = HenchConvertClass(nClass3, oCharacter);
if (nClass1 == nClass2)
{
nClassLevel1 += nClassLevel2;
nClassLevel2 = 0;
}
if (nClass1 == nClass3)
{
nClassLevel1 += nClassLevel3;
nClassLevel3 = 0;
}
if (nClass2 == nClass3)
{
nClassLevel2 += nClassLevel3;
nClassLevel3 = 0;
}
// find top class
int nMaxClassLevel = nClassLevel1 >= nClassLevel2 ? nClassLevel1 : nClassLevel2;
nMaxClassLevel = nMaxClassLevel >= nClassLevel3 ? nMaxClassLevel : nClassLevel3;
// filter out classes less than two levels below the max
if (nMaxClassLevel - 1 > nClassLevel1)
{
nClassLevel1 = 0;
}
if (nMaxClassLevel - 1 > nClassLevel2)
{
nClassLevel2 = 0;
}
if (nMaxClassLevel - 1 > nClassLevel3)
{
nClassLevel3 = 0;
}
nTotal = nClassLevel1 + nClassLevel2 + nClassLevel3;
int nPickClass = Random(nTotal);
nPickClass -= nClassLevel1;
if (nPickClass < 0)
{
return nClass1;
}
nPickClass -= nClassLevel2;
if (nPickClass < 0)
{
return nClass2;
}
return nClass3;
}
int CheckStealth()
{
int nStealthCheck = GetLocalInt(OBJECT_SELF, "canStealth");
if (nStealthCheck == 0)
{
nStealthCheck = ((GetSkillRank(SKILL_HIDE, OBJECT_SELF, TRUE) > 0) ||
(GetSkillRank(SKILL_MOVE_SILENTLY, OBJECT_SELF, TRUE) > 0)) ? 1 : 2;
SetLocalInt(OBJECT_SELF, "canStealth", nStealthCheck);
}
return nStealthCheck == 1;
}
void SetCombatMode(int nCombatMode = -1)
{
int index;
for (index = ACTION_MODE_PARRY; index <= ACTION_MODE_DIRTY_FIGHTING; index ++)
{
int bEnable = nCombatMode == index;
if (GetActionMode(OBJECT_SELF, index) != bEnable)
{
if (bEnable)
{
ActionDoCommand(SetActionMode(OBJECT_SELF, index, TRUE));
}
else
{
SetActionMode(OBJECT_SELF, index, bEnable);
}
}
}
}
const string sHenchLastAttackLocation = "HENCH_LAST_ATTACK_LOC";
void UseCombatAttack(object oTarget, int nFeatID = -1, int nCombatMode = -1)
{
SetCombatMode(nCombatMode);
if (nFeatID < 0)
{
ActionAttack(oTarget);
}
else
{
ActionUseFeat(nFeatID, oTarget);
}
SetLocalLocation(OBJECT_SELF, sHenchLastAttackLocation, GetLocation(OBJECT_SELF));
//const string sHenchLastAttackLocation = "HENCH_LAST_ATTACK_LOC";
}
const string henchCombatRoundStr = "tkCombatRoundCount";
const string henchLastDraBrStr = "tkLastDragonBreath";
const string henchLastDispelStr = "tkLastDispel";
const string henchLastDomStr = "tkLastDominate";
const string henchLastTurnStr = "tkLastTurning";
const string henchSpellKnownFlagsStr = "HenchSpellKnownFlags";
const string henchNoAttackSpStr = "tkNoAttackSpellTalents";
const string henchNoEnhanceSpStr = "tkNoEnhanceSpellTalents";
const string henchNoCondSpStr = "tkNoConditionalSpellTalents";
const string henchNoPotionStr = "tkNoPotions";
const string henchBuffCountStr = "HenchCurBuffCount";
const string henchHealCountStr = "HenchCurHealCount";
const string sHenchLastTarget = "LastTarget";
const string sHenchShouldIAttackMessageGiven = "HenchShouldIAttackMessageGiven";
const int HENCH_MAIN_SPELL_SERIES = 0x1;
const int HENCH_CURE_COND_SPELL = 0x2;
int GetSpellUnknownFlag(int flag)
{
return GetLocalInt(OBJECT_SELF, henchSpellKnownFlagsStr) & flag;
}
void SetSpellUnknownFlag(int flag)
{
SetLocalInt(OBJECT_SELF, henchSpellKnownFlagsStr, GetLocalInt(OBJECT_SELF, henchSpellKnownFlagsStr) | flag);
}
void CleanCombatVars()
{
DeleteLocalInt(OBJECT_SELF, henchCombatRoundStr);
DeleteLocalInt(OBJECT_SELF, henchLastDraBrStr);
DeleteLocalInt(OBJECT_SELF, henchLastDispelStr);
DeleteLocalInt(OBJECT_SELF, henchLastDomStr);
DeleteLocalInt(OBJECT_SELF, henchLastTurnStr);
DeleteLocalInt(OBJECT_SELF, henchSpellKnownFlagsStr);
DeleteLocalInt(OBJECT_SELF, henchNoAttackSpStr);
DeleteLocalInt(OBJECT_SELF, henchNoEnhanceSpStr);
DeleteLocalInt(OBJECT_SELF, henchNoCondSpStr);
DeleteLocalInt(OBJECT_SELF, henchNoPotionStr);
DeleteLocalInt(OBJECT_SELF, "CloseRangeEnhanced");
DeleteLocalObject(OBJECT_SELF, sHenchLastTarget);
DeleteLocalLocation(OBJECT_SELF, sHenchLastAttackLocation);
DeleteLocalInt(OBJECT_SELF, sHenchShouldIAttackMessageGiven);
}
void ReportUnseenAllies()
{
location testTargetLoc = GetLocation(OBJECT_SELF);
object oAllyTest = GetFirstObjectInShape(SHAPE_SPHERE, 20.0, testTargetLoc, TRUE, OBJECT_TYPE_CREATURE);
while (GetIsObjectValid(oAllyTest))
{
if (!GetObjectSeen(oAllyTest) && GetIsPC(GetTopMaster(oAllyTest)))
{
SpeakString(sHenchCantSeeTarget + GetName(oAllyTest));
}
oAllyTest = GetNextObjectInShape(SHAPE_SPHERE, 20.0, testTargetLoc, TRUE, OBJECT_TYPE_CREATURE);
}
}

File diff suppressed because it is too large Load Diff

Some files were not shown because too many files have changed in this diff Show More