Initial Commit

Initial Commit
This commit is contained in:
Jaysyn904
2023-09-21 19:51:32 -04:00
parent 65b5bd7fd3
commit 102ba7dab6
6400 changed files with 5741850 additions and 0 deletions

View File

@@ -0,0 +1,22 @@
/*69_client_enter
OnClientEnter Module Event
Checks for Leadership, if TRUE sets maximum henchmen
on PC
Created by: 69MEH69
Created on: Sep2004
*/
#include "69_hench_lib"
void main()
{
object oPC = GetEnteringObject();
int nLeadership = GetLocalInt(GetModule(), "nLeadership");
if(nLeadership == 1)
{
//SendMessageToPC(oPC, "Leadership = 1"); //Test
SetMaxHenchmen69(oPC);
}
}

View File

@@ -0,0 +1,18 @@
/*69_client_exit
OnClientExit Module Event
Runs multiple checks for exiting player
Created by: 69MEH69
Created on: Apr2005
*/
#include "69_hench_lib"
void main()
{
object oPC = GetExitingObject();
if(GetIsPC(oPC))
{
QuitHenchman69(oPC);
}
}

125
_module/nss/69_esc_conv.nss Normal file
View File

@@ -0,0 +1,125 @@
//:://////////////////////////////////////////////////
//:: 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);
// CUSTOM CODE
//if (nMatch != ASSOCIATE_COMMAND_LEAVEPARTY)
// END CUSTOM CODE
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,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));
}
}

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

@@ -0,0 +1,125 @@
//:://////////////////////////////////////////////////
//:: 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);
// CUSTOM CODE
if (nMatch != ASSOCIATE_COMMAND_LEAVEPARTY)
// END CUSTOM CODE
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,405 @@
//::///////////////////////////////////////////////
//:: Henchman Death Script
//::
//:: 69_hen_death
//::
//:: Copyright (c) 2001 Bioware Corp.
//:://////////////////////////////////////////////
//:: <description>
//:://////////////////////////////////////////////
//::
//:: Created By: 69MEH69 Jul 2004 Henchman Death Option
//:://////////////////////////////////////////////
#include "69_hench_lib"
#include "x3_inc_horse"
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 RemoveAndStore(object oPC)
{
//This chunk of code saves the henchman into the database so that it can be "revived" in a tavern
if (!GetIsDead(OBJECT_SELF)) return; //do nothing if the henchman is alive by the time this fires
SetIsDestroyable(TRUE, TRUE, TRUE);
int nHenchPosition = GetLocalInt(OBJECT_SELF, "HenchPosition");
string sHenchPosition = IntToString(nHenchPosition);
int nIsRanged = GetAssociateState(NW_ASC_USE_RANGED_WEAPON);
string sHenchName = GetName(OBJECT_SELF);
SetCampaignInt(CharacterDB(oPC), "HENCH_"+sHenchPosition+"_RANGED", nIsRanged);
StoreCampaignObject(CharacterDB(oPC), "HENCH_"+sHenchPosition, OBJECT_SELF);
DelayCommand(1.0, SetCampaignString(CharacterDB(oPC), "HENCH_"+sHenchPosition+"_NAME", sHenchName));
RespawnHenchman69(OBJECT_SELF);
//End of this chunk of code
}
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(), sName+ "'s 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);
//Remove the horse if the resurrected henchman is mounted - riding would be too good if you didn't lose your horse upon death.
if (HorseGetIsMounted(OBJECT_SELF) == TRUE)
{
HorseInstantDismount(OBJECT_SELF);
}
//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) //henchman respawn death, henchman will respawn to location defined in spawn script
{
if(GetIsObjectValid(oMaster))
{
if(TEST_MODE == 1)
{
SendMessageToPC(GetFirstPC(), sName+" is not bleeding");
}
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) //henchman bleeding
{
if(GetIsObjectValid(oMaster))
{
if(TEST_MODE == 1)
{
SendMessageToPC(GetFirstPC(), sName+" is bleeding");
}
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!");
SetIsDestroyable(FALSE, TRUE, TRUE);
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(12.0, HenchmanBleed(OBJECT_SELF));
}
}
} //End HENCH_BLEED = 1
else if(HENCH_BLEED == 2) //henchman destruction, henchman will be destroyed upon death
{
if(GetIsObjectValid(oMaster))
{
if(TEST_MODE == 1)
{
SendMessageToPC(GetFirstPC(), sName+" is destroyed");
}
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) //henchman to respawn at PC master's location after 30.0 seconds
{
if(GetIsObjectValid(oMaster))
{
if(TEST_MODE == 1)
{
SendMessageToPC(GetFirstPC(), sName+" is respawning");
}
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
//Remove the corpse (if it hasn't been ressed) and store the henchman in a database
if (HENCH_BLEED == 0) DelayCommand(60.0, RemoveAndStore(oPC));
}
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(12.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,402 @@
//::///////////////////////////////////////////////
//:: Henchman Death Script
//::
//:: 69_hen_death
//::
//:: Copyright (c) 2001 Bioware Corp.
//:://////////////////////////////////////////////
//:: <description>
//:://////////////////////////////////////////////
//::
//:: Created By: 69MEH69 Jul 2004 Henchman Death Option
//:://////////////////////////////////////////////
#include "69_hench_lib"
#include "x3_inc_horse"
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(), sName+ "'s 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);
//Remove the horse if the resurrected henchman is mounted - riding would be too good if you didn't lose your horse upon death.
if (HorseGetIsMounted(OBJECT_SELF) == TRUE)
{
HorseInstantDismount(OBJECT_SELF);
}
//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) //henchman respawn death, henchman will respawn to location defined in spawn script
{
if(GetIsObjectValid(oMaster))
{
if(TEST_MODE == 1)
{
SendMessageToPC(GetFirstPC(), sName+" is not bleeding");
}
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) //henchman bleeding
{
if(GetIsObjectValid(oMaster))
{
if(TEST_MODE == 1)
{
SendMessageToPC(GetFirstPC(), sName+" is bleeding");
}
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!");
SetIsDestroyable(FALSE, TRUE, TRUE);
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(12.0, HenchmanBleed(OBJECT_SELF));
}
}
} //End HENCH_BLEED = 1
else if(HENCH_BLEED == 2) //henchman destruction, henchman will be destroyed upon death
{
if(GetIsObjectValid(oMaster))
{
if(TEST_MODE == 1)
{
SendMessageToPC(GetFirstPC(), sName+" is destroyed");
}
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) //henchman to respawn at PC master's location after 30.0 seconds
{
if(GetIsObjectValid(oMaster))
{
if(TEST_MODE == 1)
{
SendMessageToPC(GetFirstPC(), sName+" is respawning");
}
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
//This chunk of code saves the henchman into the database so that it can be "revived" in a tavern
int nHenchNumber = GetCampaignInt(CharacterDB(oPC), "HENCH_NUMBER");
int nHenchPosition;
if(GetCampaignString(CharacterDB(oPC), "HENCH_1_NAME") == "") nHenchPosition = 1;
else if(GetCampaignString(CharacterDB(oPC), "HENCH_2_NAME") == "") nHenchPosition = 2;
else if(GetCampaignString(CharacterDB(oPC), "HENCH_3_NAME") == "") nHenchPosition = 3;
else return;
string sHenchPosition = IntToString(nHenchPosition);
int nIsRanged = GetAssociateState(NW_ASC_USE_RANGED_WEAPON);
string sHenchName = GetName(OBJECT_SELF);
SetCampaignInt(CharacterDB(oPC), "HENCH_"+sHenchPosition+"_RANGED", nIsRanged);
StoreCampaignObject(CharacterDB(oPC), "HENCH_"+sHenchPosition, OBJECT_SELF);
SetCampaignInt(CharacterDB(oPC), "HENCH_NUMBER", nHenchNumber+1);
DelayCommand(1.0, SetCampaignString(CharacterDB(oPC), "HENCH_"+sHenchPosition+"_NAME", sHenchName));
//End of this chunk of code
}
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(12.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,341 @@
//::///////////////////////////////////////////////
//:: 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"
void EpicBonuses()
{
object oPC = OBJECT_SELF; //I know it's not a PC, but it makes it easier to just copy the code from the PC's heartbeat
int nACBonus;
int nSRBonus;
int nLevel = GetHitDice(oPC);
effect eEffect;
if ( GetTag(GetItemInSlot(INVENTORY_SLOT_HEAD, oPC)) == "anc_it_epiche" || GetItemPossessedBy(oPC, "anc_it_actrinket") != OBJECT_INVALID) //if the NPC has an epic helmet equipped or an AC trinket in their inventory
{
switch (nLevel)
{
case 40: nACBonus = 12; break;
case 39: nACBonus = 12; break;
case 38: nACBonus = 11; break;
case 37: nACBonus = 11; break;
case 36: nACBonus = 11; break;
case 35: nACBonus = 10; break;
case 34: nACBonus = 9; break;
case 33: nACBonus = 8; break;
case 32: nACBonus = 8; break;
case 31: nACBonus = 7; break;
case 30: nACBonus = 7; break;
case 29: nACBonus = 7; break;
case 28: nACBonus = 7; break;
case 27: nACBonus = 6; break;
case 26: nACBonus = 6; break;
case 25: nACBonus = 5; break;
case 24: nACBonus = 5; break;
case 23: nACBonus = 4; break;
case 22: nACBonus = 4; break;
default: nACBonus = 3; break;
}
eEffect = ExtraordinaryEffect(EffectACIncrease(nACBonus, AC_DEFLECTION_BONUS));
ApplyEffectToObject(DURATION_TYPE_TEMPORARY, eEffect, oPC, 6.0);
}
if (GetTag(GetItemInSlot(INVENTORY_SLOT_CHEST, oPC)) == "anc_it_epicar") //if the NPC has an epic armor equipped
{
switch (nLevel)
{
case 40: nACBonus = 13; break;
case 39: nACBonus = 13; break;
case 38: nACBonus = 12; break;
case 37: nACBonus = 12; break;
case 36: nACBonus = 12; break;
case 35: nACBonus = 10; break;
case 34: nACBonus = 9; break;
case 33: nACBonus = 9; break;
case 32: nACBonus = 9; break;
case 31: nACBonus = 8; break;
case 30: nACBonus = 8; break;
case 29: nACBonus = 7; break;
case 28: nACBonus = 7; break;
case 27: nACBonus = 6; break;
case 26: nACBonus = 6; break;
case 25: nACBonus = 6; break;
case 24: nACBonus = 6; break;
case 23: nACBonus = 4; break;
case 22: nACBonus = 4; break;
default: nACBonus = 3; break;
}
eEffect = ExtraordinaryEffect(EffectACIncrease(nACBonus, AC_ARMOUR_ENCHANTMENT_BONUS));
ApplyEffectToObject(DURATION_TYPE_TEMPORARY, eEffect, oPC, 6.0);
}
if (GetTag(GetItemInSlot(INVENTORY_SLOT_BELT, oPC)) == "anc_it_epicsr") //if the NPC has an epic belt equipped
{
nSRBonus = nLevel-18;
if (nLevel < 21) nSRBonus = 12;
nSRBonus = nSRBonus*2 + 10;
eEffect = ExtraordinaryEffect(EffectSpellResistanceIncrease(nSRBonus));
ApplyEffectToObject(DURATION_TYPE_TEMPORARY, eEffect, oPC, 6.0);
}
//Apply Dwarven Defender damage reduction
if (GetHasFeat(1118, oPC))
{
int nReduction;
switch (GetLevelByClass(CLASS_TYPE_DWARVEN_DEFENDER, oPC))
{
case 6: nReduction = 3; break;
case 7: nReduction = 3; break;
case 8: nReduction = 3; break;
case 9: nReduction = 3; break;
case 10: nReduction = 6; break;
case 11: nReduction = 6; break;
case 12: nReduction = 6; break;
case 13: nReduction = 6; break;
case 14: nReduction = 9; break;
case 15: nReduction = 9; break;
case 16: nReduction = 9; break;
case 17: nReduction = 9; break;
case 18: nReduction = 12; break;
case 19: nReduction = 12; break;
case 20: nReduction = 12; break;
case 21: nReduction = 12; break;
case 22: nReduction = 15; break;
case 23: nReduction = 15; break;
case 24: nReduction = 15; break;
case 25: nReduction = 15; break;
case 26: nReduction = 18; break;
case 27: nReduction = 18; break;
case 28: nReduction = 18; break;
case 29: nReduction = 18; break;
case 30: nReduction = 21; break;
}
effect eReduction = EffectDamageReduction(nReduction, DAMAGE_POWER_PLUS_FIVE);
eReduction = SupernaturalEffect(eReduction);
AssignCommand(GetModule(), ApplyEffectToObject(DURATION_TYPE_TEMPORARY, eReduction, oPC, 6.0));
}
//Done applying damage reduction
//Check for Parry being used and apply bonus then
if (GetActionMode(oPC, ACTION_MODE_PARRY)==TRUE)
{
int nParryAC = GetSkillRank(SKILL_PARRY, oPC) / 5;
if(nParryAC>6)nParryAC=6;
effect eParryAC = SupernaturalEffect(EffectACIncrease(nParryAC, AC_DODGE_BONUS));
ApplyEffectToObject(DURATION_TYPE_TEMPORARY, eParryAC, oPC, 6.0);
}
//End of Parry part
//Halve the normal Tumble AC bonus and restrict Pale Master AC bonus to 6
if (GetSkillRank(SKILL_TUMBLE, oPC, TRUE) != 0 || GetLevelByClass(CLASS_TYPE_PALE_MASTER, oPC) > 11)
{
int nOld = GetSkillRank(SKILL_TUMBLE, oPC, TRUE)/5;
int nNew = GetSkillRank(SKILL_TUMBLE, oPC, TRUE)/10;
int nPalePenalty;
switch (GetLevelByClass(CLASS_TYPE_PALE_MASTER, oPC))
{
case 30: nPalePenalty = 10; break;
case 29: nPalePenalty = 10; break;
case 28: nPalePenalty = 10; break;
case 27: nPalePenalty = 8; break;
case 26: nPalePenalty = 8; break;
case 25: nPalePenalty = 8; break;
case 24: nPalePenalty = 8; break;
case 23: nPalePenalty = 6; break;
case 22: nPalePenalty = 6; break;
case 21: nPalePenalty = 6; break;
case 20: nPalePenalty = 6; break;
case 19: nPalePenalty = 4; break;
case 18: nPalePenalty = 4; break;
case 17: nPalePenalty = 4; break;
case 16: nPalePenalty = 4; break;
case 15: nPalePenalty = 2; break;
case 14: nPalePenalty = 2; break;
case 13: nPalePenalty = 2; break;
case 12: nPalePenalty = 2; break;
}
int nPenalty = nOld - nNew;
if ( GetLevelByClass(CLASS_TYPE_PALE_MASTER, oPC) > 11) nPenalty = nPenalty + nPalePenalty;
effect eEffect = SupernaturalEffect(EffectACDecrease(nPenalty, AC_DODGE_BONUS));
AssignCommand(GetModule(), ApplyEffectToObject(DURATION_TYPE_TEMPORARY, eEffect, oPC, 6.0));
}
// Grant the PC dragon immunity if he has that feat
if ( GetHasFeat(1116, oPC) == TRUE )
{
int nType;
switch(GetCreatureWingType(oPC))
{
case 4: nType = DAMAGE_TYPE_FIRE; break; //red dragon disciple
case 34: nType = DAMAGE_TYPE_ACID; break; //black dragon disciple
case 35: nType = DAMAGE_TYPE_ELECTRICAL; break; //blue dragon disciple
case 36: nType = DAMAGE_TYPE_FIRE; break; //brass dragon disciple
case 37: nType = DAMAGE_TYPE_ELECTRICAL; break; //bronze dragon disciple
case 38: nType = DAMAGE_TYPE_ACID; break; //copper dragon disciple
case 39: nType = DAMAGE_TYPE_FIRE; break; //gold dragon disciple
case 40: nType = DAMAGE_TYPE_ACID; break; //green dragon disciple
case 41: nType = DAMAGE_TYPE_COLD; break; //silver dragon disciple
case 42: nType = DAMAGE_TYPE_COLD; break; //white dragon disciple
default: nType = DAMAGE_TYPE_FIRE; break;
}
effect eImmunity = ExtraordinaryEffect(EffectDamageImmunityIncrease(nType, 100));
AssignCommand(GetModule(), ApplyEffectToObject(DURATION_TYPE_TEMPORARY, eImmunity, oPC, 6.0));
}
DelayCommand(6.0, EpicBonuses());
}
void main()
{
EpicBonuses(); //launch the pseudo-heartbeat for all the dynamic penalties/bonuses for the henchman
//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", 5.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,342 @@
//::///////////////////////////////////////////////
//:: 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"
void EpicBonuses()
{
object oPC = OBJECT_SELF; //I know it's not a PC, but it makes it easier to just copy the code from the PC's heartbeat
int nACBonus;
int nSRBonus;
int nLevel = GetHitDice(oPC);
effect eEffect;
if ( GetTag(GetItemInSlot(INVENTORY_SLOT_HEAD, oPC)) == "anc_it_epiche" || GetItemPossessedBy(oPC, "anc_it_actrinket") != OBJECT_INVALID) //if the NPC has an epic helmet equipped or an AC trinket in their inventory
{
switch (nLevel)
{
case 40: nACBonus = 12; break;
case 39: nACBonus = 12; break;
case 38: nACBonus = 11; break;
case 37: nACBonus = 11; break;
case 36: nACBonus = 11; break;
case 35: nACBonus = 10; break;
case 34: nACBonus = 9; break;
case 33: nACBonus = 8; break;
case 32: nACBonus = 8; break;
case 31: nACBonus = 7; break;
case 30: nACBonus = 7; break;
case 29: nACBonus = 7; break;
case 28: nACBonus = 7; break;
case 27: nACBonus = 6; break;
case 26: nACBonus = 6; break;
case 25: nACBonus = 5; break;
case 24: nACBonus = 5; break;
case 23: nACBonus = 4; break;
case 22: nACBonus = 4; break;
default: nACBonus = 3; break;
}
eEffect = ExtraordinaryEffect(EffectACIncrease(nACBonus, AC_DEFLECTION_BONUS));
ApplyEffectToObject(DURATION_TYPE_TEMPORARY, eEffect, oPC, 6.0);
}
if (GetTag(GetItemInSlot(INVENTORY_SLOT_CHEST, oPC)) == "anc_it_epicar") //if the NPC has an epic armor equipped
{
switch (nLevel)
{
case 40: nACBonus = 13; break;
case 39: nACBonus = 13; break;
case 38: nACBonus = 12; break;
case 37: nACBonus = 12; break;
case 36: nACBonus = 12; break;
case 35: nACBonus = 10; break;
case 34: nACBonus = 9; break;
case 33: nACBonus = 9; break;
case 32: nACBonus = 9; break;
case 31: nACBonus = 8; break;
case 30: nACBonus = 8; break;
case 29: nACBonus = 7; break;
case 28: nACBonus = 7; break;
case 27: nACBonus = 6; break;
case 26: nACBonus = 6; break;
case 25: nACBonus = 6; break;
case 24: nACBonus = 6; break;
case 23: nACBonus = 4; break;
case 22: nACBonus = 4; break;
default: nACBonus = 3; break;
}
eEffect = ExtraordinaryEffect(EffectACIncrease(nACBonus, AC_ARMOUR_ENCHANTMENT_BONUS));
ApplyEffectToObject(DURATION_TYPE_TEMPORARY, eEffect, oPC, 6.0);
}
if (GetTag(GetItemInSlot(INVENTORY_SLOT_BELT, oPC)) == "anc_it_epicsr") //if the NPC has an epic belt equipped
{
nSRBonus = nLevel-18;
if (nLevel < 21) nSRBonus = 12;
nSRBonus = nSRBonus*2 + 10;
eEffect = ExtraordinaryEffect(EffectSpellResistanceIncrease(nSRBonus));
ApplyEffectToObject(DURATION_TYPE_TEMPORARY, eEffect, oPC, 6.0);
}
//Apply Dwarven Defender damage reduction
if (GetHasFeat(1118, oPC))
{
int nReduction;
switch (GetLevelByClass(CLASS_TYPE_DWARVEN_DEFENDER, oPC))
{
case 6: nReduction = 3; break;
case 7: nReduction = 3; break;
case 8: nReduction = 3; break;
case 9: nReduction = 3; break;
case 10: nReduction = 6; break;
case 11: nReduction = 6; break;
case 12: nReduction = 6; break;
case 13: nReduction = 6; break;
case 14: nReduction = 9; break;
case 15: nReduction = 9; break;
case 16: nReduction = 9; break;
case 17: nReduction = 9; break;
case 18: nReduction = 12; break;
case 19: nReduction = 12; break;
case 20: nReduction = 12; break;
case 21: nReduction = 12; break;
case 22: nReduction = 15; break;
case 23: nReduction = 15; break;
case 24: nReduction = 15; break;
case 25: nReduction = 15; break;
case 26: nReduction = 18; break;
case 27: nReduction = 18; break;
case 28: nReduction = 18; break;
case 29: nReduction = 18; break;
case 30: nReduction = 21; break;
}
effect eReduction = EffectDamageReduction(nReduction, DAMAGE_POWER_PLUS_FIVE);
eReduction = SupernaturalEffect(eReduction);
AssignCommand(GetModule(), ApplyEffectToObject(DURATION_TYPE_TEMPORARY, eReduction, oPC, 6.0));
}
//Done applying damage reduction
//Check for Parry being used and apply bonus then
if (GetActionMode(oPC, ACTION_MODE_PARRY)==TRUE)
{
int nParryAC = GetSkillRank(SKILL_PARRY, oPC) / 5;
if(nParryAC>6)nParryAC=6;
effect eParryAC = SupernaturalEffect(EffectACIncrease(nParryAC, AC_DODGE_BONUS));
ApplyEffectToObject(DURATION_TYPE_TEMPORARY, eParryAC, oPC, 6.0);
}
//End of Parry part
//Halve the normal Tumble AC bonus and restrict Pale Master AC bonus to 6
if (GetSkillRank(SKILL_TUMBLE, oPC, TRUE) != 0 || GetLevelByClass(CLASS_TYPE_PALE_MASTER, oPC) > 11)
{
int nOld = GetSkillRank(SKILL_TUMBLE, oPC, TRUE)/5;
int nNew = GetSkillRank(SKILL_TUMBLE, oPC, TRUE)/10;
int nPalePenalty;
switch (GetLevelByClass(CLASS_TYPE_PALE_MASTER, oPC))
{
case 30: nPalePenalty = 10; break;
case 29: nPalePenalty = 10; break;
case 28: nPalePenalty = 10; break;
case 27: nPalePenalty = 8; break;
case 26: nPalePenalty = 8; break;
case 25: nPalePenalty = 8; break;
case 24: nPalePenalty = 8; break;
case 23: nPalePenalty = 6; break;
case 22: nPalePenalty = 6; break;
case 21: nPalePenalty = 6; break;
case 20: nPalePenalty = 6; break;
case 19: nPalePenalty = 4; break;
case 18: nPalePenalty = 4; break;
case 17: nPalePenalty = 4; break;
case 16: nPalePenalty = 4; break;
case 15: nPalePenalty = 2; break;
case 14: nPalePenalty = 2; break;
case 13: nPalePenalty = 2; break;
case 12: nPalePenalty = 2; break;
}
int nPenalty = nOld - nNew;
if ( GetLevelByClass(CLASS_TYPE_PALE_MASTER, oPC) > 11) nPenalty = nPenalty + nPalePenalty;
effect eEffect = SupernaturalEffect(EffectACDecrease(nPenalty, AC_DODGE_BONUS));
AssignCommand(GetModule(), ApplyEffectToObject(DURATION_TYPE_TEMPORARY, eEffect, oPC, 6.0));
}
// Grant the PC dragon immunity if he has that feat
if ( GetHasFeat(1116, oPC) == TRUE )
{
int nType;
switch(GetCreatureWingType(oPC))
{
case 4: nType = DAMAGE_TYPE_FIRE; break; //red dragon disciple
case 34: nType = DAMAGE_TYPE_ACID; break; //black dragon disciple
case 35: nType = DAMAGE_TYPE_ELECTRICAL; break; //blue dragon disciple
case 36: nType = DAMAGE_TYPE_FIRE; break; //brass dragon disciple
case 37: nType = DAMAGE_TYPE_ELECTRICAL; break; //bronze dragon disciple
case 38: nType = DAMAGE_TYPE_ACID; break; //copper dragon disciple
case 39: nType = DAMAGE_TYPE_FIRE; break; //gold dragon disciple
case 40: nType = DAMAGE_TYPE_ACID; break; //green dragon disciple
case 41: nType = DAMAGE_TYPE_COLD; break; //silver dragon disciple
case 42: nType = DAMAGE_TYPE_COLD; break; //white dragon disciple
default: nType = DAMAGE_TYPE_FIRE; break;
}
effect eImmunity = ExtraordinaryEffect(EffectDamageImmunityIncrease(nType, 100));
AssignCommand(GetModule(), ApplyEffectToObject(DURATION_TYPE_TEMPORARY, eImmunity, oPC, 6.0));
}
DelayCommand(6.0, EpicBonuses());
}
void main()
{
EpicBonuses(); //launch the pseudo-heartbeat for all the dynamic penalties/bonuses for the henchman
//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", FALSE);
//Sets the distance from the enemy that the henchman will switch to melee weapons
SetLocalFloat(OBJECT_SELF, "HenchRange", 5.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, TRUE);
//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_PALADIN, OBJECT_SELF) >= 4 || GetLevelByClass(CLASS_TYPE_RANGER, OBJECT_SELF) >= 4 || 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,56 @@
//69_hench_heall
//Henchman will attempt to heal the most injured in party
//Created by: 69MEH69
#include "nw_i0_generic"
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(GetRacialType(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(GetRacialType(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);
}
if(GetHasFeat(FEAT_LAY_ON_HANDS))
{
ClearAllActions();
ActionUseFeat(FEAT_LAY_ON_HANDS, oTarget);
}
else
{
ActionSpeakString("I am all out of healing.", 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,29 @@
//:://////////////////////////////////////////////////
//:: 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));
}
}

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);
}
}

1807
_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,22 @@
//:://////////////////////////////////////////////////
//:: 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();
SetIsDestroyable(TRUE, TRUE, TRUE);
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) || GetLocalInt(OBJECT_SELF, "COMBAT_FLAG_SWITCH"))
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,19 @@
/*69_henchrt_enter
OnEnter Event for initial area or trigger that player enters module.
Retrieves henchmen from database for module to module transfer
Created by: 69MEH69
Created on: Feb2005
*/
#include "69_hench_lib"
void main()
{
object oPC = GetEnteringObject();
if(GetLocalInt(oPC, "Enter_Module") == 0)
{
SetLocalInt(oPC, "Enter_Module", 1);
RetrieveCampaignHenchman69(oPC);
}
}

View File

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

View File

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

View File

@@ -0,0 +1,46 @@
/* 69_henchstore_exit
Place in any On* event of placeable, trigger, NPC etc. to store henchmen in database
to intialize transfer from module to module
TAG of placeable or trigger is the name of new module
Created By: 69MEH69
Created On: Feb2005
*/
#include "69_hench_lib"
void main()
{
object oPC = GetLastUsedBy();
string sTag = GetTag(OBJECT_SELF);
if (!GetIsObjectValid(oPC))
oPC = GetLastUnlocked();
if (!GetIsObjectValid(oPC))
oPC = GetClickingObject();
if (!GetIsObjectValid(oPC))
oPC = GetEnteringObject();
if (!GetIsObjectValid(oPC))
oPC = GetExitingObject();
if (!GetIsObjectValid(oPC))
oPC = GetLastOpenedBy();
if (!GetIsObjectValid(oPC))
oPC = GetLastDisturbed();
if (!GetIsObjectValid(oPC))
oPC = GetPCSpeaker();
if (!GetIsObjectValid(oPC))
oPC = GetLastOpenedBy();
if (!GetIsObjectValid(oPC))
oPC = GetLastKiller();
StoreCampaignHenchman69(oPC);
DelayCommand(10.0, StartNewModule(sTag));
}

View File

@@ -0,0 +1,88 @@
//:::::::::::::::::::::::::::::::::::::::::::::::::::
//::69_henchtrans By: 69MEH69 Date: Jan2003
//::Place this script in the AreaOnTransitonClick
//::event for any in area transition, a transition
//::which takes the PC to another location within
//::the same area. This script will insure that any
//::henchman, familiar, animal companion, summoned
//::and/or dominated creature will also make the
//::transition.
//::Put a check in for whether the associate is
//::standing their ground, If the henchman is they will
//::NOT transition
//:::::::::::::::::::::::::::::::::::::::::::::::::::
#include "69_inc_henai"
void main()
{
object oClicker = GetClickingObject();
object oTarget = GetTransitionTarget(OBJECT_SELF);
location lLoc = GetLocation(oTarget);
int nNth = 1;
object oHench = GetHenchman(oClicker, nNth);
object oFamiliar, oAnimal, oSummoned, oDominated;
float fFace = GetFacingFromLocation(lLoc);
AssignCommand(oClicker,JumpToLocation(lLoc));
AssignCommand(oClicker, SetFacing(fFace));
if(GetAssociate(ASSOCIATE_TYPE_FAMILIAR, oClicker) != OBJECT_INVALID)
{
oFamiliar = GetAssociate(ASSOCIATE_TYPE_FAMILIAR, oClicker);
if(!GetAssociateState(NW_ASC_MODE_STAND_GROUND, oFamiliar))
{
AssignCommand(oFamiliar, JumpToLocation(lLoc));
}
}
if(GetAssociate(ASSOCIATE_TYPE_ANIMALCOMPANION, oClicker) != OBJECT_INVALID)
{
oAnimal = GetAssociate(ASSOCIATE_TYPE_ANIMALCOMPANION, oClicker);
if(!GetAssociateState(NW_ASC_MODE_STAND_GROUND, oAnimal))
{
AssignCommand(oAnimal, JumpToLocation(lLoc));
}
}
if(GetAssociate(ASSOCIATE_TYPE_SUMMONED, oClicker) != OBJECT_INVALID)
{
oSummoned = GetAssociate(ASSOCIATE_TYPE_SUMMONED, oClicker);
if(!GetAssociateState(NW_ASC_MODE_STAND_GROUND, oSummoned))
{
AssignCommand(oSummoned, JumpToLocation(lLoc));
}
}
if(GetAssociate(ASSOCIATE_TYPE_DOMINATED, oClicker) != OBJECT_INVALID)
{
oDominated = GetAssociate(ASSOCIATE_TYPE_DOMINATED, oClicker);
if(!GetAssociateState(NW_ASC_MODE_STAND_GROUND, oDominated))
{
AssignCommand(oDominated, JumpToLocation(lLoc));
}
}
while(oHench != OBJECT_INVALID)
{
if(!GetAssociateState(NW_ASC_MODE_STAND_GROUND, oHench))
{
AssignCommand(oHench, JumpToLocation(lLoc));
if(GetAssociate(ASSOCIATE_TYPE_FAMILIAR, oHench) != OBJECT_INVALID)
{
oFamiliar = GetAssociate(ASSOCIATE_TYPE_FAMILIAR, oHench);
AssignCommand(oFamiliar, JumpToLocation(lLoc));
}
if(GetAssociate(ASSOCIATE_TYPE_ANIMALCOMPANION, oHench) != OBJECT_INVALID)
{
oAnimal = GetAssociate(ASSOCIATE_TYPE_ANIMALCOMPANION, oHench);
AssignCommand(oAnimal, JumpToLocation(lLoc));
}
if(GetAssociate(ASSOCIATE_TYPE_SUMMONED, oHench) != OBJECT_INVALID)
{
oSummoned = GetAssociate(ASSOCIATE_TYPE_SUMMONED, oHench);
AssignCommand(oSummoned, JumpToLocation(lLoc));
}
if(GetAssociate(ASSOCIATE_TYPE_DOMINATED, oHench) != OBJECT_INVALID)
{
oDominated = GetAssociate(ASSOCIATE_TYPE_DOMINATED, oHench);
AssignCommand(oDominated, JumpToLocation(lLoc));
}
}
oHench = GetHenchman(oClicker, nNth++);
}
}

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,224 @@
//::///////////////////////////////////////////////
//:: OnLoad Script
//:: 69_module_load
//:: (c) 2003 Bioware Corp.
//:://////////////////////////////////////////////
/*
Put into: OnModuleLoad Event
This example script demonstrates how to tweak the
behavior of several subsystems in your module.
For more information, please check x2_inc_switches
which holds definitions for several variables that
can be set on modules, creatures, doors or waypoints
to change the default behavior of Bioware scripts.
Warning:
Using some of these switches may change your games
balancing and may introduce bugs or instabilities. We
recommend that you only use these switches if you
know what you are doing. Consider these features
unsupported!
Please do NOT report any bugs you experience while
these switches have been changed from their default
positions.
Make sure you visit the forums at nwn.bioware.com
to find out more about these scripts.
*/
//:://////////////////////////////////////////////
//:: Created By: Georg Zoeller
//:: Created On: 2003-07-16
//:: Modified: 69MEH69
//:://////////////////////////////////////////////
#include "x2_inc_switches"
#include "x2_inc_restsys"
void main()
{
//Henchman Kit Definitions 69MEH69
//Sets Database Name for your Module
//Useful for transfering henchmen from module to module
//Insure that all the transfering modules use the same database
string sDB = "MBHKit";
SetLocalString(GetModule(), "X0_CAMPAIGN_DB", sDB);
//Sets testing mode
//Useful for debugging and/or viewing feedback
//Set TEST_MODE = 1 to initiate test mode
//Set TEST_MODE = 0 to disable test mode (Default)
int TEST_MODE = 0;
SetLocalInt(GetModule(), "TEST_MODE", TEST_MODE);
//PC death option:
//Set PC_BLEEDING = 1 to initiate PC bleeding (-10 HP) & Raise Dead/Resurrection by a healer henchman
//Set PC_BLEEDING = 0 to initiate default BIOWARE PC death
int PC_BLEEDING = 0;
SetLocalInt(GetModule(), "PC_BLEEDING", PC_BLEEDING);
//Henchman Death Option:
//Set HENCH_BLEED = 3 for henchman to respawn at PC master's location after 30.0 seconds
//Set HENCH_BLEED = 2 for henchman destruction, henchman will be destroyed upon death
//Set HENCH_BLEED = 1 for henchman bleeding
//Set HENCH_BLEED = 0 for respawn death, henchman will respawn
// to location defined in spawn script
int HENCH_BLEED = 0;
SetLocalInt(GetModule(), "HENCH_BLEED", HENCH_BLEED);
//Set HENCH_SALVATION = 1 to allow for the possibility of
//henchman recovering from wounds each round
//Set HENCH_SALVATION = 0 to allow only one check for the
//possibility of henchman recovering from wounds
//Only available if HENCH_BLEED = 1;
int HENCH_SALVATION = 0;
SetLocalInt(GetModule(), "HENCH_SALVATION", HENCH_SALVATION);
//Sets whether henchman will gain own XP or level up with PC
//Will initiate the 3rd edition DMG XP code
//Adjust the XP slider to 0 in Module Properties.
//0 = Levels up when PC levels up
//1 = Henchman gains own personal XP
int nHenchXP = 0;
SetLocalInt(GetModule(), "HENCHXP", nHenchXP);
//Sets whether henchman retain level or level down to level 1
//Will destroy NPC and create original level 1 version at original spawn location
//determined by waypoint with TAG: "WP_Home_'NPC TAG'"
//OR Henchman will be destroyed permanently
//The 69_hench_quit script will initiate on the following dialog node:
// "No, I work better alone."
//0 = Retains leveled up henchman
//1 = NPC is destroyed and level 1 version is created at waypoint
//2 = NPC is destroyed
int nHenchQuit = 0;
SetLocalInt(GetModule(), "HENCHQUIT", nHenchQuit);
//Sets whether henchmen will autolevel up at hire:
//0 = must level up henchman through dialog
//1 = henchman will automatically level up at hire
int nAutoLevelup = 1;
SetLocalInt(GetModule(), "nAutoLevelup", nAutoLevelup);
//Sets Leadership requirement upon module:
//0 = No Leadership, 1 = Yes Leadership
int nLeadership = 0;
SetLocalInt(GetModule(), "nLeadership", nLeadership);
if(nLeadership == 1)
{
SetMaxHenchmen(100); //Do Not Edit
}
//Sets Loyalty requirement upon module:
//0 = No Loyalty, 1 = Yes Loyalty
int nLoyalty = 0;
SetLocalInt(GetModule(), "nLoyalty", nLoyalty);
//Maximum Henchmen
//Sets the number of henchman a PC may have:
//(Leadership requirement must be set to 0)
//0,1,2...
int nNumHench = 3;
if(nLeadership == 0)
{
SetMaxHenchmen(nNumHench);
}
//End Henchman Kit Definitions 69MEH69
//Other Definitions
if (GetGameDifficulty() == GAME_DIFFICULTY_CORE_RULES || GetGameDifficulty() == GAME_DIFFICULTY_DIFFICULT)
{
// * Setting the switch below will enable a seperate Use Magic Device Skillcheck for
// * rogues when playing on Hardcore+ difficulty. This only applies to scrolls
SetModuleSwitch (MODULE_SWITCH_ENABLE_UMD_SCROLLS, TRUE);
// * Activating the switch below will make AOE spells hurt neutral NPCS by default
// SetModuleSwitch (MODULE_SWITCH_AOE_HURT_NEUTRAL_NPCS, TRUE);
}
// * AI: Activating the switch below will make the creaures using the WalkWaypoint function
// * able to walk across areas
// SetModuleSwitch (MODULE_SWITCH_ENABLE_CROSSAREA_WALKWAYPOINTS, TRUE);
// * Spells: Activating the switch below will make the Glyph of Warding spell behave differently:
// * The visual glyph will disappear after 6 seconds, making them impossible to spot
// SetModuleSwitch (MODULE_SWITCH_ENABLE_INVISIBLE_GLYPH_OF_WARDING, TRUE);
// * Craft Feats: Want 50 charges on a newly created wand? We found this unbalancing,
// * but since it is described this way in the book, here is the switch to get it back...
// SetModuleSwitch (MODULE_SWITCH_ENABLE_CRAFT_WAND_50_CHARGES, TRUE);
// * Craft Feats: Use this to disable Item Creation Feats if you do not want
// * them in your module
// SetModuleSwitch (MODULE_SWITCH_DISABLE_ITEM_CREATION_FEATS, TRUE);
// * Palemaster: Deathless master touch in PnP only affects creatures up to a certain size.
// * We do not support this check for balancing reasons, but you can still activate it...
// SetModuleSwitch (MODULE_SWITCH_SPELL_CORERULES_DMASTERTOUCH, TRUE);
// * Epic Spellcasting: Some Epic spells feed on the liveforce of the caster. However this
// * did not fit into NWNs spell system and was confusing, so we took it out...
// SetModuleSwitch (MODULE_SWITCH_EPIC_SPELLS_HURT_CASTER, TRUE);
// * Epic Spellcasting: Some Epic spells feed on the liveforce of the caster. However this
// * did not fit into NWNs spell system and was confusing, so we took it out...
// SetModuleSwitch (MODULE_SWITCH_RESTRICT_USE_POISON_TO_FEAT, TRUE);
// * Spellcasting: Some people don't like caster's abusing expertise to raise their AC
// * Uncommenting this line will drop expertise mode whenever a spell is cast by a player
// SetModuleSwitch (MODULE_VAR_AI_STOP_EXPERTISE_ABUSE, TRUE);
// * Item Event Scripts: The game's default event scripts allow routing of all item related events
// * into a single file, based on the tag of that item. If an item's tag is "test", it will fire a
// * script called "test" when an item based event (equip, unequip, acquire, unacquire, activate,...)
// * is triggered. Check "x2_it_example.nss" for an example.
// * This feature is disabled by default.
SetModuleSwitch (MODULE_SWITCH_ENABLE_TAGBASED_SCRIPTS, TRUE);
if (GetModuleSwitchValue (MODULE_SWITCH_ENABLE_TAGBASED_SCRIPTS) == TRUE)
{
// * If Tagbased scripts are enabled, and you are running a Local Vault Server
// * you should use the line below to add a layer of security to your server, preventing
// * people to execute script you don't want them to. If you use the feature below,
// * all called item scrips will be the prefix + the Tag of the item you want to execute, up to a
// * maximum of 16 chars, instead of the pure tag of the object.
// * i.e. without the line below a user activating an item with the tag "test",
// * will result in the execution of a script called "test". If you uncomment the line below
// * the script called will be "1_test.nss"
// SetUserDefinedItemEventPrefix("1_");
}
// * This initializes Bioware's wandering monster system as used in Hordes of the Underdark
// * You can deactivate it, making your module load faster if you do not use it.
// * If you want to use it, make sure you set "x2_mod_def_rest" as your module's OnRest Script
// SetModuleSwitch (MODULE_SWITCH_USE_XP2_RESTSYSTEM, TRUE);
if (GetModuleSwitchValue(MODULE_SWITCH_USE_XP2_RESTSYSTEM) == TRUE)
{
// * This allows you to specify a different 2da for the wandering monster system.
// SetWanderingMonster2DAFile("des_restsystem");
//* Do not change this line.
WMBuild2DACache();
}
}

114
_module/nss/69_o0_death.nss Normal file
View File

@@ -0,0 +1,114 @@
//::///////////////////////////////////////////////
//:: Death Script
//:: 69_O0_DEATH.NSS
//:: Copyright (c) 2001 Bioware Corp.
//:://////////////////////////////////////////////
/*
This script handles the default behavior
that occurs when a player dies.
BK: October 8 2002: Overriden for Expansion
*/
//:://////////////////////////////////////////////
//:: Created By: Brent Knowles
//:: Created On: November 6, 2001
//:: Modified: 69MEH69 SEP2005
//:://////////////////////////////////////////////
#include "69_hench_lib"
const float DeathPanel_Delay = 6.0; //Set delay of Death GUI Panel, 6.0 = one round
void DeathPanel(object oPlayer)
{
if(GetIsDead(oPlayer))
{
PopUpDeathGUIPanel(oPlayer,TRUE,TRUE,64521);
}
}
void Raise(object oPlayer)
{
effect eVisual = EffectVisualEffect(VFX_IMP_RESTORATION);
effect eBad = GetFirstEffect(oPlayer);
ApplyEffectToObject(DURATION_TYPE_INSTANT,EffectResurrection(),oPlayer);
ApplyEffectToObject(DURATION_TYPE_INSTANT,EffectHeal(GetMaxHitPoints(oPlayer)), oPlayer);
//Search for negative effects
while(GetIsEffectValid(eBad))
{
if (GetEffectType(eBad) == EFFECT_TYPE_ABILITY_DECREASE ||
GetEffectType(eBad) == EFFECT_TYPE_AC_DECREASE ||
GetEffectType(eBad) == EFFECT_TYPE_ATTACK_DECREASE ||
GetEffectType(eBad) == EFFECT_TYPE_DAMAGE_DECREASE ||
GetEffectType(eBad) == EFFECT_TYPE_DAMAGE_IMMUNITY_DECREASE ||
GetEffectType(eBad) == EFFECT_TYPE_SAVING_THROW_DECREASE ||
GetEffectType(eBad) == EFFECT_TYPE_SPELL_RESISTANCE_DECREASE ||
GetEffectType(eBad) == EFFECT_TYPE_SKILL_DECREASE ||
GetEffectType(eBad) == EFFECT_TYPE_BLINDNESS ||
GetEffectType(eBad) == EFFECT_TYPE_DEAF ||
GetEffectType(eBad) == EFFECT_TYPE_PARALYZE ||
GetEffectType(eBad) == EFFECT_TYPE_NEGATIVELEVEL)
{
//Remove effect if it is negative.
RemoveEffect(oPlayer, eBad);
}
eBad = GetNextEffect(oPlayer);
}
//Fire cast spell at event for the specified target
SignalEvent(oPlayer, EventSpellCastAt(OBJECT_SELF, SPELL_RESTORATION, FALSE));
ApplyEffectToObject(DURATION_TYPE_INSTANT, eVisual, oPlayer);
}
void main()
{
int PC_BLEEDING = GetLocalInt(GetModule(), "PC_BLEEDING");
object oPlayer = GetLastPlayerDied();
string sPlayer = GetName(oPlayer);
float fDelay = DeathPanel_Delay; //Amount of seconds before Death GUI panel pops up
// * increment global tracking number of times that I died
SetLocalInt(oPlayer, "NW_L_PLAYER_DIED", GetLocalInt(oPlayer, "NW_L_PLAYER_DIED") + 1);
if(PC_BLEEDING == 1)
{
//Henchman Cleric Code
int nNum = 1;
object oHealer = GetHenchman(oPlayer, nNum);
while(oHealer != OBJECT_INVALID)
{
HenchRessurect69(oPlayer, oHealer);
oHealer = GetHenchman(oPlayer, ++nNum);
}
}
//End Henchman Cleric Code
// * make friendly to Each of the 3 common factions
AssignCommand(oPlayer, ClearAllActions());
if (GetStandardFactionReputation(STANDARD_FACTION_COMMONER, oPlayer) <= 10)
{ SetLocalInt(oPlayer, "NW_G_Playerhasbeenbad", 10); // * Player bad
SetStandardFactionReputation(STANDARD_FACTION_COMMONER, 80, oPlayer);
}
if (GetStandardFactionReputation(STANDARD_FACTION_MERCHANT, oPlayer) <= 10)
{ SetLocalInt(oPlayer, "NW_G_Playerhasbeenbad", 10); // * Player bad
SetStandardFactionReputation(STANDARD_FACTION_MERCHANT, 80, oPlayer);
}
if (GetStandardFactionReputation(STANDARD_FACTION_DEFENDER, oPlayer) <= 10)
{ SetLocalInt(oPlayer, "NW_G_Playerhasbeenbad", 10); // * Player bad
SetStandardFactionReputation(STANDARD_FACTION_DEFENDER, 80, oPlayer);
}
// * BK: Automation Control. Autopcs ignore death
if(GetLocalInt(oPlayer, "NW_L_AUTOMATION") == 10)
{
Raise(oPlayer);
DelayCommand(1.0, ExecuteScript("crawl", OBJECT_SELF));
return; // Raise and return
}
if(GetHenchmanTotal69(oPlayer) > 0)
{
fDelay = 30.0 + fDelay;
}
DelayCommand(fDelay, DeathPanel(oPlayer));
}

144
_module/nss/69_o0_dying.nss Normal file
View File

@@ -0,0 +1,144 @@
//::///////////////////////////////////////////////
//:: Dying Script
//:: 69_o0_dying.nss
//:://////////////////////////////////////////////
/*
This script handles the default behavior
that occurs when a character is dying. Dying
is when the character is between 0 and -9 hit
points; -10 and below is death. To use, redirect
the OnDying event script of the module to this script.
*/
//:://////////////////////////////////////////////
//:: Author : 69MEH69 AUG2003
//:: Modified: 69MEH69 SEP2005
//:://////////////////////////////////////////////
#include "69_inc_henai"
const float Bleed_Delay = 12.0; //Set delay of PC bleeding, 6.0 = one round
void SetHP(string sID, object oPlayer)
{
SetLocalInt(GetModule(),"LastHP"+sID,GetCurrentHitPoints(oPlayer));
}
void Bleed(int iBleedAmt)
{
effect eBleedEff;
// HCR Stuff
object oPlayer=OBJECT_SELF;
string sPlayer = GetName(oPlayer);
int iCHP=GetCurrentHitPoints(oPlayer);
string sName=GetName(oPlayer);
string sCDK=GetPCPublicCDKey(oPlayer);
string sID=sName+sCDK;
int iLHP=GetLocalInt(GetModule(),"LastHP"+sID);
/* keep executing recursively until character is dead or at +1 hit points */
if (GetCurrentHitPoints() <= 0) {
/* a positive bleeding amount means damage, otherwise heal the character */
if (iBleedAmt > 0)
{
eBleedEff = EffectDamage(iBleedAmt);
}
else
{
eBleedEff = EffectHeal(-iBleedAmt); /* note the negative sign */
}
ApplyEffectToObject(DURATION_TYPE_INSTANT, eBleedEff, OBJECT_SELF);
/* -10 hit points is the death threshold, at or beyond it the character dies */
if (GetCurrentHitPoints() <= -10) {
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 */
return;
}
if (iBleedAmt > 0) { /* only check if character has not stablized */
if ((d10(1) == 1) || (iCHP > iLHP))/* 10% chance to stablize */
{
iBleedAmt = -iBleedAmt; /* reverse the bleeding process */
FloatingTextStringOnCreature("Your wounds have stabilized!", OBJECT_SELF);
PlayVoiceChat(VOICE_CHAT_LAUGH); /* laugh at death -- this time */
}
else
{
//Henchman Cleric Code
if(GetCurrentHitPoints() <= -3)
{
object oHealer = GetHenchman(oPlayer);
int nSpeak;
string sName;
talent tHeal = TalentSkill(SKILL_HEAL);
while(oHealer != OBJECT_INVALID)
{
sName = GetName(oHealer);
if(GetClassByPosition(1, oHealer) == CLASS_TYPE_CLERIC || GetClassByPosition(2, oHealer) == CLASS_TYPE_CLERIC || GetClassByPosition(3, oHealer) == CLASS_TYPE_CLERIC ||
GetClassByPosition(1, oHealer) == CLASS_TYPE_DRUID || GetClassByPosition(2, oHealer) == CLASS_TYPE_DRUID || GetClassByPosition(3, oHealer) == CLASS_TYPE_DRUID ||
GetClassByPosition(1, oHealer) == CLASS_TYPE_PALADIN || GetClassByPosition(2, oHealer) == CLASS_TYPE_PALADIN || GetClassByPosition(3, oHealer) == CLASS_TYPE_PALADIN)
{
if(GetIsTalentValid(tHeal))
{
AssignCommand(oHealer, ClearAllActions());
tHeal = GetCreatureTalentBest(TALENT_CATEGORY_BENEFICIAL_HEALING_TOUCH, 20, oHealer);
SendMessageToPC(oPlayer, sName+ " is casting healing onto " +sPlayer);
AssignCommand(oHealer, ActionUseTalentOnObject(tHeal, oPlayer));
//AssignCommand(oHealer, ActionCastSpellAtObject(SPELL_CURE_MODERATE_WOUNDS, oPlayer, METAMAGIC_ANY, TRUE, 0, PROJECTILE_PATH_TYPE_DEFAULT, FALSE));
}
else
{
AssignCommand(oHealer, ActionSpeakString("I am all out of healing!", TALKVOLUME_TALK));
DelayCommand(2.5, PlayVoiceChat(VOICE_CHAT_CANTDO, oHealer));
}
}
oHealer = GetHenchman(oHealer);
}
}
//End Henchman Cleric Code
if(GetCurrentHitPoints() <= 0)
{
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;
}
}
}
}
SetHP(sID, oPlayer);
DelayCommand(Bleed_Delay, Bleed(iBleedAmt)); /* do this again next Bleed_Delay */
}
else
{
// Determines combat round for nearest enemy when PC becomes conscious
object oAttacker = GetNearestCreature(CREATURE_TYPE_PLAYER_CHAR, PLAYER_CHAR_NOT_PC, oPlayer, 1, CREATURE_TYPE_REPUTATION, REPUTATION_TYPE_ENEMY, CREATURE_TYPE_IS_ALIVE, TRUE);
AssignCommand(oAttacker, DetermineCombatRound(oPlayer, 10));
}
}
void main()
{
object oDying = GetLastPlayerDying();
int PC_BLEEDING = GetLocalInt(GetModule(), "PC_BLEEDING");
if(PC_BLEEDING == 0)
{
effect eDeath = EffectDeath(FALSE, FALSE);
ApplyEffectToObject(DURATION_TYPE_INSTANT, eDeath, GetLastPlayerDying());
}
else if(PC_BLEEDING == 1)
{
AssignCommand(oDying, ClearAllActions());
AssignCommand(oDying, Bleed(1));
}
}

View File

@@ -0,0 +1,49 @@
//::///////////////////////////////////////////////
//:: 69_O0_LevelUp.nss
//:: Copyright (c) 2001 Bioware Corp.
//:://////////////////////////////////////////////
/*
This script fires whenever a player levels up.
If the henchmen is capable of going up a level, they do.
Place in the OnPlayerLevelUp event in Module Properties
*/
//:://////////////////////////////////////////////
//:: Created By: Brent
//:: Created On: 2002
//:: Modified By: 69MEH69
//:://////////////////////////////////////////////
#include "69_hench_lib"
#include "69_leadership"
void main()
{
object oPC = GetPCLevellingUp();
int nPC = GetHitDice(oPC);
int nNth = 1;
object oHench = GetHenchman(oPC, nNth);
int nNewClass, nClassPackage;
//Check for Leadership
int nLeadership = GetLocalInt(GetModule(), "nLeadership");
if(nLeadership == 1)
{
//Resets Maximum Henchmen
SetMaxHenchmen69(oPC);
GetMaxHenchmen69(oPC);
}
//Check for Henchman XP
int HENCH_XP = GetLocalInt(GetModule(), "HENCHXP");
if(HENCH_XP == 0)
{
while(GetIsObjectValid(oHench))
{
if(GetCanLevelUp69(oPC, oHench))
{
AssignCommand(oHench, SpeakString("Leveling Up"));
CheckHenchClass69(oHench);
nNewClass = GetLocalInt(oHench, "NewClass");
nClassPackage = GetLocalInt(oHench, "ClassPackage");
LevelUpHenchman69(oHench, oPC);
}
oHench = GetHenchman(oPC, ++nNth);
}
}
}

View File

@@ -0,0 +1,29 @@
//69_oe_attckmastr
// This is a template script for a henchman to attack their PC master
// Replace NPC_TAG with the TAG of the NPC Henchman to attack
// Place in the On Enter event of trigger or script can be modified to satisfy other
// event type.
#include "x0_i0_henchman"
#include "69_hench_lib"
void main()
{
object oPC = GetEnteringObject();
object oHench = GetObjectByTag("NPC_TAG");
if(GetMaster(oHench) == oPC)
{
oPC = GetMaster(oHench);
SetLootable(oHench, TRUE);
SetLastMaster(oPC, oHench);
RemoveHenchman(oPC, oHench);
AssignCommand(oHench, SpeakString("Die Scum!", TALKVOLUME_SHOUT));
//AssignCommand(oHench, ActionMoveToObject(oPC, TRUE, 0.5f));
ChangeToStandardFaction(oHench, STANDARD_FACTION_HOSTILE);
AssignCommand(oHench, SetIsEnemy(oPC));
AssignCommand(oHench, ActionAttack(oPC));
}
DestroyObject(OBJECT_SELF);
}

View File

@@ -0,0 +1,47 @@
//69_onactivateitem
//Place this script in the OnActivateItem event in the
//module's properties, used in conjuntion with the henchman bleeding
//option in 69_hen_death
//69MEH69 Sep2004
#include "69_hench_lib"
void main()
{
object oPC = GetItemActivator();
object oTarget = GetItemActivatedTarget();
string sTag = GetTag(oTarget);
object oItem = GetItemActivated();
string sItem = GetTag(oItem);
object oArea = GetArea(oTarget);
if(sItem == "HenchmanHealKit")
{
if(GetIsHenchmanDying(oTarget))
{
SendMessageToPC(oPC, "Healing Kit Used");
ApplyEffectToObject(DURATION_TYPE_INSTANT, EffectVisualEffect(VFX_IMP_HEALING_S, FALSE), oTarget);
SetLocalInt(oArea, "nCHP" +sTag, 2);
}
else
SendMessageToPC(oPC, "This henchman is not dying");
}
if(sItem == "HenchmanLevelupTool")
{
if(HenchmanCheck69(oTarget, oPC))
{
int nHenchXP = GetLocalInt(oTarget, "HENCH_XP");
SetLocalInt(oTarget, "HENCH_XP", nHenchXP + 2000);
nHenchXP = GetLocalInt(oTarget, "HENCH_XP");
string sHenchXP = IntToString(nHenchXP);
string sHenchName = GetName(oTarget);
SendMessageToPC(oPC, sHenchName + " received 2000 experience points.");
SendMessageToPC(oPC, sHenchName + " has " + sHenchXP + " experience points.");
if(HenchXPCheck69(oTarget))
{
LevelUpHenchman69(oTarget, oPC);
}
}
else
SendMessageToPC(oPC, "This is not your henchman.");
}
}

View File

@@ -0,0 +1,434 @@
//::///////////////////////////////////////////////
//:: Community Patch 1.70 New Spell Engine include
//:: 70_inc_spells
//:: Copyright (c) 2001 Bioware Corp.
//:://////////////////////////////////////////////
/*
This include file contains base functions for the New Spell Engine.
In order to use it in your spells put this line in the beginning of the script.
spellsDeclareMajorVariables();
Then you will be able to access spell related informations by typing:
spell.Caster - caster
spell.Target - spell target object
spell.Item - spell cast item
spell.Level - caster level
spell.Id - spell ID constant
spell.DC - spell DC
spell.Meta - spell metamagic
spell.Loc - spell target location
spell.Class - spell cast class
You can use them directly, but if you want to adjust them, like if the spell halves
the caster level, its a good practice to declare the caster level into new variable
beforehand like this.
int nCasterLevel = spell.Level/2;
Otherwise you do not have to do this. Take a look into few spells that have been
rewritten onto New Spell Engine and you will understand quicky.
*/
//:://////////////////////////////////////////////
//:: Created By: Shadooow
//:: Created On: ?-11-2010
//:://////////////////////////////////////////////
const int SPELL_TARGET_SINGLETARGET = 2;
//declare major variables for every spell
//start every spell script with this at top
void spellsDeclareMajorVariables();
//created as variation for AOE spells whose got different handling
void aoesDeclareMajorVariables();
// scales delay by range, so the closest creatures gets affected first
float GetDelayByRange(float fMinimumTime, float MaximumTime, float fRange, float fMaxRange);
//remove temporary hitpoints from certain spell
void RemoveTempHP(int nSpellId, object oCreature=OBJECT_SELF);//new function that replaces the one from nw_i0_spells
//was put here for compatibility reasons
//special workaround for AOEs in order to be able to get proper informations that
//cannot be acquired there
//also featuring a heartbeat issue workaround, to activate it you must set variable
//70_AOE_HEARTBEAT_WORKAROUND on module to TRUE
//sTag - optional parameter for safety, the AOE's tag will match LABEL collumn in vfx_persistent.2da
//scriptHeartbeat - heartbeat script, if any
object spellsSetupNewAOE(string sTag="", string scriptHeartbeat="");
//special workaround for special ability AOEs like aura of fear in order to make
//them immune to the dispell centered at location, should be used in conjunction with spellsSetupNewAOE
//like this: object oAOE = spellsSetupNewAOE(spell); SetAreaOfEffectUndispellable(oAOE);
void SetAreaOfEffectUndispellable(object oAOE);
//special workaround for destroying/dispelling AOE in order to remove AOE owner's effects
void aoesCheckStillValid(object oAOE, object oOwner, object oCreator, int nSpellId);
// * returns true if the creature doesnt have to breath or can breath water
int spellsIsImmuneToDrown(object oCreature);
// * returns true if the creature is sightless
int spellsIsSightless(object oCreature);
// * returns true if the abrupt exposure to bright light is harmful to given creature
int spellsIsLightVulnerable(object oCreature);
// * Returns true if creature cannot hear: is silenced or deaf
int GetIsAbleToHear(object oCreature);
// * Returns true if creature cannot see: is blind or sightless
int GetIsAbleToSee(object oCreature);
struct spells
{
int Id,DC,Level,Class,Meta;
object Caster,Target,Item;
location Loc;
};
struct aoes
{
object AOE,Creator,Owner;
};
struct aoes aoe;
struct spells spell;
void spellsDeclareMajorVariables()
{
spell.Caster = OBJECT_SELF;
spell.Target = GetSpellTargetObject();
spell.Item = GetSpellCastItem();
spell.Level = GetCasterLevel(spell.Caster);
spell.Loc = GetSpellTargetLocation();
spell.Id = GetSpellId();
spell.DC = GetSpellSaveDC();
spell.Class = GetLastSpellCastClass();
if(spell.Item == OBJECT_INVALID && GetLevelByClass(CLASS_TYPE_PALE_MASTER,spell.Caster) && GetLocalInt(GetModule(),"71_PALEMASTER_ADDS_CASTER_LEVEL"))//module switch to add PM into CL
{//optional feature to calculate PM levels into caster level
switch(spell.Class)
{
case CLASS_TYPE_BARD:
case CLASS_TYPE_SORCERER:
case CLASS_TYPE_WIZARD:
int nMod = StringToInt(Get2DAString("classes","ArcSpellLvlMod",CLASS_TYPE_PALE_MASTER));
spell.Level+= (GetLevelByClass(CLASS_TYPE_PALE_MASTER,spell.Caster)+(nMod != 1))/nMod;
break;
}
}
if(spell.DC > 126)//DC bug with negative primary ability
{
string primaryAbil = Get2DAString("classes","PrimaryAbil",spell.Class);//gets the class' primary ability, using 2da for "globallity"
int nAbility = ABILITY_CHARISMA;// default ability is charisma
if(primaryAbil == "STR")
nAbility = ABILITY_STRENGTH;
else if(primaryAbil == "DEX")
nAbility = ABILITY_DEXTERITY;
else if(primaryAbil == "CON")
nAbility = ABILITY_CONSTITUTION;
else if(primaryAbil == "WIS")
nAbility = ABILITY_WISDOM;
else if(primaryAbil == "INT")
nAbility = ABILITY_INTELLIGENCE;
spell.DC = 10+GetLevelByClass(spell.Class,spell.Caster)+GetAbilityModifier(nAbility,spell.Caster);//lets recalculate the DC on our own
}
spell.Meta = GetMetaMagicFeat();
if(GetIsObjectValid(spell.Item) || spell.Meta == METAMAGIC_ANY || spell.Meta < 0)
{ //odd behavior when spell was cast from item //bug in actioncastspell
spell.Meta = METAMAGIC_NONE;//spells from items won't have metamagic now
}
else if((spell.Meta == METAMAGIC_EMPOWER && !GetHasFeat(FEAT_EMPOWER_SPELL,spell.Caster)) || (spell.Meta == METAMAGIC_MAXIMIZE && !GetHasFeat(FEAT_MAXIMIZE_SPELL,spell.Caster)))
{
spell.Meta = METAMAGIC_NONE;//metamagic exploit with polymorph into Rakshasa
}
int overrideLevel, overrideDC, overrideMeta;
if(spell.Item != OBJECT_INVALID)
{//new feature to allow set caster level on item (eg. potion) beyond toolset limit
overrideLevel = GetLocalInt(spell.Item,"ITEM_CASTER_LEVEL_OVERRIDE");
spell.Level+= GetLocalInt(spell.Item,"ITEM_CASTER_LEVEL_MODIFIER");
overrideDC = GetLocalInt(spell.Item,"ITEM_DC_OVERRIDE");
spell.DC+= GetLocalInt(spell.Item,"ITEM_DC_MODIFIER");
overrideMeta = GetLocalInt(spell.Item,"ITEM_METAMAGIC_OVERRIDE");
}
else if(spell.Class == CLASS_TYPE_INVALID)
{//new feature to allow set caster level greater than 15 for any of NPC's special abilities
overrideLevel = GetLocalInt(spell.Caster,"SPECIAL_ABILITY_CASTER_LEVEL_OVERRIDE");
spell.Level+= GetLocalInt(spell.Caster,"SPECIAL_ABILITY_CASTER_LEVEL_MODIFIER");
overrideDC = GetLocalInt(spell.Caster,"SPECIAL_ABILITY_DC_OVERRIDE");
spell.DC+= GetLocalInt(spell.Caster,"SPECIAL_ABILITY_DC_MODIFIER");
overrideMeta = GetLocalInt(spell.Caster,"SPECIAL_ABILITY_METAMAGIC_OVERRIDE");
}
else
{//new feature to allow override caster level for normal spells
overrideLevel = GetLocalInt(spell.Caster,"SPELL_CASTER_LEVEL_OVERRIDE");
spell.Level+= GetLocalInt(spell.Caster,"SPELL_CASTER_LEVEL_MODIFIER");
overrideDC = GetLocalInt(spell.Caster,"SPELL_DC_OVERRIDE");
spell.DC+= GetLocalInt(spell.Caster,"SPELL_DC_MODIFIER");
overrideMeta = GetLocalInt(spell.Caster,"SPELL_METAMAGIC_OVERRIDE");
}
if(overrideLevel > 0)
{
spell.Level = overrideLevel;
}
if(overrideDC > 0)
{
spell.DC = overrideDC;
}
if(overrideMeta > 0)
{
spell.Meta = overrideMeta;
}
if(spell.Level < 1)//sanity check, this should never happen
{
spell.Level = 1;
}
}
void aoesDeclareMajorVariables()
{
aoe.AOE = OBJECT_SELF;
aoe.Creator = GetAreaOfEffectCreator(aoe.AOE);
aoe.Owner = GetLocalObject(aoe.AOE,"AOE_OWNER");
if(aoe.Owner == OBJECT_INVALID)
{
aoe.Owner = aoe.Creator;
}
spell.Id = GetEffectSpellId(EffectDazed());
spell.Class = GetLocalInt(aoe.AOE,"AOE_CLASS")-1;
spell.DC = GetLocalInt(aoe.AOE,"AOE_DC");
if(spell.DC < 1)
{
spell.DC = GetSpellSaveDC();
}
spell.Level = GetLocalInt(aoe.AOE,"AOE_LEVEL");
if(spell.Level < 1)
{
spell.Level = GetCasterLevel(aoe.Creator);
}
spell.Meta = GetLocalInt(aoe.AOE,"AOE_META")-1;
if(spell.Meta < 0)
{
spell.Meta = GetMetaMagicFeat();
}
if(spell.Level < 1)//sanity check, this should never happen
{
spell.Level = 1;
}
}
float GetDelayByRange(float fMinimumTime, float MaximumTime, float fRange, float fMaxRange)
{
return fMinimumTime+(MaximumTime-fMinimumTime)*(fRange/fMaxRange);
}
int GetHasSpellEffectSpecific(int effectType, int spellId, object oCaster, object oTarget);
int GetHasSpellEffectSpecific(int effectType, int spellId, object oCaster, object oTarget)
{
effect eSearch = GetFirstEffect(oTarget);
while(GetIsEffectValid(eSearch))
{
if(GetEffectType(eSearch) == effectType && GetEffectSpellId(eSearch) == spellId && GetEffectCreator(eSearch) == oCaster)
{
return TRUE;
}
eSearch = GetNextEffect(oTarget);
}
return FALSE;
}
void RemoveTempHP(int nSpellId, object oCreature=OBJECT_SELF)
{
effect eSearch = GetFirstEffect(oCreature);
while(GetIsEffectValid(eSearch))
{
if(GetEffectType(eSearch) == EFFECT_TYPE_TEMPORARY_HITPOINTS && GetEffectSpellId(eSearch) == nSpellId)
{
RemoveEffect(oCreature,eSearch);
}
eSearch = GetNextEffect(oCreature);
}
}
//private
void AOEHeartbeat(string sScript)
{
ExecuteScript(sScript,OBJECT_SELF);
DelayCommand(6.0,AOEHeartbeat(sScript));
}
object spellsSetupNewAOE(string sTag="", string scriptHeartbeat="")
{
int nTh = 1;
object aoeOwner, oAOE = GetNearestObjectToLocation(OBJECT_TYPE_AREA_OF_EFFECT,spell.Loc,nTh);
while(oAOE != OBJECT_INVALID)
{
if((sTag == "" || GetTag(oAOE) == sTag) && GetAreaOfEffectCreator(oAOE) == spell.Caster && GetLocalObject(oAOE,"AOE_OWNER") == OBJECT_INVALID)
{
SetLocalObject(oAOE,"AOE_OWNER",spell.Target == OBJECT_INVALID ? spell.Caster : spell.Target);
SetLocalInt(oAOE,"AOE_DC",spell.DC);
SetLocalInt(oAOE,"AOE_META",spell.Meta+1);
SetLocalInt(oAOE,"AOE_LEVEL",spell.Level);
SetLocalInt(oAOE,"AOE_CLASS",spell.Class+1);
SetLocalObject(spell.Target == OBJECT_INVALID ? spell.Caster : spell.Target,"OWNER_"+IntToString(spell.Id),oAOE);
if(scriptHeartbeat != "" && GetLocalInt(GetModule(),"70_AOE_HEARTBEAT_WORKAROUND"))
{
AssignCommand(oAOE,DelayCommand(6.0,AOEHeartbeat(scriptHeartbeat)));
}
return oAOE;
}
oAOE = GetNearestObjectToLocation(OBJECT_TYPE_AREA_OF_EFFECT,spell.Loc,++nTh);
}
return oAOE;
}
void SetAreaOfEffectUndispellable(object oAOE)
{
SetLocalInt(oAOE,"X1_L_IMMUNE_TO_DISPEL",10);
}
void aoesCheckStillValid_continue(object oAOE, object oOwner, object oCreator, int nSpellId)//private
{
if(!GetIsObjectValid(oAOE))
{
effect eSearch = GetFirstEffect(oOwner);
while(GetIsEffectValid(eSearch))
{
if(GetEffectSpellId(eSearch) == nSpellId && GetEffectCreator(eSearch) == oCreator)
{
RemoveEffect(oOwner,eSearch);
}
eSearch = GetNextEffect(oOwner);
}
}
}
void aoesCheckStillValid(object oAOE, object oOwner, object oCreator, int nSpellId)
{
object AOE = GetLocalObject(oOwner,"OWNER_"+IntToString(nSpellId));
if(GetIsObjectValid(AOE) && AOE == oAOE)
{
effect eAOE = GetFirstEffect(oOwner);
while(GetIsEffectValid(eAOE))
{
if(GetEffectSpellId(eAOE) == nSpellId && GetEffectCreator(eAOE) == oCreator && GetEffectType(eAOE) == EFFECT_TYPE_AREA_OF_EFFECT)
{
AssignCommand(oOwner, DelayCommand(0.1,aoesCheckStillValid_continue(oAOE,oOwner,oCreator,nSpellId)));
return;//new instance, its OK
}
eAOE = GetNextEffect(oOwner);
}
}
}
int GetIsAbleToHear(object oCreature)
{
effect eSearch = GetFirstEffect(oCreature);
while(GetIsEffectValid(eSearch))
{
switch(GetEffectType(eSearch))
{
case EFFECT_TYPE_SILENCE:
case EFFECT_TYPE_DEAF:
return FALSE;
}
eSearch = GetNextEffect(oCreature);
}
return TRUE;
}
int GetIsAbleToSee(object oCreature)
{
if(spellsIsSightless(oCreature)) return FALSE;
effect eSearch = GetFirstEffect(oCreature);
while(GetIsEffectValid(eSearch))
{
switch(GetEffectType(eSearch))
{
case EFFECT_TYPE_BLINDNESS:
case EFFECT_TYPE_DARKNESS:
return FALSE;
}
eSearch = GetNextEffect(oCreature);
}
return TRUE;
}
int spellsIsImmuneToDrown(object oCreature)
{//undead, construct and any creature that doesn't breath or can breath water are immune to the drown effect
switch(GetRacialType(oCreature))
{
case RACIAL_TYPE_UNDEAD:
case RACIAL_TYPE_CONSTRUCT:
case RACIAL_TYPE_ELEMENTAL:
case RACIAL_TYPE_OOZE:
return TRUE;
}
switch(GetAppearanceType(oCreature))
{
case APPEARANCE_TYPE_WYRMLING_BLACK:
case APPEARANCE_TYPE_WYRMLING_GREEN:
case APPEARANCE_TYPE_WYRMLING_BRONZE:
case APPEARANCE_TYPE_WYRMLING_GOLD:
case APPEARANCE_TYPE_DRAGON_BLACK:
case APPEARANCE_TYPE_DRAGON_GREEN:
case APPEARANCE_TYPE_DRAGON_BRONZE:
case APPEARANCE_TYPE_DRAGON_GOLD:
case APPEARANCE_TYPE_SAHUAGIN:
case APPEARANCE_TYPE_SAHUAGIN_CLERIC:
case APPEARANCE_TYPE_SAHUAGIN_LEADER:
case APPEARANCE_TYPE_SEA_HAG:
case APPEARANCE_TYPE_MEPHIT_OOZE:
case APPEARANCE_TYPE_MEPHIT_WATER:
case APPEARANCE_TYPE_SHARK_GOBLIN:
case APPEARANCE_TYPE_SHARK_MAKO:
case APPEARANCE_TYPE_SHARK_HAMMERHEAD:
return TRUE;
}
return GetLocalInt(oCreature,"IMMUNITY_DROWN");
}
int spellsIsSightless(object oCreature)
{
switch(GetAppearanceType(oCreature))
{
case APPEARANCE_TYPE_GELATINOUS_CUBE:
case APPEARANCE_TYPE_GRAY_OOZE:
case APPEARANCE_TYPE_OCHRE_JELLY_SMALL:
case APPEARANCE_TYPE_OCHRE_JELLY_MEDIUM:
case APPEARANCE_TYPE_OCHRE_JELLY_LARGE:
return TRUE;
}
return GetLocalInt(oCreature,"SIGHTLESS");
}
int spellsIsLightVulnerable(object oCreature)
{
switch(GetAppearanceType(oCreature))
{
case APPEARANCE_TYPE_SAHUAGIN:
case APPEARANCE_TYPE_SAHUAGIN_LEADER:
case APPEARANCE_TYPE_SAHUAGIN_CLERIC:
case APPEARANCE_TYPE_DROW_CLERIC:
case APPEARANCE_TYPE_DROW_FEMALE_1:
case APPEARANCE_TYPE_DROW_FEMALE_2:
case APPEARANCE_TYPE_DROW_FIGHTER:
case APPEARANCE_TYPE_DROW_MATRON:
case APPEARANCE_TYPE_DROW_SLAVE:
case APPEARANCE_TYPE_DROW_WARRIOR_1:
case APPEARANCE_TYPE_DROW_WARRIOR_2:
case APPEARANCE_TYPE_DROW_WARRIOR_3:
case APPEARANCE_TYPE_DROW_WIZARD:
case APPEARANCE_TYPE_VAMPIRE_FEMALE:
case APPEARANCE_TYPE_VAMPIRE_MALE:
return TRUE;
}
if(FindSubString(GetStringLowerCase(GetSubRace(oCreature)),"drow") > -1 || FindSubString(GetStringLowerCase(GetSubRace(oCreature)),"vampire"))
{ //drow or vampiure subrace, common on PCs
return TRUE;
}
return GetLocalInt(oCreature,"LIGHTVULNERABLE");
}

View File

@@ -0,0 +1,314 @@
//::///////////////////////////////////////////////
//:: Shadooow's Pseudo-list impementation
//:: FileName _sh_inc_list
//:://////////////////////////////////////////////
// 1234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890 -> 160elements max
const string LIST_ELEMENTS_ALPHABET = "0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ<59><5A><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>!#$%&()*+,-./:;<=>?@_~|{}[\]<5D>^`<60><>'<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>å<EFBFBD><C3A5><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><E5BCA3><EFBFBD><EFBFBD>،<EFBFBD><D88C><EFBFBD><EFBFBD><EFBFBD>";//note a space should work too, a "'" character is not recommended as it could mess SQL command, a <20> character doesnt work with string commands
// 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16
//This function destroy valid List with same sName on same oList and nStoreMethod
//or... Do nothing!
// oList - object that hold the list
object ListCreate(string sName);
//Add new element to end of List with sName
//Each element can contain one integer, one float, one string and one object.
//If there is not valid List with such name, new List is created.
// oList - object that hold the list
void ListAddElement(object oList, int nInt=0 ,string sString="", object oObject=OBJECT_INVALID, float fFloat=0.0);
//Add new int to end of List with sName. It's same as element with only int value.
//You ask why use this function? Well, elements store all types and checks if is every data type valid and
//then store it. So, if you use element for add one int it will do 3 extra commands.
//If there is not valid List with such name, new List is created.
// oList - object that hold the list
void ListAddInt(object oList, int nInt);
//Set nInt to nth element of List with sName.
//But nInt is stored only if List has nTh element!
// oList - object that hold the list
void ListSetInt(object oList, int nTh, int nInt);
//Set sString to nth element of List with sName.
//But sString is stored only if List has nTh element!
// oList - object that hold the list
void ListSetString(object oList, int nTh, string sString);
//Set oObject to nth element of List with sName.
//But oObject is stored only if List has nTh element!
// oList - object that hold the list
void ListSetObject(object oList, int nTh, object oObject);
//Set fFloat to nth element of List with sName.
//But fFloat is stored only if List has nTh element!
// oList - object that hold the list
void ListSetFloat(object oList, int nTh, float fFloat);
//Add new string to end of List with sName. It's same as element with only int value.
//You ask why use this function? Well, elements store all types and checks if is every data type valid and
//then store it. So, if you use element for add one int it will do 3 extra commands.
//If there is not valid List with such name, new List is created.
void ListAddString(object oList, string sString);
//Add new float to end of List with sName. It's same as element with only int value.
//You ask why use this function? Well, elements store all types and checks if is every data type valid and
//then store it. So, if you use element for add one int it will do 3 extra commands.
//If there is not valid List with such name, new List is created.
void ListAddFloat(object oList, float fFloat);
//Add new object to end of List with sName. It's same as element with only int value.
//You ask why use this function? Well, elements store all types and checks if is every data type valid and
//then store it. So, if you use element for add one int it will do 3 extra commands.
//If there is not valid List with such name, new List is created.
// oList - object that hold the list
void ListAddObject(object oList, object oObject);
//Returns nTh value stored in List with sName
int ListGetInt(object oList, int nTh);
//Returns nTh value stored in List with sName
// oList - object that hold the list
string ListGetString(object oList, int nTh);
//Returns nTh value stored in List with sName
// oList - object that hold the list
float ListGetFloat(object oList, int nTh);
//Returns nTh value stored in List with sName
// oList - object that hold the list
object ListGetObject(object oList, int nTh);
//Returns nTh element from List with sName
// oList - object that hold the list
struct element ListGetNthElement(object oList, int nTh);
//Returns TRUE if List's element is valid, FALSE otherwise.
int ListGetIsElementValid(struct element eElement);
//Remove nTh element from List with sName
//This move every element that was behind nTh by 1 backwards.
// oList - object that hold the list
void ListRemoveElement(object oList, int nTh);
//Returns how many elements contain List with sName
// oList - object that hold the list
int ListGetElementCount(object oList);
//Returns nTh element name
string ListGetElementName(object oList, int nTh);
int ListGetIntArray(object oList, int nTh, int nArrayTh);
void ListSetIntArray(object oList, int nTh, int nArrayTh, int nInt);
struct element
{
int Int;
string String;
float Float;
object Object;
/*location Location;
itemproperty ItemProperty;
vector Vector;
struct map_pin MapPin;*/
};
////////////////////////////////////////////////////////////////////////////////
// function definitions //
////////////////////////////////////////////////////////////////////////////////
string GetFirstUnusedChar(object oList)//pseudo-list private function
{
string sChar, pool = GetLocalString(oList,"POOL");
if(pool != "")
{
SetLocalString(oList,"POOL",GetStringRight(pool,GetStringLength(pool)-2));
return GetStringLeft(pool,2);
}
int max = GetLocalInt(oList,"MAX");
SetLocalInt(oList,"MAX",max+1);
int y = max/150;
return GetSubString(LIST_ELEMENTS_ALPHABET,y,1)+GetSubString(LIST_ELEMENTS_ALPHABET,max-y*150,1);
}
object ListCreate(string sName)
{
sName = "LIST_"+sName;
object oList = GetObjectByTag(sName);
if(!GetIsObjectValid(oList))
{
oList = CreateObject(OBJECT_TYPE_WAYPOINT,"nw_waypoint001",GetStartingLocation(),FALSE,sName);
}
return oList;
}
void ListAddElement(object oList, int nInt=0 ,string sString="", object oObject=OBJECT_INVALID, float fFloat=0.0)
{
string sChar = GetFirstUnusedChar(oList);
SetLocalString(oList,"LIST",GetLocalString(oList,"LIST")+sChar);
if(nInt)
SetLocalInt(oList,sChar,nInt);
if(sString != "")
SetLocalString(oList,sChar,sString);
if(fFloat != 0.0)
SetLocalFloat(oList,sChar,fFloat);
if(oObject != OBJECT_INVALID)
SetLocalObject(oList,sChar,oObject);
}
struct element ListGetNthElement(object oList, int nTh)
{
struct element e;
string sChar = ListGetElementName(oList,nTh);
e.Int = GetLocalInt(oList,sChar);
e.String = GetLocalString(oList,sChar);
e.Float = GetLocalFloat(oList,sChar);
e.Object = GetLocalObject(oList,sChar);
return e;
}
void ListRemoveElement(object oList, int nTh)
{
nTh = (nTh-1)*2;
string sList = GetLocalString(oList,"LIST");
string sChar = GetSubString(sList,nTh,2);
int numElements = GetStringLength(sList);
if(numElements < 2)
{
DeleteLocalString(oList,"LIST");
}
else
{
SetLocalString(oList,"LIST",GetStringLeft(sList,nTh)+GetStringRight(sList,numElements-nTh-2));
}
SetLocalString(oList,"POOL",GetLocalString(oList,"POOL")+sChar);
DeleteLocalInt(oList,sChar);
DeleteLocalString(oList,sChar);
DeleteLocalFloat(oList,sChar);
DeleteLocalObject(oList,sChar);
}
int ListGetElementCount(object oList)
{
return GetStringLength(GetLocalString(oList,"LIST"))/2;
}
string ListGetElementName(object oList, int nTh)
{
return GetSubString(GetLocalString(oList,"LIST"),(nTh-1)*2,2);
}
int ListGetIsElementValid(struct element eElement)
{
if(eElement.Int)
return TRUE;
else if(eElement.String != "")
return TRUE;
else if(eElement.Float != 0.0)
return TRUE;
else if(eElement.Object != OBJECT_INVALID)
return TRUE;
return FALSE;
}
void ListAddInt(object oList, int nInt)
{
string sChar = GetFirstUnusedChar(oList);
SetLocalString(oList,"LIST",GetLocalString(oList,"LIST")+sChar);
SetLocalInt(oList,sChar,nInt);
}
int ListGetInt(object oList, int nTh)
{
return GetLocalInt(oList,ListGetElementName(oList,nTh));
}
void ListAddString(object oList, string sString)
{
string sChar = GetFirstUnusedChar(oList);
SetLocalString(oList,"LIST",GetLocalString(oList,"LIST")+sChar);
SetLocalString(oList,sChar,sString);
}
string ListGetString(object oList, int nTh)
{
return GetLocalString(oList,ListGetElementName(oList,nTh));
}
void ListAddFloat(object oList, float fFloat)
{
string sChar = GetFirstUnusedChar(oList);
SetLocalString(oList,"LIST",GetLocalString(oList,"LIST")+sChar);
SetLocalFloat(oList,sChar,fFloat);
}
float ListGetFloat(object oList, int nTh)
{
return GetLocalFloat(oList,ListGetElementName(oList,nTh));
}
void ListAddObject(object oList, object oObject)
{
string sChar = GetFirstUnusedChar(oList);
SetLocalString(oList,"LIST",GetLocalString(oList,"LIST")+sChar);
SetLocalObject(oList,sChar,oObject);
}
object ListGetObject(object oList, int nTh)
{
return GetLocalObject(oList,ListGetElementName(oList,nTh));
}
void ListSetInt(object oList, int nTh, int nInt)
{
string sChar = ListGetElementName(oList,nTh);
if(sChar != "")
{
SetLocalInt(oList,sChar,nInt);
}
}
void ListSetIntArray(object oList, int nTh, int nArrayTh, int nInt)
{
string sChar = ListGetElementName(oList,nTh);
if(sChar != "")
{
SetLocalInt(oList,sChar+"_"+IntToString(nArrayTh),nInt);
}
}
int ListGetIntArray(object oList, int nTh, int nArrayTh)
{
return GetLocalInt(oList,ListGetElementName(oList,nTh)+"_"+IntToString(nArrayTh));
}
void ListSetString(object oList, int nTh, string sString)
{
string sChar = ListGetElementName(oList,nTh);
if(sChar != "")
{
SetLocalString(oList,sChar,sString);
}
}
void ListSetObject(object oList, int nTh, object oObject)
{
string sChar = ListGetElementName(oList,nTh);
if(sChar != "")
{
SetLocalObject(oList,sChar,oObject);
}
}
void ListSetFloat(object oList, int nTh, float fFloat)
{
string sChar = ListGetElementName(oList,nTh);
if(sChar != "")
{
SetLocalFloat(oList,sChar,fFloat);
}
}

View File

@@ -0,0 +1,7 @@
void main()
{
DeleteLocalInt(OBJECT_SELF, "Lost");
SetLocalInt(OBJECT_SELF, "Escorted", TRUE);
SetLocalInt(OBJECT_SELF, "EventEscorted", TRUE);
AddHenchman(GetPCSpeaker());
}

View File

@@ -0,0 +1,5 @@
int StartingConditional()
{
if (GetLocalInt(OBJECT_SELF, "Duel") == TRUE) return TRUE;
return FALSE;
}

View File

@@ -0,0 +1,6 @@
#include "hench_i0_ai"
void main()
{
SetIsTemporaryEnemy(GetPCSpeaker());
HenchDetermineCombatRound();
}

View File

@@ -0,0 +1,30 @@
//::///////////////////////////////////////////////
//:: Name x2_def_attacked
//:: Copyright (c) 2001 Bioware Corp.
//:://////////////////////////////////////////////
/*
Default On Physically attacked script
*/
//:://////////////////////////////////////////////
//:: Created By: Keith Warner
//:: Created On: June 11/03
//:://////////////////////////////////////////////
void main()
{
//--------------------------------------------------------------------------
// GZ: 2003-10-16
// Make Plot Creatures Ignore Attacks
//--------------------------------------------------------------------------
if (GetPlotFlag(OBJECT_SELF))
{
return;
}
//--------------------------------------------------------------------------
// Execute old NWN default AI code
//--------------------------------------------------------------------------
if(GetLocalInt(OBJECT_SELF, "X4_VANILLA_AI") == TRUE) ExecuteScript("nw_c2_default5_v", OBJECT_SELF);
else ExecuteScript("nw_c2_default5", OBJECT_SELF);
}

View File

@@ -0,0 +1,4 @@
void main()
{
DeleteLocalInt(GetPCSpeaker(), "Duel");
}

10
_module/nss/adv_duel.nss Normal file
View File

@@ -0,0 +1,10 @@
#include "hench_i0_ai"
void main()
{
SetLocalInt(GetArea(OBJECT_SELF), "Duel", TRUE);
SetLocalInt(OBJECT_SELF, "Duel", TRUE);
SetLocalInt(GetPCSpeaker(), "Duel", TRUE);
SetIsTemporaryEnemy(GetPCSpeaker());
HenchDetermineCombatRound();
}

View File

@@ -0,0 +1,10 @@
#include "quest_inc"
void main()
{
object oPC = GetPCSpeaker();
DeleteLocalInt(GetPCSpeaker(), "Duel");
DeleteLocalInt(GetArea(OBJECT_SELF), "Duel");
ForceRest(OBJECT_SELF);
SetPlotFlag(OBJECT_SELF, FALSE);
}

View File

@@ -0,0 +1,13 @@
#include "quest_inc"
void main()
{
object oPC = GetPCSpeaker();
DeleteLocalInt(GetPCSpeaker(), "Duel");
DeleteLocalInt(GetArea(OBJECT_SELF), "Duel");
string sItem = GenerateRandomItem(oPC);
object oItem = CreateItemOnObject(sItem, oPC);
SetIdentified(oItem, TRUE);
ForceRest(OBJECT_SELF);
SetPlotFlag(OBJECT_SELF, FALSE);
}

View File

@@ -0,0 +1,24 @@
//::///////////////////////////////////////////////
//:: Name x2_def_endcombat
//:: Copyright (c) 2001 Bioware Corp.
//:://////////////////////////////////////////////
/*
Default Combat Round End script
*/
//:://////////////////////////////////////////////
//:: Created By: Keith Warner
//:: Created On: June 11/03
//:://////////////////////////////////////////////
void main()
{
//Cast Heal if the NPC has any assigned via X4_EXTRA_HEALS variable and its HP is below 1/3
/*if(GetCurrentHitPoints() < GetMaxHitPoints()/3 && GetLocalInt(OBJECT_SELF, "X4_EXTRA_HEALS") != 0)
{
ActionCastSpellAtObject(SPELL_HEAL, OBJECT_SELF, METAMAGIC_ANY, TRUE);
SetLocalInt(OBJECT_SELF, "X4_EXTRA_HEALS", GetLocalInt(OBJECT_SELF, "X4_EXTRA_HEALS")-1);
}*/
if(GetLocalInt(OBJECT_SELF, "X4_VANILLA_AI") == TRUE) ExecuteScript("nw_c2_default3_v", OBJECT_SELF);
else ExecuteScript("nw_c2_default3", OBJECT_SELF);
}

View File

@@ -0,0 +1,5 @@
void main()
{
SetLocalInt(OBJECT_SELF, "Potions", TRUE);
CreateItemOnObject("nw_it_mpotion012", GetPCSpeaker(), 3);
}

View File

@@ -0,0 +1,59 @@
//::///////////////////////////////////////////////
//:: Name x2_def_heartbeat
//:: Copyright (c) 2001 Bioware Corp.
//:://////////////////////////////////////////////
/*
Default Heartbeat script
*/
//:://////////////////////////////////////////////
//:: Created By: Keith Warner
//:: Created On: June 11/03
//:://////////////////////////////////////////////
#include "nw_i0_plot"
#include "x4_inc_functions"
void main()
{
//Wa want an NPC who wanted to talk to a PC to keep on trying (in case he stops for some reason)
if (GetLocalInt(OBJECT_SELF, "NeedToTalk") == TRUE)
{
object oPerceived = GetFirstObjectInArea();
object oTalk;
while (GetIsObjectValid(oPerceived))
{
if (GetLocalString(OBJECT_SELF, "sOwner") == CharacterDB(oPerceived))
{
oTalk = oPerceived;
break;
}
oPerceived = GetNextObjectInArea();
}
ActionStartConversation(oTalk, "", FALSE, FALSE);
return;
}
//We want an NPC running away to keep on doing this (in case he stops for some reason)
if (GetLocalInt(OBJECT_SELF, "Running") == TRUE)
{
ClearAllActions(TRUE);
EscapeArea();
return;
}
//We treat the NPC as dead if petrified
effect eEffect = GetFirstEffect(OBJECT_SELF);
while (GetIsEffectValid(eEffect) && GetLocalInt(OBJECT_SELF, "Dead") == FALSE)
{
if (GetEffectType(eEffect) == EFFECT_TYPE_PETRIFY)
{
SetLocalInt(OBJECT_SELF, "Dead", TRUE);
ExecuteScript("adv_ondeath", OBJECT_SELF);
return;
}
eEffect = GetNextEffect(OBJECT_SELF);
}
if(GetLocalInt(OBJECT_SELF, "X4_VANILLA_AI") == TRUE) ExecuteScript("nw_c2_default1_v", OBJECT_SELF);
else ExecuteScript("nw_c2_default1", OBJECT_SELF);
}

View File

@@ -0,0 +1,9 @@
int StartingConditional()
{
string sName = GetLocalString(OBJECT_SELF, "sName");
string sLastName = GetLocalString(OBJECT_SELF, "sLastName");
SetCustomToken(11001, sName);
SetCustomToken(11002, sLastName);
if (GetLocalInt(OBJECT_SELF, "Adventurer") == TRUE && GetAlignmentGoodEvil(OBJECT_SELF) == ALIGNMENT_GOOD) return TRUE;
return FALSE;
}

View File

@@ -0,0 +1,14 @@
#include "quest_inc"
int StartingConditional()
{
string sName = GetLocalString(OBJECT_SELF, "sName");
string sLastName = GetLocalString(OBJECT_SELF, "sLastName");
SetCustomToken(11001, sName);
SetCustomToken(11002, sLastName);
if (GetLocalInt(OBJECT_SELF, "Potions") == TRUE) return FALSE;
if (GetLocalInt(OBJECT_SELF, "Adventurer") == TRUE && GetAlignmentGoodEvil(OBJECT_SELF) == ALIGNMENT_GOOD && GetLocalInt(OBJECT_SELF, "nPersonality") == 1) return TRUE;
if (GetAlignmentGoodEvil(OBJECT_SELF) == ALIGNMENT_EVIL || GetLocalInt(OBJECT_SELF, "nPersonality") != 1) return FALSE;
int nDC = GetAdjustedSkillDC(GetPCSpeaker());
if (GetIsSkillSuccessful(GetPCSpeaker(), SKILL_PERSUADE, nDC)) return TRUE;
return FALSE;
}

View File

@@ -0,0 +1,14 @@
#include "quest_inc"
int StartingConditional()
{
string sName = GetLocalString(OBJECT_SELF, "sName");
string sLastName = GetLocalString(OBJECT_SELF, "sLastName");
SetCustomToken(11001, sName);
SetCustomToken(11002, sLastName);
if (GetLocalInt(OBJECT_SELF, "Potions") == TRUE) return FALSE;
if (GetLocalInt(OBJECT_SELF, "Adventurer") == TRUE && GetAlignmentGoodEvil(OBJECT_SELF) == ALIGNMENT_GOOD && GetLocalInt(OBJECT_SELF, "nPersonality") == 2) return TRUE;
if (GetAlignmentGoodEvil(OBJECT_SELF) == ALIGNMENT_EVIL || GetLocalInt(OBJECT_SELF, "nPersonality") != 2) return FALSE;
int nDC = GetAdjustedSkillDC(GetPCSpeaker());
if (GetIsSkillSuccessful(GetPCSpeaker(), SKILL_PERSUADE, nDC)) return TRUE;
return FALSE;
}

View File

@@ -0,0 +1,14 @@
#include "quest_inc"
int StartingConditional()
{
string sName = GetLocalString(OBJECT_SELF, "sName");
string sLastName = GetLocalString(OBJECT_SELF, "sLastName");
SetCustomToken(11001, sName);
SetCustomToken(11002, sLastName);
if (GetLocalInt(OBJECT_SELF, "Potions") == TRUE) return FALSE;
if (GetLocalInt(OBJECT_SELF, "Adventurer") == TRUE && GetAlignmentGoodEvil(OBJECT_SELF) == ALIGNMENT_GOOD && GetLocalInt(OBJECT_SELF, "nPersonality") == 0) return TRUE;
if (GetAlignmentGoodEvil(OBJECT_SELF) == ALIGNMENT_EVIL || GetLocalInt(OBJECT_SELF, "nPersonality") != 0) return FALSE;
int nDC = GetAdjustedSkillDC(GetPCSpeaker());
if (GetIsSkillSuccessful(GetPCSpeaker(), SKILL_PERSUADE, nDC)) return TRUE;
return FALSE;
}

View File

@@ -0,0 +1,9 @@
int StartingConditional()
{
string sName = GetLocalString(OBJECT_SELF, "sName");
string sLastName = GetLocalString(OBJECT_SELF, "sLastName");
SetCustomToken(11001, sName);
SetCustomToken(11002, sLastName);
if (GetLocalInt(OBJECT_SELF, "Adventurer") == TRUE && GetLocalInt(OBJECT_SELF, "nPersonality") == 1 && GetLocalInt(OBJECT_SELF, "WillAttack") == 1) return TRUE;
return FALSE;
}

View File

@@ -0,0 +1,9 @@
int StartingConditional()
{
string sName = GetLocalString(OBJECT_SELF, "sName");
string sLastName = GetLocalString(OBJECT_SELF, "sLastName");
SetCustomToken(11001, sName);
SetCustomToken(11002, sLastName);
if (GetLocalInt(OBJECT_SELF, "Adventurer") == TRUE && GetLocalInt(OBJECT_SELF, "nPersonality") == 1 && GetHitDice(GetPCSpeaker()) >= 35) return TRUE;
return FALSE;
}

View File

@@ -0,0 +1,9 @@
int StartingConditional()
{
string sName = GetLocalString(OBJECT_SELF, "sName");
string sLastName = GetLocalString(OBJECT_SELF, "sLastName");
SetCustomToken(11001, sName);
SetCustomToken(11002, sLastName);
if (GetLocalInt(OBJECT_SELF, "Adventurer") == TRUE && GetLocalInt(OBJECT_SELF, "nPersonality") == 1 && GetLocalInt(GetPCSpeaker(), "Duel") == TRUE && GetLocalInt(OBJECT_SELF, "Defeat") == TRUE) return TRUE;
return FALSE;
}

View File

@@ -0,0 +1,9 @@
int StartingConditional()
{
string sName = GetLocalString(OBJECT_SELF, "sName");
string sLastName = GetLocalString(OBJECT_SELF, "sLastName");
SetCustomToken(11001, sName);
SetCustomToken(11002, sLastName);
if (GetLocalInt(OBJECT_SELF, "Adventurer") == TRUE && GetLocalInt(OBJECT_SELF, "nPersonality") == 1 && GetLocalInt(GetPCSpeaker(), "Duel") == TRUE && GetLocalInt(OBJECT_SELF, "Defeat") == FALSE) return TRUE;
return FALSE;
}

View File

@@ -0,0 +1,9 @@
int StartingConditional()
{
string sName = GetLocalString(OBJECT_SELF, "sName");
string sLastName = GetLocalString(OBJECT_SELF, "sLastName");
SetCustomToken(11001, sName);
SetCustomToken(11002, sLastName);
if (GetLocalInt(OBJECT_SELF, "Adventurer") == TRUE && GetLocalInt(OBJECT_SELF, "nPersonality") == 1) return TRUE;
return FALSE;
}

View File

@@ -0,0 +1,9 @@
int StartingConditional()
{
string sName = GetLocalString(OBJECT_SELF, "sName");
string sLastName = GetLocalString(OBJECT_SELF, "sLastName");
SetCustomToken(11001, sName);
SetCustomToken(11002, sLastName);
if (GetLocalInt(OBJECT_SELF, "Adventurer") == TRUE && GetLocalInt(OBJECT_SELF, "nPersonality") == 1 && GetAlignmentGoodEvil(OBJECT_SELF) == ALIGNMENT_GOOD && GetAlignmentGoodEvil(GetPCSpeaker()) == ALIGNMENT_EVIL && GetHitDice(GetPCSpeaker()) >= 35) return TRUE;
return FALSE;
}

View File

@@ -0,0 +1,9 @@
int StartingConditional()
{
string sName = GetLocalString(OBJECT_SELF, "sName");
string sLastName = GetLocalString(OBJECT_SELF, "sLastName");
SetCustomToken(11001, sName);
SetCustomToken(11002, sLastName);
if (GetLocalInt(OBJECT_SELF, "Adventurer") == TRUE && GetLocalInt(OBJECT_SELF, "nPersonality") == 2 && GetAlignmentGoodEvil(OBJECT_SELF) == ALIGNMENT_GOOD && GetAlignmentGoodEvil(GetPCSpeaker()) == ALIGNMENT_EVIL && GetHitDice(GetPCSpeaker()) >= 35) return TRUE;
return FALSE;
}

View File

@@ -0,0 +1,9 @@
int StartingConditional()
{
string sName = GetLocalString(OBJECT_SELF, "sName");
string sLastName = GetLocalString(OBJECT_SELF, "sLastName");
SetCustomToken(11001, sName);
SetCustomToken(11002, sLastName);
if (GetLocalInt(OBJECT_SELF, "Adventurer") == TRUE && GetLocalInt(OBJECT_SELF, "nPersonality") == 2) return TRUE;
return FALSE;
}

View File

@@ -0,0 +1,9 @@
int StartingConditional()
{
string sName = GetLocalString(OBJECT_SELF, "sName");
string sLastName = GetLocalString(OBJECT_SELF, "sLastName");
SetCustomToken(11001, sName);
SetCustomToken(11002, sLastName);
if (GetLocalInt(OBJECT_SELF, "Adventurer") == TRUE && GetLocalInt(OBJECT_SELF, "nPersonality") == 2 && GetHitDice(GetPCSpeaker()) >= 35) return TRUE;
return FALSE;
}

View File

@@ -0,0 +1,9 @@
int StartingConditional()
{
string sName = GetLocalString(OBJECT_SELF, "sName");
string sLastName = GetLocalString(OBJECT_SELF, "sLastName");
SetCustomToken(11001, sName);
SetCustomToken(11002, sLastName);
if (GetLocalInt(OBJECT_SELF, "Adventurer") == TRUE && GetLocalInt(OBJECT_SELF, "nPersonality") == 2 && GetLocalInt(GetPCSpeaker(), "Duel") == TRUE && GetLocalInt(OBJECT_SELF, "Defeat") == TRUE) return TRUE;
return FALSE;
}

View File

@@ -0,0 +1,9 @@
int StartingConditional()
{
string sName = GetLocalString(OBJECT_SELF, "sName");
string sLastName = GetLocalString(OBJECT_SELF, "sLastName");
SetCustomToken(11001, sName);
SetCustomToken(11002, sLastName);
if (GetLocalInt(OBJECT_SELF, "Adventurer") == TRUE && GetLocalInt(OBJECT_SELF, "nPersonality") == 2 && GetLocalInt(OBJECT_SELF, "WillAttack") == 1) return TRUE;
return FALSE;
}

View File

@@ -0,0 +1,9 @@
int StartingConditional()
{
string sName = GetLocalString(OBJECT_SELF, "sName");
string sLastName = GetLocalString(OBJECT_SELF, "sLastName");
SetCustomToken(11001, sName);
SetCustomToken(11002, sLastName);
if (GetLocalInt(OBJECT_SELF, "Adventurer") == TRUE && GetLocalInt(OBJECT_SELF, "nPersonality") == 2 && GetLocalInt(GetPCSpeaker(), "Duel") == TRUE && GetLocalInt(OBJECT_SELF, "Defeat") == FALSE) return TRUE;
return FALSE;
}

View File

@@ -0,0 +1,9 @@
int StartingConditional()
{
string sName = GetLocalString(OBJECT_SELF, "sName");
string sLastName = GetLocalString(OBJECT_SELF, "sLastName");
SetCustomToken(11001, sName);
SetCustomToken(11002, sLastName);
if (GetLocalInt(OBJECT_SELF, "Adventurer") == TRUE && GetLocalInt(OBJECT_SELF, "nPersonality") == 0 && GetAlignmentGoodEvil(OBJECT_SELF) == ALIGNMENT_GOOD && GetAlignmentGoodEvil(GetPCSpeaker()) == ALIGNMENT_EVIL && GetHitDice(GetPCSpeaker()) >= 35) return TRUE;
return FALSE;
}

View File

@@ -0,0 +1,9 @@
int StartingConditional()
{
string sName = GetLocalString(OBJECT_SELF, "sName");
string sLastName = GetLocalString(OBJECT_SELF, "sLastName");
SetCustomToken(11001, sName);
SetCustomToken(11002, sLastName);
if (GetLocalInt(OBJECT_SELF, "Adventurer") == TRUE && GetLocalInt(OBJECT_SELF, "nPersonality") == 0 && GetLocalInt(OBJECT_SELF, "WillAttack") == 1) return TRUE;
return FALSE;
}

View File

@@ -0,0 +1,9 @@
int StartingConditional()
{
string sName = GetLocalString(OBJECT_SELF, "sName");
string sLastName = GetLocalString(OBJECT_SELF, "sLastName");
SetCustomToken(11001, sName);
SetCustomToken(11002, sLastName);
if (GetLocalInt(OBJECT_SELF, "Adventurer") == TRUE && GetLocalInt(OBJECT_SELF, "nPersonality") == 0) return TRUE;
return FALSE;
}

View File

@@ -0,0 +1,9 @@
int StartingConditional()
{
string sName = GetLocalString(OBJECT_SELF, "sName");
string sLastName = GetLocalString(OBJECT_SELF, "sLastName");
SetCustomToken(11001, sName);
SetCustomToken(11002, sLastName);
if (GetLocalInt(OBJECT_SELF, "Adventurer") == TRUE && GetLocalInt(OBJECT_SELF, "nPersonality") == 0 && GetHitDice(GetPCSpeaker()) >= 35) return TRUE;
return FALSE;
}

View File

@@ -0,0 +1,9 @@
int StartingConditional()
{
string sName = GetLocalString(OBJECT_SELF, "sName");
string sLastName = GetLocalString(OBJECT_SELF, "sLastName");
SetCustomToken(11001, sName);
SetCustomToken(11002, sLastName);
if (GetLocalInt(OBJECT_SELF, "Adventurer") == TRUE && GetLocalInt(OBJECT_SELF, "nPersonality") == 0 && GetLocalInt(GetPCSpeaker(), "Duel") == TRUE && GetLocalInt(OBJECT_SELF, "Defeat") == TRUE) return TRUE;
return FALSE;
}

View File

@@ -0,0 +1,9 @@
int StartingConditional()
{
string sName = GetLocalString(OBJECT_SELF, "sName");
string sLastName = GetLocalString(OBJECT_SELF, "sLastName");
SetCustomToken(11001, sName);
SetCustomToken(11002, sLastName);
if (GetLocalInt(OBJECT_SELF, "Adventurer") == TRUE && GetLocalInt(OBJECT_SELF, "nPersonality") == 0 && GetLocalInt(GetPCSpeaker(), "Duel") == TRUE && GetLocalInt(OBJECT_SELF, "Defeat") == FALSE) return TRUE;
return FALSE;
}

View File

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

View File

@@ -0,0 +1,17 @@
//::///////////////////////////////////////////////
//:: Name x2_def_onblocked
//:: Copyright (c) 2001 Bioware Corp.
//:://////////////////////////////////////////////
/*
Default OnBlocked script
*/
//:://////////////////////////////////////////////
//:: Created By: Keith Warner
//:: Created On: June 11/03
//:://////////////////////////////////////////////
void main()
{
if(GetLocalInt(OBJECT_SELF, "X4_VANILLA_AI") == TRUE) ExecuteScript("nw_c2_defaulte_v", OBJECT_SELF);
else ExecuteScript("nw_c2_defaulte", OBJECT_SELF);
}

View File

@@ -0,0 +1,17 @@
//::///////////////////////////////////////////////
//:: Name x2_def_onconv
//:: Copyright (c) 2001 Bioware Corp.
//:://////////////////////////////////////////////
/*
Default On Conversation script
*/
//:://////////////////////////////////////////////
//:: Created By: Keith Warner
//:: Created On: June 11/03
//:://////////////////////////////////////////////
void main()
{
if(GetLocalInt(OBJECT_SELF, "X4_VANILLA_AI") == TRUE) ExecuteScript("nw_c2_default4_v", OBJECT_SELF);
else ExecuteScript("nw_c2_default4", OBJECT_SELF);
}

View File

@@ -0,0 +1,117 @@
//::///////////////////////////////////////////////
//:: Name x2_def_ondamage
//:: Copyright (c) 2001 Bioware Corp.
//:://////////////////////////////////////////////
/*
Default OnDamaged script
*/
//:://////////////////////////////////////////////
//:: Created By: Keith Warner
//:: Created On: June 11/03
//:://////////////////////////////////////////////
#include "quest_inc"
#include "nw_i0_plot"
void main()
{
//--------------------------------------------------------------------------
// GZ: 2003-10-16
// Make Plot Creatures Ignore Attacks
//--------------------------------------------------------------------------
if (GetPlotFlag(OBJECT_SELF))
{
return;
}
//--------------------------------------------------------------------------
// Execute old NWN default AI code
//--------------------------------------------------------------------------
string sString;
if (GetLocalInt(OBJECT_SELF, "KidnapTarget") == TRUE && GetCurrentHitPoints() < GetMaxHitPoints()/5 && GetIsDead(OBJECT_SELF) == FALSE && GetLocalInt(OBJECT_SELF, "FightToDeath") == FALSE)
{
SetLocalInt(OBJECT_SELF, "FightToDeath", TRUE);
if (Random(2) == 0)
{
SetPlotFlag(OBJECT_SELF, TRUE);
ClearAllActions();
object oCreature = GetFirstObjectInArea(GetArea(OBJECT_SELF));
while (oCreature != OBJECT_INVALID)
{
if (GetObjectType(oCreature) == OBJECT_TYPE_CREATURE && oCreature != OBJECT_SELF)
{
SetIsTemporaryNeutral(oCreature, OBJECT_SELF);
SetIsTemporaryNeutral(OBJECT_SELF, oCreature);
AssignCommand(oCreature, ClearAllActions());
}
oCreature = GetNextObjectInArea(GetArea(OBJECT_SELF));
}
switch (Random(3))
{
case 0: sString = "Uh... I yield!"; break;
case 1: sString = "Stop! I give up!"; break;
case 2: sString = "No... please, don't kill me!"; break;
}
SpeakString(sString);
SetLocalInt(OBJECT_SELF, "Pacified", TRUE);
}
}
if (GetLocalInt(OBJECT_SELF, "WillRun") == TRUE && GetCurrentHitPoints() < GetMaxHitPoints()/5 && GetIsDead(OBJECT_SELF) == FALSE)
{
SetPlotFlag(OBJECT_SELF, TRUE);
SetLocalInt(OBJECT_SELF, "Running", TRUE);
DeleteLocalInt(GetArea(OBJECT_SELF), "NO_ESCAPE");
switch (Random(3))
{
case 0: sString = "Arrgh! This will not... end like this!"; break;
case 1: sString = "No! No! No!"; break;
case 2: sString = "I must... run..."; break;
}
SpeakString(sString);
if (GetLocalInt(OBJECT_SELF, "Quest_Target") == FALSE)
{
ClearAllActions(TRUE);
EscapeArea();
DelayCommand(25.0, DestroyObject(OBJECT_SELF));
}
else
{
object oPC = GetLocalObject(OBJECT_SELF, "oPC");
int nInitiative = 0;
if (GetHasFeat(FEAT_BLOODED, oPC) == TRUE) nInitiative = 2;
if (GetHasFeat(FEAT_THUG, oPC) == TRUE) nInitiative = nInitiative + 2;
if (GetHasFeat(FEAT_IMPROVED_INITIATIVE, oPC) == TRUE) nInitiative = nInitiative + 4;
if (GetHasFeat(FEAT_EPIC_SUPERIOR_INITIATIVE, oPC) == TRUE) nInitiative = nInitiative + 4;
int nRandom = d20();
if (GetArea(OBJECT_SELF) == GetArea(oPC))
{
if (nRandom+nInitiative >= 15)
{
SendMessageToPC(oPC, "Initiative check: " + IntToString(nInitiative) + " + " + IntToString(nRandom) + " = " + IntToString(nRandom+nInitiative) + " *SUCCESS*");
SetPlotFlag(OBJECT_SELF, FALSE);
DeleteLocalInt(OBJECT_SELF, "Running");
}
else
{
SendMessageToPC(oPC, "Initiative check: " + IntToString(nInitiative) + " + " + IntToString(nRandom) + " = " + IntToString(nRandom+nInitiative) + " *FAILURE*");
StoreQuestNPC(OBJECT_SELF);
ClearAllActions(TRUE);
EscapeArea();
DelayCommand(25.0, DestroyObject(OBJECT_SELF));
}
}
else
{
ClearAllActions(TRUE);
EscapeArea();
DelayCommand(25.0, DestroyObject(OBJECT_SELF));
}
}
}
if(GetLocalInt(OBJECT_SELF, "X4_VANILLA_AI") == TRUE) ExecuteScript("nw_c2_default6_v", OBJECT_SELF);
else ExecuteScript("nw_c2_default6", OBJECT_SELF);
}

View File

@@ -0,0 +1,91 @@
//::///////////////////////////////////////////////
//:: Name x2_def_ondeath
//:: Copyright (c) 2001 Bioware Corp.
//:://////////////////////////////////////////////
/*
Default OnDeath script
*/
//:://////////////////////////////////////////////
//:: Created By: Keith Warner
//:: Created On: June 11/03
//:://////////////////////////////////////////////
#include "quest_inc"
void Ressurect(effect eEffect)
{
ApplyEffectToObject(DURATION_TYPE_INSTANT, eEffect, OBJECT_SELF);
ApplyEffectToObject(DURATION_TYPE_INSTANT, EffectHeal(GetMaxHitPoints()), OBJECT_SELF);
SetIsDestroyable(FALSE, FALSE, FALSE);
}
void main()
{
//Defeat in a friendly duel
if (GetLocalInt(OBJECT_SELF, "Adventurer") == TRUE && GetLocalInt(OBJECT_SELF, "Duel") == TRUE && GetLocalInt(OBJECT_SELF, "DuelOver") == FALSE)
{
effect eEffect = GetFirstEffect(OBJECT_SELF);
while (GetIsEffectValid(eEffect))
{
if (GetEffectType(eEffect) == EFFECT_TYPE_PETRIFY) RemoveEffect(OBJECT_SELF, eEffect);
eEffect = GetNextEffect(OBJECT_SELF);
}
SetIsDestroyable(FALSE, TRUE, FALSE);
eEffect = SupernaturalEffect(EffectResurrection());
DelayCommand(3.0, Ressurect(eEffect));
SetPlotFlag(OBJECT_SELF, TRUE);
object oObject = GetFirstObjectInArea(GetArea(OBJECT_SELF));
object oPC;
while (GetIsObjectValid(oObject))
{
SetImmortal(oObject, FALSE);
ClearPersonalReputation(oObject);
AssignCommand(oObject, ClearAllActions());
oObject = GetNextObjectInArea(GetArea(OBJECT_SELF));
}
SetLocalInt(OBJECT_SELF, "Defeat", TRUE);
SetLocalInt(OBJECT_SELF, "DuelOver", TRUE);
DeleteLocalInt(GetArea(OBJECT_SELF), "Duel");
return;
}
if (GetLocalInt(OBJECT_SELF, "Dead") == TRUE) return;
SetLocalInt(OBJECT_SELF, "Dead", TRUE);
//Death of a famous adventurer
if (GetLocalInt(OBJECT_SELF, "Adventurer") == TRUE)
{
object oKiller = GetLastKiller();
if (GetAlignmentGoodEvil(OBJECT_SELF) != ALIGNMENT_EVIL) AdjustAlignment(oKiller, ALIGNMENT_EVIL, 5, FALSE);
GiveGoldToCreature(OBJECT_SELF, Random(10000)+10000);
object oItem = GetFirstItemInInventory();
while (GetIsObjectValid(oItem))
{
if (GetTag(oItem) == "NW_IT_GOLD001") SetDroppableFlag(oItem, TRUE);
oItem = GetNextItemInInventory();
}
DeleteAdventurerNPC(GetLocalInt(OBJECT_SELF, "nPosition"));
}
if ((GetLocalInt(OBJECT_SELF, "Quest_Target") == TRUE || GetCampaignString(CharacterDB(GetLocalObject(OBJECT_SELF, "oPC")), "QUEST_EXTRA2") == "mustkill") && GetIsQuestComplete(GetLocalObject(OBJECT_SELF, "oPC")) == FALSE && GetIsQuestFailed(GetLocalObject(OBJECT_SELF, "oPC")) == FALSE)
{
if (GetLocalInt(OBJECT_SELF, "KidnapTarget") == TRUE)
{
AddRandomQuestJournalEntry(GetLocalObject(OBJECT_SELF, "oPC"), 3);
}
else
{
AddRandomQuestJournalEntry(GetLocalObject(OBJECT_SELF, "oPC"), 2);
if (GetCampaignString(CharacterDB(GetLocalObject(OBJECT_SELF, "oPC")), "QUEST_EXTRA") == "stealring") CreateItemOnObject("quest_stolenring", GetLocalObject(OBJECT_SELF, "oPC"));
else if (GetCampaignString(CharacterDB(GetLocalObject(OBJECT_SELF, "oPC")), "QUEST_EXTRA") == "stealamulet") CreateItemOnObject("quest_stolenamul", GetLocalObject(OBJECT_SELF, "oPC"));
else if (GetCampaignString(CharacterDB(GetLocalObject(OBJECT_SELF, "oPC")), "QUEST_EXTRA") == "stealsphere") CreateItemOnObject("quest_stolenart1", GetLocalObject(OBJECT_SELF, "oPC"));
else if (GetCampaignString(CharacterDB(GetLocalObject(OBJECT_SELF, "oPC")), "QUEST_EXTRA") == "stealdisc") CreateItemOnObject("quest_stolenart2", GetLocalObject(OBJECT_SELF, "oPC"));
else if (GetCampaignString(CharacterDB(GetLocalObject(OBJECT_SELF, "oPC")), "QUEST_EXTRA") == "stealhand") CreateItemOnObject("quest_stolenart3", GetLocalObject(OBJECT_SELF, "oPC"));
else CreateItemOnObject("quest_proof_"+GetCampaignString(CharacterDB(GetLocalObject(OBJECT_SELF, "oPC")), "QUEST_EXTRA2"), GetLocalObject(OBJECT_SELF, "oPC"));
}
}
DeleteLocalInt(GetArea(OBJECT_SELF), "NO_ESCAPE");
DeleteStoredNPC(GetLocalString(OBJECT_SELF, "sOwner"), GetLocalInt(OBJECT_SELF, "nPosition"));
if(GetLocalInt(OBJECT_SELF, "X4_VANILLA_AI") == TRUE) ExecuteScript("nw_c2_default7_v", OBJECT_SELF);
else ExecuteScript("nw_c2_default7", OBJECT_SELF);
}

View File

@@ -0,0 +1,17 @@
//::///////////////////////////////////////////////
//:: Name x2_def_ondisturb
//:: Copyright (c) 2001 Bioware Corp.
//:://////////////////////////////////////////////
/*
Default OnDisturbed script
*/
//:://////////////////////////////////////////////
//:: Created By: Keith Warner
//:: Created On: June 11/03
//:://////////////////////////////////////////////
void main()
{
if(GetLocalInt(OBJECT_SELF, "X4_VANILLA_AI") == TRUE) ExecuteScript("nw_c2_default8_v", OBJECT_SELF);
else ExecuteScript("nw_c2_default8", OBJECT_SELF);
}

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