130 lines
5.2 KiB
Plaintext
130 lines
5.2 KiB
Plaintext
#include "quest_inc"
|
|
#include "nw_i0_plot"
|
|
void RemoveAllItems(object oCreature, string sTag="")
|
|
{
|
|
object oItem = GetFirstItemInInventory(oCreature);
|
|
while ( oItem != OBJECT_INVALID )
|
|
{
|
|
if ( "" == sTag || GetTag(oItem) == sTag )
|
|
DestroyObject(oItem);
|
|
oItem = GetNextItemInInventory(oCreature);
|
|
}
|
|
}
|
|
|
|
void BanditAttack(object oBandit)
|
|
{
|
|
AssignCommand(oBandit, ClearAllActions());
|
|
AssignCommand(oBandit, ActionAttack(GetPCSpeaker()));
|
|
}
|
|
|
|
void main()
|
|
{
|
|
if (GetLocalInt(OBJECT_SELF, "RansomQuest") == TRUE)
|
|
{
|
|
if (GetLocalInt(OBJECT_SELF, "Quest_Halt") == TRUE)
|
|
{
|
|
DeleteLocalObject(OBJECT_SELF, "oPC");
|
|
SetPlotFlag(OBJECT_SELF, TRUE);
|
|
ClearAllActions();
|
|
ActionMoveAwayFromObject(GetPCSpeaker(), FALSE);
|
|
ActionDoCommand(DestroyObject(OBJECT_SELF));
|
|
}
|
|
}
|
|
|
|
if (GetLocalInt(OBJECT_SELF, "EscortSuccessful") == TRUE && GetMaster(OBJECT_SELF) == GetPCSpeaker()) RemoveHenchman(GetPCSpeaker(), OBJECT_SELF);
|
|
|
|
if (GetLocalInt(OBJECT_SELF, "EscortBandits") >= 1 && GetLocalInt(OBJECT_SELF, "NoMoreBandits") == FALSE)
|
|
{
|
|
string sResRef;
|
|
string sAreaString = GetLocalString(GetArea(OBJECT_SELF), "AreaString");
|
|
string sRegionString = GetStringLeft(sAreaString, 1);
|
|
//Race should depend on the region
|
|
sResRef = "anc_roadbandit_h";
|
|
|
|
if (GetLocalInt(OBJECT_SELF, "EscortBandits") == 3)
|
|
{
|
|
if (GetRacialType(OBJECT_SELF) == RACIAL_TYPE_HUMAN) sResRef = "anc_roadbandit_h";
|
|
if (GetRacialType(OBJECT_SELF) == RACIAL_TYPE_ELF) sResRef = "anc_roadbandit_e";
|
|
if (GetRacialType(OBJECT_SELF) == RACIAL_TYPE_DWARF) sResRef = "anc_roadbandit_d";
|
|
if (GetRacialType(OBJECT_SELF) == RACIAL_TYPE_GNOME) sResRef = "anc_roadbandit_g";
|
|
if (GetRacialType(OBJECT_SELF) == RACIAL_TYPE_HALFLING) sResRef = "anc_roadbandi_ha";
|
|
if (GetRacialType(OBJECT_SELF) == RACIAL_TYPE_HALFELF) sResRef = "anc_roadbandi_he";
|
|
if (GetRacialType(OBJECT_SELF) == RACIAL_TYPE_HALFORC) sResRef = "anc_roadbandit_ho";
|
|
}
|
|
int nNumber;
|
|
int i;
|
|
object oBandit;
|
|
|
|
int nLevel = GetHitDice(GetPCSpeaker());
|
|
if (nLevel < 5) nNumber = 1;
|
|
if (nLevel >= 5 && nLevel <= 25) nNumber = 2;
|
|
if (nLevel >= 26 && nLevel <= 33) nNumber = 3;
|
|
if (nLevel == 34 || nLevel == 35) nNumber = 4;
|
|
if (nLevel == 36 || nLevel == 37) nNumber = 5;
|
|
if (nLevel > 37) nNumber = 6;
|
|
|
|
for (i = 1; i <= nNumber; i++)
|
|
{
|
|
oBandit = CreateObject(OBJECT_TYPE_CREATURE, sResRef, GetLocation(GetPCSpeaker()), TRUE);
|
|
SetLocalInt(oBandit, "EscortBandit", TRUE);
|
|
SetLocalObject(oBandit, "oPC", GetPCSpeaker());
|
|
LevelHenchmanUpTo(oBandit, nLevel, CLASS_TYPE_INVALID, 0, GetCreatureStartingPackage(oBandit), PACKAGE_INVALID);
|
|
if (GetLocalInt(OBJECT_SELF, "EscortBandits") >= 2)
|
|
{
|
|
SetIsTemporaryEnemy(GetPCSpeaker(), oBandit);
|
|
DelayCommand(0.5, BanditAttack(oBandit));
|
|
}
|
|
if (GetLocalInt(OBJECT_SELF, "EscortBandits") == 3)
|
|
{
|
|
SetIsTemporaryEnemy(GetPCSpeaker(), OBJECT_SELF);
|
|
ClearAllActions();
|
|
ActionMoveAwayFromObject(GetPCSpeaker(), TRUE);
|
|
}
|
|
}
|
|
SetLocalInt(OBJECT_SELF, "NoMoreBandits", TRUE);
|
|
}
|
|
|
|
if (GetLocalInt(OBJECT_SELF, "EscortQuest") == TRUE)
|
|
{
|
|
if (GetLocalInt(OBJECT_SELF, "Quest_Halt") == TRUE)
|
|
{
|
|
RemoveHenchman(GetPCSpeaker());
|
|
DeleteLocalObject(OBJECT_SELF, "oPC");
|
|
SetPlotFlag(OBJECT_SELF, TRUE);
|
|
ClearAllActions();
|
|
ActionMoveAwayFromObject(GetPCSpeaker(), FALSE);
|
|
ActionDoCommand(DestroyObject(OBJECT_SELF));
|
|
}
|
|
}
|
|
|
|
if (GetLocalInt(OBJECT_SELF, "Client") == TRUE && GetLocalInt(OBJECT_SELF, "EscortQuest") == FALSE)
|
|
{
|
|
SetLocalInt(OBJECT_SELF, "ClientSpawned", FALSE);
|
|
SetLocalInt(GetPCSpeaker(), "ClientSpawned", FALSE);
|
|
int nTavern = GetLocalInt(GetArea(OBJECT_SELF), "TavernNumber");
|
|
string sTag;
|
|
object oNPC = OBJECT_SELF;
|
|
|
|
//Get the area's exit waypoint's tag
|
|
if (nTavern == 1) sTag = "alverton_tav_exit";
|
|
|
|
//Make the client NPC walk away (out of the tavern)
|
|
EscapeArea(FALSE, sTag);
|
|
|
|
//Delete all quest data of the PC, but only if the PC does not have a quest journal entry
|
|
if (GetCampaignInt(CharacterDB(GetPCSpeaker()), "QUEST_JOURNAL") == 0)
|
|
{
|
|
DeleteQuest(GetPCSpeaker());
|
|
RemoveAllItems(GetPCSpeaker(), "quest_proof");
|
|
}
|
|
|
|
//Remove all effects on the NPC (to make quest exclamation and question marks disappear)
|
|
effect eEffect = GetFirstEffect(oNPC);
|
|
while (GetIsEffectValid(eEffect))
|
|
{
|
|
RemoveEffect(oNPC, eEffect);
|
|
eEffect = GetNextEffect(oNPC);
|
|
}
|
|
}
|
|
}
|