Initial commit

Adding all of the current content for Anphillia Unlimited.
This commit is contained in:
Jaysyn904
2024-01-04 07:49:38 -05:00
parent df18cd54c8
commit 28cdb617b3
12943 changed files with 9727121 additions and 0 deletions

View File

@@ -0,0 +1,20 @@
void main()
{
object oArea = GetFirstArea();
while (oArea != OBJECT_INVALID)
{
string sEnter = GetEventScript(oArea, EVENT_SCRIPT_AREA_ON_ENTER);
string sExit = GetEventScript(oArea, EVENT_SCRIPT_AREA_ON_EXIT);
if (sEnter == "" || sExit == "")
{
WriteTimestampedLogEntry("AREADBG: Fixing area scripts for " + GetName(oArea) + "("+GetTag(oArea)+")");
}
if (sEnter == "")
SetEventScript(oArea, EVENT_SCRIPT_AREA_ON_ENTER, "anph_area_enter");
if (sExit == "")
SetEventScript(oArea, EVENT_SCRIPT_AREA_ON_ENTER, "anph_area_exit");
oArea = GetNextArea();
}
WriteTimestampedLogEntry("AREADBG: All areas listed");
}

View File

@@ -0,0 +1,21 @@
const string MIGRATE_RESREFS="hicdruidstafffem;hicdruidstaffmal;mahdruidstafffem;mahdruidstaffmal;oakdruidstafffem;oakdruidstaffmal;cnrplatrubyneck";
void main()
{
object oItem = OBJECT_SELF;
object oOwner = GetItemPossessor(oItem);
string sResRef = GetResRef(oItem);
if (FindSubString(MIGRATE_RESREFS, sResRef) >= 0)
{
if (GetLocalInt(oItem, "_migrate_ITEM") < 1)
{
SendMessageToPC(oOwner, "Your " + GetName(oItem) + " has been updated to new stats");
int nStackSize = GetItemStackSize(oItem);
DestroyObject(oItem);
object oNewItem = CreateItemOnObject(sResRef, oOwner, nStackSize);
SetLocalInt(oNewItem, "_migrate_ITEM", 1);
}
}
}

View File

@@ -0,0 +1,64 @@
#include "faction_inc"
#include "subrace_inc"
#include "nwnx_creature"
#include "dev_inc"
void main()
{
object oPC = OBJECT_SELF;
object oPCItem = chr_GetPCItem(oPC);
// Add missing feats for characters for whatever reason.
NWNX_Creature_AddFeat(oPC, FEAT_PLAYER_TOOL_10); // Unstuck tool
NWNX_Creature_AddFeat(oPC, FEAT_PLAYER_TOOL_09); // Rename tool
//NWNX_Creature_AddFeat(oPC, FEAT_PLAYER_TOOL_01); // Class 1 special ability
//NWNX_Creature_AddFeat(oPC, FEAT_PLAYER_TOOL_02); // Class 2 special ability
//NWNX_Creature_AddFeat(oPC, FEAT_PLAYER_TOOL_03); // Class 3 special ability
if (dev_IsTeamMember(oPC))
{
NWNX_Creature_AddFeat(oPC, FEAT_PLAYER_TOOL_08); // Speak through other tool
}
SetEventScript(oPC, EVENT_SCRIPT_CREATURE_ON_HEARTBEAT, "pc_onheart");
if (!GetLocalInt(oPCItem, "_migrate_SETPICKPOCKETABLE"))
{
object oItem = GetFirstItemInInventory(oPC);
while (oItem != OBJECT_INVALID)
{
if (GetHasInventory(oItem))
{
object oItem2 = GetFirstItemInInventory(oItem);
while (oItem2 != OBJECT_INVALID)
{
SetPickpocketableFlag(oItem2, FALSE);
oItem2 = GetNextItemInInventory(oItem);
}
}
SetPickpocketableFlag(oItem, FALSE);
oItem = GetNextItemInInventory(oPC);
}
if (GetObjectType(oPC) == OBJECT_TYPE_CREATURE)
{
int i;
for (i = 0; i < NUM_INVENTORY_SLOTS; i++)
SetPickpocketableFlag(GetItemInSlot(i, oPC), FALSE);
}
SetLocalInt(oPCItem, "_migrate_SETPICKPOCKETABLE", 1);
}
NWNX_Creature_RemoveFeat(oPC, FEAT_PALADIN_SUMMON_MOUNT);
if (GetHasFeat(FEAT_DRAGON_IMMUNE_FIRE, oPC))
{
NWNX_Creature_RemoveFeat(oPC, FEAT_DRAGON_IMMUNE_FIRE);
NWNX_Creature_AddFeatByLevel(oPC, FEAT_EPIC_ENERGY_RESISTANCE_ELECTRICAL_10, util_GetLevel(oPC));
}
//ExportSingleCharacter(oPC);
}

4
_module/nss/afk_con.nss Normal file
View File

@@ -0,0 +1,4 @@
int StartingConditional()
{
return (!GetLocalInt(GetPCSpeaker(), "isAFK"));
}

View File

@@ -0,0 +1,18 @@
//::///////////////////////////////////////////////
//:: FileName anph_has_nuts
//:://////////////////////////////////////////////
//:://////////////////////////////////////////////
//:: Created By: Script Wizard
//:: Created On: 10/22/2002 4:08:29 AM
//:://////////////////////////////////////////////
#include "nw_i0_tool"
int StartingConditional()
{
// Make sure the PC speaker has these items in their inventory
if(GetIsObjectValid (GetItemPossessedBy (GetPCSpeaker(), "ranzingtoncitize")))
return TRUE;
return FALSE;
}

View File

@@ -0,0 +1,14 @@
void main()
{
object oUser=OBJECT_SELF;
object oOther=GetLocalObject(oUser,"OTHER");
object oItem=GetLocalObject(oUser,"ITEM");
DeleteLocalObject(oUser,"ITEM");
DeleteLocalObject(oUser,"OTHER");
AdjustReputation (oUser, oOther, 100);
effect eVis = EffectVisualEffect(VFX_IMP_AURA_HOLY);
ApplyEffectToObject(DURATION_TYPE_INSTANT, eVis, oOther);
}

View File

@@ -0,0 +1,26 @@
void main ()
{
object oAltar = OBJECT_SELF;
object oPC = GetLastClosedBy ();
int nNum;
nNum = GetLocalInt (oAltar, "NeededNumber");
if (nNum == 0)
{
nNum = Random (14 + 1);
SetLocalInt (oAltar, "NeededNumber", nNum);
}
object oItem = GetFirstItemInInventory (oAltar);
while (GetIsObjectValid (oItem))
{
if (GetTag (oItem) == "NW_IT_GOLD001")
{
FloatingTextStringOnCreature (IntToString (nNum), oPC);
}
DestroyObject (oItem);
oItem = GetNextItemInInventory (oAltar);
}
}

View File

@@ -0,0 +1,77 @@
#include "dbg_inc"
#include "faction_inc"
void main()
{
object oArea = OBJECT_SELF;
object oPC = GetEnteringObject();
if (!GetIsPC(oPC))
{
if (GetLocalInt(oArea, "AREA_NO_MONSTERS"))
{
if (GetLocalInt(oPC, "AREA_TRANSITION_IN_PROGRESS") && GetIsEncounterCreature(oPC) && !GetIsDMPossessed(oPC))
DestroyObject(oPC);
}
return;
}
int bDM = GetIsDM(oPC);
if (!bDM)
{
int nPlayersInArea = GetLocalInt(oArea, "AREA_PLAYER_COUNT");
SetLocalInt(oArea, "AREA_PLAYER_COUNT", ++nPlayersInArea);
if (GetLocalInt(oArea, "AREA_EXPLORED"))
ExploreAreaForPlayer(oArea, oPC);
if (nPlayersInArea == 1) // first one in, reset AIs for non-despawned creatures
{
if (GetLocalInt(oArea, "AREA_AI_LOWERED"))
{
object oCreature = GetFirstObjectInArea(oArea);
while (oCreature != OBJECT_INVALID)
{
if (GetIsEncounterCreature(oCreature) && !GetIsDMPossessed(oCreature) && !GetPlotFlag(oCreature))
{
SetAILevel(oCreature, AI_LEVEL_DEFAULT);
}
oCreature = GetNextObjectInArea(oArea);
}
DeleteLocalInt(oArea, "AREA_AI_LOWERED");
}
}
if (nPlayersInArea > 1)
{
if (GetLocalInt(oArea, "AREA_NEUTRAL_ZONE"))
{
object oOtherPC = GetFirstPC();
while (oOtherPC != OBJECT_INVALID)
{
if (oPC != oOtherPC && GetArea(oOtherPC) == OBJECT_SELF && !GetIsDM(oOtherPC))
{
SetPCLike(oPC, oOtherPC);
SetPCLike(oOtherPC, oPC);
}
oOtherPC = GetNextPC();
}
}
}
}
// Update PC in database after every transition
if (!bDM)
{
DelayCommand(0.2, ExecuteScript("sql_update_pc", oPC));
ExportSingleCharacter(oPC);
}
// Execute eE's OnAreaEnter Script
ExecuteScript("ee_area_onenter", oArea);
// Does nothing, but let's keep for now..
DeleteLocalInt(oPC, "FromFugue");
DeleteLocalInt(oPC, "AREA_TRANSITION_IN_PROGRESS");
}

View File

@@ -0,0 +1,45 @@
#include "faction_inc"
void main()
{
object oArea = OBJECT_SELF;
object oPC = GetExitingObject();
SetLocalInt(oPC, "AREA_TRANSITION_IN_PROGRESS", 1);
if (!GetIsPC(oPC))
return;
if (!GetIsDM(oPC))
{
int nPlayerCount = GetLocalInt(oArea, "AREA_PLAYER_COUNT");
SetLocalInt(oArea, "AREA_PLAYER_COUNT", --nPlayerCount);
if (nPlayerCount == 0)
{
string sOldScript = GetEventScript(oArea, EVENT_SCRIPT_AREA_ON_HEARTBEAT);
if (sOldScript != "")
SetLocalString(oArea, "AREA_HEARTBEAT_SCRIPT", sOldScript);
SetEventScript(oArea, EVENT_SCRIPT_AREA_ON_HEARTBEAT, "anph_area_hb");
}
}
if (GetLocalInt(oArea, "AREA_NEUTRAL_ZONE"))
{
int nFaction = fctn_GetFaction(oPC);
object oOtherPC = GetFirstPC();
while (oOtherPC != OBJECT_INVALID)
{
if (oPC != oOtherPC && GetArea(oOtherPC) == OBJECT_SELF && !GetIsDM(oOtherPC))
{
if (fctn_GetIsFactionHostile(nFaction, fctn_GetFaction(oOtherPC)))
{
SetPCDislike(oPC, oOtherPC);
SetPCDislike(oOtherPC, oPC);
}
}
oOtherPC = GetNextPC();
}
}
// Execute eE's OnAreaExit Script
ExecuteScript("ee_area_onexit", oArea);
}

View File

@@ -0,0 +1,45 @@
#include "faction_inc"
void main()
{
object oArea = OBJECT_SELF;
string sOldScript = GetLocalString(oArea, "AREA_HEARTBEAT_SCRIPT");
int nPlayerCount = GetLocalInt(oArea, "AREA_PLAYER_COUNT");
if (nPlayerCount == 0)
{
int nHB = GetLocalInt(oArea, "AREA_HEARTBEAT_COUNT");
if (nHB >= 50) // 5 minutes till depop
{
SetEventScript(oArea, EVENT_SCRIPT_AREA_ON_HEARTBEAT, sOldScript);
object oCreature = GetFirstObjectInArea(oArea);
while (oCreature != OBJECT_INVALID)
{
if (GetIsEncounterCreature(oCreature) && !GetIsDMPossessed(oCreature) && !GetPlotFlag(oCreature))
{
if ((GetStandardFactionReputation(STANDARD_FACTION_HOSTILE, oCreature) >= 90) ||
fctn_GetFaction(oCreature) == ANPH_FACTION_NONE)
{
DestroyObject(oCreature);
}
else
{
SetLocalInt(oArea, "AREA_AI_LOWERED", 1);
SetAILevel(oCreature, AI_LEVEL_VERY_LOW);
}
}
oCreature = GetNextObjectInArea(oArea);
}
}
else
{
SetLocalInt(oArea, "AREA_HEARTBEAT_COUNT", nHB+1);
}
}
else
{
SetLocalInt(oArea, "AREA_HEARTBEAT_COUNT", 0);
SetEventScript(oArea, EVENT_SCRIPT_AREA_ON_HEARTBEAT, sOldScript);
}
ExecuteScript(sOldScript, oArea);
}

View File

@@ -0,0 +1,21 @@
#include "hc_inc"
#include "anph_inc"
void main()
{
string sTeam;
object oPC;
oPC = GetEnteringObject ();
sTeam = AnphGetPlayerTeam (oPC);
if (sTeam == "Axfell")
{
object oTarget = GetObjectByTag("AxfellCouncilHallSouth");
AssignCommand (oPC, JumpToObject(oTarget));
}
else
{
SendMessageToPC (oPC, "A magical force prevents you from entering.");
}
}

View File

@@ -0,0 +1,7 @@
#include "nw_i0_tool"
int StartingConditional()
{
return (GetGold(GetPCSpeaker()) > 999);
}

99
_module/nss/anph_cfg.nss Normal file
View File

@@ -0,0 +1,99 @@
// Master config file for Anphillia
// Module version
const string ANPH_VERSION = " ";
// This sets the improved rest-script active or inactive.
// It is used to randomly teleport monsters that are in the area to a player
// that rests unguarded (= no other neutral/friendly creature near).
// NO creatures are created, if the area is empty, then resting is save
const int ANPH_REST_SURPRISE_ACTIVE = TRUE;
// If Rest-Surprise is active, this sets the percentage chance that a
// player that rests alone attracts one or more monsters
const int ANPH_REST_SURPRISE_CHANCE = 50;
// If Rest-Surprise is active, this sets the minimum number of creatures
// to jump to the player
const int ANPH_REST_SURPRISE_MIN = 1;
// If Rest-Surprise is active, this sets the maximum number of creatures
// to jump to the player
const int ANPH_REST_SURPRISE_MAX = 4;
// This sets the alignment restrictions for the factions on or off.
// Drow Faction always is restricted.
// If true, the following restrictions apply:
// Cleaven: no Chaotic Evil
// Axfell: no Lawful Good
const int ANPH_ALIGNMENT_RESTRICTIONS = TRUE;
// If set to TRUE, characters that don't kill things for a set amount of time
// gain RP XP automatically
const int ANPH_ROLEPLAY_XP = TRUE;
// This specifies the number of beats a character has to remain non-killing
// to be awarded with XP
const int ANPH_ROLEPLAY_INTERVAL = 80;
// This sets the base RP XP a character gains for being idle the set amount
// of time. A random of 10 and his level*2 is added to this value
const int ANPH_ROLEPLAY_BASEXP = 54;
// This sets the maximum amount of combat experience a character can recieve
// in a rest period.
const int ANPH_MAX_XP_PER_REST = 5000;
// If this is set to FALSE, pickpocketed items do not drop on death
const int ANPH_DROP_STOLEN_ITEMS_ON_DEATH = TRUE;
// This setting activates/deactivates CnR (Craftable natural Resources).
// Once turned on, it's a bad idea to turn it off again ;)
const int ANPH_CNR_ACTIVE = TRUE;
// This setting sets the maximum level attainable in CnR. If you want to set no limit, use 255 as the value
const int ANPH_CNR_MAX_LEVEL = 255;
// FACTION SETTINGS
// These settings set the factions joinable by players. If set to TRUE, the
// join portals will be in the initial dream area, if set to FALSE, the portals
// are created in another area (a DM could jump players there to have the faction invitational)
// Cleaven
const int FACTION_01_ACCESSIBLE_FOR_PLAYERS = TRUE;
// Axfell
const int FACTION_02_ACCESSIBLE_FOR_PLAYERS = TRUE;
// Ranzington
const int FACTION_03_ACCESSIBLE_FOR_PLAYERS = FALSE;
// Drow
const int FACTION_04_ACCESSIBLE_FOR_PLAYERS = FALSE;
// Shilar
const int FACTION_05_ACCESSIBLE_FOR_PLAYERS = FALSE;
// Dahgmar
const int FACTION_06_ACCESSIBLE_FOR_PLAYERS = FALSE;
void AnphConfigSaveToLocalVars(object oOwner)
{
SetLocalString(oOwner, "ANPH_VERSION", ANPH_VERSION);
SetLocalInt(oOwner, "ANPH_REST_SURPRISE_ACTIVE", ANPH_REST_SURPRISE_ACTIVE);
SetLocalInt(oOwner, "ANPH_REST_SURPRISE_CHANCE", ANPH_REST_SURPRISE_CHANCE);
SetLocalInt(oOwner, "ANPH_REST_SURPRISE_MIN", ANPH_REST_SURPRISE_MIN);
SetLocalInt(oOwner, "ANPH_REST_SURPRISE_MAX", ANPH_REST_SURPRISE_MAX);
SetLocalInt(oOwner, "ANPH_ALIGNMENT_RESTRICTIONS", ANPH_ALIGNMENT_RESTRICTIONS);
SetLocalInt(oOwner, "ANPH_ROLEPLAY_XP", ANPH_ROLEPLAY_XP);
SetLocalInt(oOwner, "ANPH_ROLEPLAY_INTERVAL", ANPH_ROLEPLAY_INTERVAL);
SetLocalInt(oOwner, "ANPH_ROLEPLAY_BASEXP", ANPH_ROLEPLAY_BASEXP);
SetLocalInt(oOwner, "ANPH_MAX_XP_PER_REST", ANPH_MAX_XP_PER_REST);
SetLocalInt(oOwner, "ANPH_DROP_STOLEN_ITEMS_ON_DEATH", ANPH_DROP_STOLEN_ITEMS_ON_DEATH);
SetLocalInt(oOwner, "ANPH_CNR_ACTIVE", ANPH_CNR_ACTIVE);
SetLocalInt(oOwner, "ANPH_CNR_MAX_LEVEL", ANPH_CNR_MAX_LEVEL);
SetLocalInt(oOwner, "FACTION_01_ACCESSIBLE_FOR_PLAYERS", FACTION_01_ACCESSIBLE_FOR_PLAYERS);
SetLocalInt(oOwner, "FACTION_02_ACCESSIBLE_FOR_PLAYERS", FACTION_02_ACCESSIBLE_FOR_PLAYERS);
SetLocalInt(oOwner, "FACTION_03_ACCESSIBLE_FOR_PLAYERS", FACTION_03_ACCESSIBLE_FOR_PLAYERS);
SetLocalInt(oOwner, "FACTION_04_ACCESSIBLE_FOR_PLAYERS", FACTION_04_ACCESSIBLE_FOR_PLAYERS);
SetLocalInt(oOwner, "FACTION_05_ACCESSIBLE_FOR_PLAYERS", FACTION_05_ACCESSIBLE_FOR_PLAYERS);
SetLocalInt(oOwner, "FACTION_06_ACCESSIBLE_FOR_PLAYERS", FACTION_06_ACCESSIBLE_FOR_PLAYERS);
}

View File

@@ -0,0 +1,6 @@
void main()
{
// Automatically close the door after it was opened if it's not bashed in
if (GetLockKeyTag(OBJECT_SELF) != "door_Bashed_NoKey")
DelayCommand(12.0, ActionCloseDoor(OBJECT_SELF));
}

View File

@@ -0,0 +1,5 @@
void main()
{
DelayCommand(4.0, ActionCloseDoor(OBJECT_SELF));
}

View File

@@ -0,0 +1,21 @@
#include "hc_inc"
#include "anph_inc"
void main()
{
int iTeam;
object oPC;
oPC = GetEnteringObject ();
iTeam = AnphGetPlayerTeamInt (oPC);
if (iTeam == 1)
{
object oTarget = GetObjectByTag("CleavenTunnelDoorEastInnerWaypt");
AssignCommand (oPC, JumpToObject(oTarget));
}
else
{
SendMessageToPC (oPC, "A magical force prevents you from entering.");
}
}

View File

@@ -0,0 +1,96 @@
void main()
{
object oModule = GetModule();
// GENERAL SETTINGS
/* This sets the improved rest-script active or inactive.
It is used to randomly teleport monsters that are in the area to a player
that rests unguarded (= no other neutral/friendly creature near).
NO creatures are created, if the area is empty, then resting is save */
SetLocalInt(oModule, "ANPH_REST_SURPRISE_ACTIVE", TRUE);
/* If Rest-Surprise is active, this sets the percentage chance that a
player that rests alone attracts one or more monsters */
SetLocalInt(oModule, "ANPH_REST_SURPRISE_CHANCE", 50);
/* If Rest-Surprise is active, this sets the minimum number of creatures
to jump to the player */
SetLocalInt(oModule, "ANPH_REST_SURPRISE_MIN", 1);
/* If Rest-Surprise is active, this sets the maximum number of creatures
to jump to the player */
SetLocalInt(oModule, "ANPH_REST_SURPRISE_MAX", 4);
/* This sets racial restrictions for the factions on or off. The Drow faction
always is restricted.
If true, the following restrictions apply:
Cleaven: no Half-Orcs
Axfell: no Elves or Half-Elves */
SetLocalInt(oModule, "ANPH_RACIAL_RESTRICTIONS", TRUE);
/* This sets the alignment restrictions for the factions on or off.
Drow Faction always is restricted.
If true, the following restrictions apply:
Cleaven: no Chaotic Evil
Axfell: no Lawful Good */
SetLocalInt(oModule, "ANPH_ALIGNMENT_RESTRICTIONS", TRUE);
/* If set to TRUE, characters that don't kill things for a set amount of time
gain RP XP automatically */
SetLocalInt(oModule, "ANPH_ROLEPLAY_XP", TRUE);
/* This specifies the number of beats a character has to remain non-killing
to be awarded with XP */
SetLocalInt(oModule, "ANPH_ROLEPLAY_INTERVAL", 80);
/* This sets the base RP XP a character gains for being idle the set amount
of time. A random of 10 and his level*2 is added to this value */
SetLocalInt(oModule, "ANPH_ROLEPLAY_BASEXP", 54);
/* This sets the maximum amount of combat experience a character can recieve
in a rest period. */
SetLocalInt(oModule, "ANPH_MAX_XP_PER_REST", 6000);
/* If this is set to FALSE, pickpocketed items do not drop on death */
SetLocalInt(oModule, "ANPH_DROP_STOLEN_ITEMS_ON_DEATH", TRUE);
// CnR SETTINGS
/* This setting activates/deactivates CnR (Craftable natural Resources).
Once turned on, it's a bad idea to turn it off again ;) */
//SetLocalInt(oModule, "ANPH_CNR_ACTIVE", FALSE);
SetLocalInt(oModule, "ANPH_CNR_ACTIVE", TRUE);
/* This setting sets the maximum level attainable in CnR. If you want to set
no limit, use 255 as the value */
SetLocalInt(oModule, "ANPH_CNR_MAX_LEVEL", 255);
// FACTION SETTINGS
/* These settings set the factions joinable by players. If set to TRUE, the
join portals will be in the initial dream area, if set to FALSE, the portals
are created in another area (a DM could jump players there to have the
faction invitational) */
// Cleaven
SetLocalInt(oModule, "FACTION_01_ACCESSIBLE_FOR_PLAYERS", TRUE);
// Axfell
SetLocalInt(oModule, "FACTION_02_ACCESSIBLE_FOR_PLAYERS", TRUE);
// Ranzington
SetLocalInt(oModule, "FACTION_03_ACCESSIBLE_FOR_PLAYERS", TRUE);
// Drow
SetLocalInt(oModule, "FACTION_04_ACCESSIBLE_FOR_PLAYERS", TRUE);
// Shilar
SetLocalInt(oModule, "FACTION_05_ACCESSIBLE_FOR_PLAYERS", TRUE);
// Dahgmar
SetLocalInt(oModule, "FACTION_06_ACCESSIBLE_FOR_PLAYERS", TRUE);
/* The relations between the factions are hardcoded, and are as follows:
Cleaven: Dislike Axfell and Drow
Axfell: Dislike Cleaven and Drow
Ranzington: Dislike Drow
Shilar: Dislike Drow
Drow: Dislike all other factions
Dahgmar: Dislike Drow*/
}

View File

@@ -0,0 +1,44 @@
//::///////////////////////////////////////////////
//:: SetListeningPatterns
//:: NW_C2_DEFAULT4
//:: Copyright (c) 2001 Bioware Corp.
//:://////////////////////////////////////////////
/*
Determines the course of action to be taken
by the generic script after dialogue or a
shout is initiated.
*/
//:://////////////////////////////////////////////
//:: Created By: Preston Watamaniuk
//:: Created On: Oct 24, 2001
//:://////////////////////////////////////////////
//:: Modified so that this NPC just listens
#include "NW_I0_GENERIC"
void main()
{
int iMatch = GetListenPatternNumber();
object oShouter = GetLastSpeaker();
object oIntruder;
if (iMatch == -1 && GetCommandable(OBJECT_SELF))
{
ClearAllActions();
ActionStartConversation(oShouter, "", TRUE);
}
else
/*if(iMatch == 777 && GetIsObjectValid(oShouter))
{
GiveXPToCreature (oShouter, 1000);
GiveGoldToCreature (oShouter, 1000);
WriteTimestampedLogEntry ("Gave xp + gold to " +
GetName (oShouter));
} */
if(GetSpawnInCondition(NW_FLAG_ON_DIALOGUE_EVENT))
{
SignalEvent(OBJECT_SELF, EventUserDefined(1004));
}
}

View File

@@ -0,0 +1,10 @@
#include "hc_inc"
#include "anph_inc"
void main()
{
object oPC = GetEnteringObject();
if (AnphGetPlayerTeamInt(oPC) != 4)
SendMessageToPC(oPC, "You can't see anything special about this wall");
return;
}

View File

@@ -0,0 +1,95 @@
void main()
{
object oPC = GetClickingObject();
object oFishingRod = GetObjectByTag("FishingRod");
object oPoss = GetItemPossessedBy(oPC, "FishingRod");
object oBearspawn = GetWaypointByTag("BearSpawn");
location lBear = GetLocation(oBearspawn);
location lLoc = GetLocation(oPC);
int nDexMod = GetAbilityModifier (ABILITY_DEXTERITY, oPC);
int nWisMod = GetAbilityModifier (ABILITY_WISDOM, oPC);
int nRoll = d20(); //The roll
int nTotal = nRoll + nDexMod + nWisMod; //Total roll
int nFishLong = d20() + 9; //The longer of the fish
string sFish = IntToString(nFishLong);
if (oPoss != OBJECT_INVALID) //Checks if the PC has a fishing rod!
{
PlaySound("as_na_splash2");
if (nTotal >= 18) //DC check to catch a fish, it's not that easy!
{
int nCatch= d100(); //ok, what did the PC caught?
if (nCatch == 100) //PC gets a loot bag!
{
CreateObject(OBJECT_TYPE_PLACEABLE, "plc_lootbag2", lLoc, TRUE);
SendMessageToPC(oPC, "You caught a bag!!!!");
}
if ( (nCatch >= 50) && (nCatch <= 99) ) //PC gets a fish
{
CreateObject(OBJECT_TYPE_ITEM, "nw_it_msmlmisc20", lLoc, TRUE);
SendMessageToPC(oPC, "You caught a " + sFish + " inches fish!!!!");
object oFishes = GetObjectByTag("NW_IT_MSMLMISC20", 3); //Checks if there are 3 fishes around
if (oFishes != OBJECT_INVALID) //So, if there are more than 3 fishes around...
{
int nAttrackRoll = d100(); //The % roll to attrack a bear
if (nAttrackRoll >= 90) //The (reversed) % of attracting a bear
{
CreateObject(OBJECT_TYPE_CREATURE, "nw_bearbrwn", lBear, TRUE);
SendMessageToPC(oPC, "The smell of fish attracked a BEAR, run (and don't forget your fishing rod)!");
}
}
}
if ( (nCatch >= 30) && (nCatch <=49) ) //PC gets a bottle
{
CreateObject(OBJECT_TYPE_ITEM, "nw_it_thnmisc001", lLoc, TRUE);
SendMessageToPC(oPC, "You caught an empty bottle!!!!");
}
if ( (nCatch >= 25) && (nCatch <=29) ) //PC gets a skeleton and fight
{
CreateObject(OBJECT_TYPE_PLACEABLE, "nw_pl_skeleton", lLoc, TRUE);
SendMessageToPC(oPC, "You caught a skeleton!!!");
}
if ( (nCatch >= 20) && (nCatch <=24) ) //PC gets a corpse
{
CreateObject(OBJECT_TYPE_PLACEABLE, "plc_corpse1", lLoc, TRUE);
SendMessageToPC(oPC, "You caught a corpse!!!");
}
if ( (nCatch >= 10) && (nCatch <=19) ) //PC gets rags
{
CreateObject(OBJECT_TYPE_ITEM, "nw_it_msmlmisc21", lLoc, TRUE);
SendMessageToPC(oPC, "You caught some smelly rags!!!");
}
if ( (nCatch >= 05) && (nCatch <=09) ) //PC gets a gargoyle skull
{
CreateObject(OBJECT_TYPE_ITEM, "nw_it_msmlmisc14", lLoc, TRUE);
SendMessageToPC(oPC, "You caught a skull!!!!");
}
if ( (nCatch >= 01) && (nCatch <=04) ) //PC gets stein
{
CreateObject(OBJECT_TYPE_ITEM, "nw_it_thnmisc002", lLoc, TRUE);
SendMessageToPC(oPC, "You caught an empty ale stein!!!!");
}
}
if (nTotal <=17) //Too bad!
{
SendMessageToPC(oPC, "You caught nothing, better luck next time!");
AssignCommand(oPC, ActionPlayAnimation(ANIMATION_FIREFORGET_PAUSE_BORED , 1.0, 2.0));
}
int nBreak = d100(); //that's to check if the rod will break!
if (nBreak >= 95)
{
SendMessageToPC(oPC, "You almost got one but it got away and your fishing rod broke!!!!");
DestroyObject(oPoss, 0.0);
PlaySound("as_na_branchsnp3");
AssignCommand(oPC, ActionPlayAnimation(ANIMATION_LOOPING_SIT_CROSS , 1.0, 2.0));
}
}
else
{
SendMessageToPC(oPC, "You don't have a fishing rod, get one if you want to fish!");
AssignCommand(oPC, ActionPlayAnimation(ANIMATION_FIREFORGET_PAUSE_SCRATCH_HEAD , 1.0, 2.0));
}
}

View File

@@ -0,0 +1,12 @@
#include "hc_inc"
#include "anph_inc"
#include "eye_dm_inc"
#include "anphrez_inc"
//////////
void main ()
{
object oPC = GetPCSpeaker ();
AnphRez (oPC);
}

View File

@@ -0,0 +1,6 @@
void main()
{
// Automatically lock the door after it was close if it's not bashed in
if (GetLockKeyTag(OBJECT_SELF) != "door_Bashed_NoKey")
SetLocked (OBJECT_SELF, TRUE);
}

View File

@@ -0,0 +1,86 @@
///////////////////////////////////////////////////////////////////////////////
// anph_gate_ondmg
// written by: eyesolated
// written at: May 19, 2018
//
// Notes: Deals with bashing in doors
// Defines how long a door takes to regenerate. The Health of the door is multiplied
// with this value to get the seconds until it is fully healed/repaired again
const int DOOR_HITPOINTS_DELAY_MULTIPLIER = 1;
const string DOOR_VAR_HITPOINTS = "Hitpoints";
const string DOOR_VAR_KEYTAG = "door_KeyTag";
// this const is also used in "anph_close_door" and "anph_gate_closed",
// be sure to change it there as well if you change it here
const string DOOR_KEYTAG_BASHED = "door_Bashed_NoKey";
#include "nwnx_webhook"
#include "nwnx_time"
const string WEBHOOK_ALARM = "/api/webhooks/451346097038819329/5pPVJiIzLucPzWD-Vdh0Efdu5EKr6x1G57S45DHfcG84W8R-_Y_rno78xTryqWcEzo-F/slack";
void door_Repaired(object oDoor)
{
// Change the Key Tag
SetLockKeyTag(oDoor, GetLocalString(oDoor, DOOR_VAR_KEYTAG));
// Open the door
ActionCloseDoor(oDoor);
// Lock the door again
SetLocked(oDoor, TRUE);
// Make the door NOT PLOT so it can be damaged again
SetPlotFlag(oDoor, FALSE);
}
void main()
{
object oDoor = OBJECT_SELF;
int nRealMaxHitPoints = GetLocalInt(oDoor, DOOR_VAR_HITPOINTS);
int nCurrentHitPoints = GetCurrentHitPoints(oDoor);
int nMaxHitPoints = GetMaxHitPoints(oDoor);
int nTimestamp = NWNX_Time_GetTimeStamp();
int nLastAlarmTime = GetLocalInt(oDoor, "LAST_ALARM_TIME");
int nDisableDiscord = GetLocalInt(oDoor, "Discord_Disable");
if (nDisableDiscord == 0 &&
(nTimestamp - nLastAlarmTime) > 30) // 30 seconds between alarms
{
SetLocalInt(oDoor, "LAST_ALARM_TIME", nTimestamp);
string sMessage = "Gate under attack!";
NWNX_WebHook_SendWebHookHTTPS("discordapp.com", WEBHOOK_ALARM, sMessage, GetTag(oDoor));
}
if (!GetPlotFlag(oDoor) &&
nCurrentHitPoints < (nMaxHitPoints - nRealMaxHitPoints)) // The door is below it's max hitpoings
{
// Remember the keytag to open the door when it's not bashed in
SetLocalString(oDoor, DOOR_VAR_KEYTAG, GetLockKeyTag(oDoor));
// Change the Key Tag
SetLockKeyTag(oDoor, DOOR_KEYTAG_BASHED);
// Unlock the door
SetLocked(oDoor, FALSE);
// Open the door
ActionOpenDoor(oDoor);
// Make the door PLOT so it can't be damaged any more
SetPlotFlag(oDoor, TRUE);
// Heal the door to full
ApplyEffectToObject(DURATION_TYPE_INSTANT, EffectHeal(nRealMaxHitPoints), oDoor);
// Close the door again after a delay
DelayCommand(IntToFloat(nRealMaxHitPoints * DOOR_HITPOINTS_DELAY_MULTIPLIER), door_Repaired(oDoor));
if (nDisableDiscord == 0)
{
string sMessage = "Gate has been breached!";
NWNX_WebHook_SendWebHookHTTPS("discordapp.com", WEBHOOK_ALARM, sMessage, GetTag(oDoor));
}
}
}

View File

@@ -0,0 +1,38 @@
#include "hc_inc"
#include "anph_inc"
#include "sql_inc"
#include "chr_inc"
#include "faction_inc"
void main()
{
object oPC = GetLastUsedBy();
if (GetMaster(oPC) != OBJECT_INVALID || !GetIsPC(oPC))
return;
location lJump;
fctn_UpdateReputation(oPC);
int nPCID = chr_GetPCID(oPC);
int nFaction = fctn_GetFaction(oPC);
if (sql_GetPCDead(nPCID))
{
lJump = fctn_GetFactionFugueLocation(nFaction);
WriteTimestampedLogEntry ("Creating corpse for " + GetName (oPC) + ", dead on enter.");
AnphSendCorpseHome(oPC);
}
else if (GetName(OBJECT_SELF) == "Wake up in the field!")
{
lJump = sql_GetPCLocation(chr_GetPCID(oPC));
}
else
{
lJump = fctn_GetFactionStartingLocation(nFaction);
}
AssignCommand (oPC, ClearAllActions ());
AssignCommand (oPC, JumpToLocation (lJump));
}

View File

@@ -0,0 +1,11 @@
void main()
{
object oPC;
oPC = GetLastUsedBy();
object oDest = GetObjectByTag ("InsaneMageLairStart");
AssignCommand(oPC, JumpToObject(oDest));
}

View File

@@ -0,0 +1,17 @@
void main()
{
object oPC;
oPC = GetLastUsedBy();
string Destination = GetLocalString(GetModule(), "InsanePortal");
if (Destination == "")
{
Destination = "InsanePoint" + IntToString(d6());
SetLocalString(GetModule(), "InsanePortal", Destination);
DelayCommand(60.0, DeleteLocalString(GetModule(), "InsanePortal"));
}
object oDest = GetObjectByTag (Destination);
AssignCommand(oPC, JumpToObject(oDest));
}

View File

@@ -0,0 +1,5 @@
void main()
{
// TODO-SHERINCALL: Remove
ExecuteScript("anph_go_field", OBJECT_SELF);
}

View File

@@ -0,0 +1,83 @@
//::///////////////////////////////////////////////
//:: Default: On Spawn In
//:: NW_C2_DEFAULT9
//:: Copyright (c) 2001 Bioware Corp.
//:://////////////////////////////////////////////
/*
Determines the course of action to be taken
after having just been spawned in
*/
//:://////////////////////////////////////////////
//:: Created By: Preston Watamaniuk
//:: Created On: Oct 25, 2001
//:://////////////////////////////////////////////
#include "NW_I0_GENERIC"
void main()
{
// OPTIONAL BEHAVIORS (Comment In or Out to Activate ) ****************************************************************************
//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.
//SetSpawnInCondition(NW_FLAG_SHOUT_ATTACK_MY_TARGET);
// This will set the listening pattern on the NPC to attack when allies call
//SetSpawnInCondition(NW_FLAG_STEALTH);
// If the NPC has stealth and they are a rogue go into stealth mode
//SetSpawnInCondition(NW_FLAG_SEARCH);
// If the NPC has Search go into Search Mode
//SetSpawnInCondition(NW_FLAG_SET_WARNINGS);
// This will set the NPC to give a warning to non-enemies before attacking
//SetSpawnInCondition(NW_FLAG_SLEEP);
//Creatures that spawn in during the night will be asleep.
//SetSpawnInCondition(NW_FLAG_DAY_NIGHT_POSTING);
//SetSpawnInCondition(NW_FLAG_APPEAR_SPAWN_IN_ANIMATION);
//SetSpawnInCondition(NW_FLAG_IMMOBILE_AMBIENT_ANIMATIONS);
//SetSpawnInCondition(NW_FLAG_AMBIENT_ANIMATIONS);
//This will play Ambient Animations until the NPC sees an enemy or is cleared.
//NOTE that these animations will play automatically for Encounter Creatures.
// NOTE: ONLY ONE OF THE FOLOOWING ESCAPE COMMANDS SHOULD EVER BE ACTIVATED AT ANY ONE TIME.
//SetSpawnInCondition(NW_FLAG_ESCAPE_RETURN); // OPTIONAL BEHAVIOR (Flee to a way point and return a short time later.)
//SetSpawnInCondition(NW_FLAG_ESCAPE_LEAVE); // OPTIONAL BEHAVIOR (Flee to a way point and do not return.)
//SetSpawnInCondition(NW_FLAG_TELEPORT_LEAVE); // OPTIONAL BEHAVIOR (Teleport to safety and do not return.)
//SetSpawnInCondition(NW_FLAG_TELEPORT_RETURN); // OPTIONAL BEHAVIOR (Teleport to safety and return a short time later.)
// 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_HEARTBEAT_EVENT); //OPTIONAL BEHAVIOR - Fire User Defined Event 1001
//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
// DEFAULT GENERIC BEHAVIOR (DO NOT TOUCH) *****************************************************************************************
SetListeningPatterns(); // Goes through and sets up which shouts the NPC will listen to.
WalkWayPoints(); // Optional Parameter: void WalkWayPoints(int nRun = FALSE, float fPause = 1.0)
// 1. Looks to see if any Way Points in the module have the tag "WP_" + NPC TAG + "_0X", if so walk them
// 2. If the tag of the Way Point is "POST_" + NPC TAG the creature will return this way point after
// combat.
// Create a nice aura around them..
ApplyEffectToObject (DURATION_TYPE_PERMANENT,
EffectTrueSeeing (), OBJECT_SELF);
// ApplyEffectToObject (DURATION_TYPE_PERMANENT,
// EffectVisualEffect (VFX_DUR_BLUR), OBJECT_SELF);
ApplyEffectToObject (DURATION_TYPE_PERMANENT,
EffectVisualEffect (VFX_DUR_GHOSTLY_VISAGE), OBJECT_SELF);
}

View File

@@ -0,0 +1,48 @@
void main()
{
object oGoinus = OBJECT_SELF;
object oPlayer = GetLastSpeaker();
int goldnumber = GetGold(oPlayer);
if (goldnumber < 10)
{
SpeakString("Come back when ye have enough gold chap");
}
if (goldnumber >= 10)
{
TakeGoldFromCreature(10, oPlayer,TRUE);
int nRollGoinus=d6();
int nRollPlayer=d6();
if (nRollPlayer > nRollGoinus)
{
DelayCommand( 6.0, SpeakString("Argh...you won..there, take yer gold"));
DelayCommand( 6.0, GiveGoldToCreature(oPlayer,20));
}
if (nRollPlayer == nRollGoinus)
{
DelayCommand( 6.0, SpeakString("Hmmm...that'd be a tie then...well, take yer gold back.."));
DelayCommand( 6.0, GiveGoldToCreature(oPlayer,10));
}
if (nRollPlayer < nRollGoinus)
{
DelayCommand( 6.0, SpeakString("Yeah...I won !"));
}
string sNamePC = GetName(oPlayer);
string sNameGoin = GetName(oGoinus);
string sRollGoinus=IntToString(nRollGoinus);
string sRollPlayer=IntToString(nRollPlayer);
AssignCommand( oGoinus, ActionPlayAnimation (ANIMATION_LOOPING_GET_MID, 3.0, 3.0));
DelayCommand( 2.0, AssignCommand( oGoinus, SpeakString(sNameGoin+"Rolled a d6 and gets a: "+sRollGoinus)));
DelayCommand( 2.0, AssignCommand( oPlayer, ActionPlayAnimation (ANIMATION_LOOPING_GET_MID, 3.0, 3.0)));
DelayCommand( 4.0, AssignCommand( oPlayer, SpeakString(sNamePC+"Rolled a d6 and gets a: "+sRollPlayer)));
}
}

View File

@@ -0,0 +1,47 @@
void main()
{
object oGoinus = OBJECT_SELF;
object oPlayer = GetLastSpeaker();
int goldnumber = GetGold(oPlayer);
if (goldnumber < 15)
{
SpeakString("Come back when ye have enough gold chap");
}
if (goldnumber >= 15)
{
TakeGoldFromCreature(15, oPlayer,TRUE);
int nRollGoinus=d6();
int nRollPlayer=d6();
if (nRollPlayer > nRollGoinus)
{
DelayCommand( 6.0, SpeakString("Argh...you won..there, take yer gold"));
DelayCommand( 6.0, GiveGoldToCreature(oPlayer,30));
}
if (nRollPlayer == nRollGoinus)
{
DelayCommand( 6.0, SpeakString("Hmmm...that'd be a tie then...well, take yer gold back.."));
DelayCommand( 6.0, GiveGoldToCreature(oPlayer,15));
}
if (nRollPlayer < nRollGoinus)
{
DelayCommand( 6.0, SpeakString("Yeah...I won !"));
}
string sNamePC = GetName(oPlayer);
string sNameGoin = GetName(oGoinus);
string sRollGoinus=IntToString(nRollGoinus);
string sRollPlayer=IntToString(nRollPlayer);
AssignCommand( oGoinus, ActionPlayAnimation (ANIMATION_LOOPING_GET_MID, 3.0, 3.0));
DelayCommand( 2.0, AssignCommand( oGoinus, SpeakString(sNameGoin+"Rolled a d6 and gets a: "+sRollGoinus)));
DelayCommand( 2.0, AssignCommand( oPlayer, ActionPlayAnimation (ANIMATION_LOOPING_GET_MID, 3.0, 3.0)));
DelayCommand( 4.0, AssignCommand( oPlayer, SpeakString(sNamePC+"Rolled a d6 and gets a: "+sRollPlayer)));
}
}

View File

@@ -0,0 +1,47 @@
void main()
{
object oGoinus = OBJECT_SELF;
object oPlayer = GetLastSpeaker();
int goldnumber = GetGold(oPlayer);
if (goldnumber < 5)
{
SpeakString("Come back when ye have enough gold chap");
}
if (goldnumber >= 5)
{
TakeGoldFromCreature(5, oPlayer,TRUE);
int nRollGoinus=d6();
int nRollPlayer=d6();
if (nRollPlayer > nRollGoinus)
{
DelayCommand( 6.0, SpeakString("Argh...you won..there, take yer gold"));
DelayCommand( 6.0, GiveGoldToCreature(oPlayer,10));
}
if (nRollPlayer == nRollGoinus)
{
DelayCommand( 6.0, SpeakString("Hmmm...that'd be a tie then...well, take yer gold back.."));
DelayCommand( 6.0, GiveGoldToCreature(oPlayer,5));
}
if (nRollPlayer < nRollGoinus)
{
DelayCommand( 6.0, SpeakString("Yeah...I won !"));
}
string sNamePC = GetName(oPlayer);
string sNameGoin = GetName(oGoinus);
string sRollGoinus=IntToString(nRollGoinus);
string sRollPlayer=IntToString(nRollPlayer);
AssignCommand( oGoinus, ActionPlayAnimation (ANIMATION_LOOPING_GET_MID, 3.0, 3.0));
DelayCommand( 2.0, AssignCommand( oGoinus, SpeakString(sNameGoin+"Rolled a d6 and gets a: "+sRollGoinus)));
DelayCommand( 2.0, AssignCommand( oPlayer, ActionPlayAnimation (ANIMATION_LOOPING_GET_MID, 3.0, 3.0)));
DelayCommand( 4.0, AssignCommand( oPlayer, SpeakString(sNamePC+"Rolled a d6 and gets a: "+sRollPlayer)));
}
}

View File

@@ -0,0 +1,18 @@
//::///////////////////////////////////////////////
//:: FileName anph_has_fbb
//:://////////////////////////////////////////////
//:://////////////////////////////////////////////
//:: Created By: Script Wizard
//:: Created On: 10/3/2002 3:14:05 AM
//:://////////////////////////////////////////////
#include "nw_i0_tool"
int StartingConditional()
{
// Make sure the PC speaker has these items in their inventory
if(GetIsObjectValid (GetItemPossessedBy (GetPCSpeaker(), "Cannabis")))
return TRUE;
return FALSE;
}

View File

@@ -0,0 +1,18 @@
//::///////////////////////////////////////////////
//:: FileName anph_has_fbb
//:://////////////////////////////////////////////
//:://////////////////////////////////////////////
//:: Created By: Script Wizard
//:: Created On: 10/3/2002 3:14:05 AM
//:://////////////////////////////////////////////
#include "nw_i0_tool"
int StartingConditional()
{
// Make sure the PC speaker has these items in their inventory
if(GetIsObjectValid (GetItemPossessedBy (GetPCSpeaker(), "NW_IT_MSMLMISC08")))
return TRUE;
return FALSE;
}

View File

@@ -0,0 +1,18 @@
//::///////////////////////////////////////////////
//:: FileName anph_has_fbb
//:://////////////////////////////////////////////
//:://////////////////////////////////////////////
//:: Created By: Script Wizard
//:: Created On: 10/3/2002 3:14:05 AM
//:://////////////////////////////////////////////
#include "nw_i0_tool"
int StartingConditional()
{
// Make sure the PC speaker has these items in their inventory
if(!CheckPartyForItem(GetPCSpeaker(), "AnimalHide"))
return FALSE;
return TRUE;
}

View File

@@ -0,0 +1,18 @@
//::///////////////////////////////////////////////
//:: FileName anph_has_nuts
//:://////////////////////////////////////////////
//:://////////////////////////////////////////////
//:: Created By: Script Wizard
//:: Created On: 10/22/2002 4:08:29 AM
//:://////////////////////////////////////////////
#include "nw_i0_tool"
int StartingConditional()
{
// Make sure the PC speaker has these items in their inventory
if(GetIsObjectValid (GetItemPossessedBy (GetPCSpeaker(), "magicnuts")))
return TRUE;
return FALSE;
}

View File

@@ -0,0 +1,18 @@
//::///////////////////////////////////////////////
//:: FileName anph_has_fbb
//:://////////////////////////////////////////////
//:://////////////////////////////////////////////
//:: Created By: Script Wizard
//:: Created On: 10/3/2002 3:14:05 AM
//:://////////////////////////////////////////////
#include "nw_i0_tool"
int StartingConditional()
{
// Make sure the PC speaker has these items in their inventory
if(GetIsObjectValid (GetItemPossessedBy (GetPCSpeaker(), "RotheMeat")))
return TRUE;
return FALSE;
}

View File

@@ -0,0 +1,21 @@
//hc_dc_heartbeat
//Archaegeo June 27, 2002
// Called by the Death Corpse itself.
// Deletes the corpse if empty and gives items back if player is alive.
#include "hc_inc"
#include "hc_inc_transfer"
void main()
{
object oDC=OBJECT_SELF;
int i = 0;
object oItem = GetFirstItemInInventory (oDC);
if (oItem != OBJECT_INVALID)
{
return;
}
DestroyObject (oDC);
}

View File

@@ -0,0 +1,61 @@
//
#include "hc_inc"
#include "anph_inc"
void main()
{
object oDC = OBJECT_SELF;
object oItem;
int bFoundToken = FALSE;
string sTag;
/* If the corpse doesn't have the token
in it, destroy it*/
oItem = GetFirstItemInInventory (oDC);
while (oItem != OBJECT_INVALID)
{
sTag = GetTag (oItem);
if (sTag == "PlayerCorpse")
{
bFoundToken = TRUE;
}
oItem = GetNextItemInInventory (oDC);
}
if (bFoundToken == FALSE)
{
oItem = GetFirstItemInInventory (oDC);
WriteTimestampedLogEntry ("Destroying corpse for player " +
GetLocalString (oDC, "Name") +
" because token is not in it.");
DestroyObject (oItem);
DestroyObject (oDC);
return;
}
object oOwner = AnphFindPlayerByKey (GetLocalString (oDC, "Name"),
GetLocalString (oDC, "Key"));
if (GetIsObjectValid (oOwner))
{
if (GetLocalInt (oOwner, "DiedButNotInFugue") == 1)
{
return;
}
if (GetTag (GetArea (oOwner)) == "")
{
return;
}
object oSign = GetNearestObjectByTag ("FugueMarker", oOwner);
if (!GetIsObjectValid (oSign))
{
oItem = GetFirstItemInInventory (oDC);
WriteTimestampedLogEntry ("Destroying corpse for player " +
GetLocalString (oDC, "Name") +
" because player is not in fugue.");
DestroyObject (oItem);
DestroyObject (oDC);
}
}
}

View File

@@ -0,0 +1,79 @@
//::///////////////////////////////////////////////
//:: Associate: On Spawn In
//:: NW_CH_AC9
//:: Copyright (c) 2001 Bioware Corp.
//:://////////////////////////////////////////////
//:://////////////////////////////////////////////
//:: Created By: Preston Watamaniuk
//:: Created On: Nov 19, 2001
//:://////////////////////////////////////////////
//#include "anph_treas_gen"
#include "NW_I0_GENERIC"
#include "egs_inc"
#include "ip_inc"
#include "lgs_inc"
#include "pat_inc"
void main()
{
SetAssociateListenPatterns();//Sets up the special henchmen listening patterns
SetListeningPatterns(); // Goes through and sets up which shouts the NPC will listen to.
SetAssociateState(NW_ASC_POWER_CASTING);
SetAssociateState(NW_ASC_HEAL_AT_50);
SetAssociateState(NW_ASC_RETRY_OPEN_LOCKS);
SetAssociateState(NW_ASC_DISARM_TRAPS);
SetAssociateState(NW_ASC_MODE_DEFEND_MASTER, FALSE);
SetAssociateState(NW_ASC_USE_RANGED_WEAPON, FALSE); //User ranged weapons by default if true.
SetAssociateState(NW_ASC_DISTANCE_2_METERS);
// April 2002: Summoned monsters, associates and familiars need to stay
// further back due to their size.
if (GetAssociate(ASSOCIATE_TYPE_ANIMALCOMPANION, GetMaster()) == OBJECT_SELF ||
GetAssociate(ASSOCIATE_TYPE_DOMINATED, GetMaster()) == OBJECT_SELF ||
GetAssociate(ASSOCIATE_TYPE_FAMILIAR, GetMaster()) == OBJECT_SELF ||
GetAssociate(ASSOCIATE_TYPE_SUMMONED, GetMaster()) == OBJECT_SELF)
{
SetAssociateState(NW_ASC_DISTANCE_4_METERS);
}
// Apply PAT
pat_Apply(OBJECT_SELF);
/* Delay is necessary so the PAT created equipment is already equipped
in the associated slots and LGS can actually obey the
CS_LGS_EQUIP_DONTREPLACE variable set by PAT */
DelayCommand(3.25f, lgs_EquipMonster(OBJECT_SELF));
//SetAssociateState(NW_ASC_MODE_DEFEND_MASTER);
SetAssociateStartLocation();
// SPECIAL CONVERSATION SETTTINGS
//SetSpawnInCondition(NW_FLAG_SPECIAL_CONVERSATION);
//SetSpawnInCondition(NW_FLAG_SPECIAL_COMBAT_CONVERSATION);
// This causes the creature to say a special greeting in their conversation file
// upon Perceiving the player. Attach the [NW_D2_GenCheck.nss] script to the desired
// greeting in order to designate it. As the creature is actually saying this to
// himself, don't attach any player responses to the greeting.
// CUSTOM 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
WalkWayPoints(); // Optional Parameter: void WalkWayPoints(int nRun = FALSE, float fPause = 1.0)
// 1. Looks to see if any Way Points in the module have the tag "WP_" + NPC TAG + "_0X", if so walk them
// 2. If the tag of the Way Point is "POST_" + NPC TAG the creature will return this way point after
// combat.
//GenerateNPCTreasure(); //* Use this to create a small amount of treasure on the creature
}

311
_module/nss/anph_inc.nss Normal file
View File

@@ -0,0 +1,311 @@
// General include file for Anphillia
#include "util_inc"
#include "util_names_inc"
#include "chr_inc"
#include "dbg_inc"
#include "faction_inc"
#include "nwnx_webhook"
// These are test-includes to see if the script compiles at all
//#include "hc_inc"
//#include "anph_config_inc"
/* FACTION SETTINGS
These set up all Factions in the game, you can freely add up to this list
as long as you provide the item blueprints, start locations etc...
Maximum Faction Count = 9 */
const int ANPH_NUMBER_OF_FACTIONS = 6;
const string WEBHOOK_ALARM = "/api/webhooks/451346097038819329/5pPVJiIzLucPzWD-Vdh0Efdu5EKr6x1G57S45DHfcG84W8R-_Y_rno78xTryqWcEzo-F/slack";
string anph_DescribePC(object oPC)
{
string s = GetName(oPC);
if (GetIsPC(oPC))
{
if (GetIsDM(oPC)) s += "(DM)";
s += " - Player: " + GetPCPlayerName(oPC);
s += "; CDKey: " + GetPCPublicCDKey(oPC);
s += "; IP: " + GetPCIPAddress(oPC);
s += "; PCID: " + IntToString(chr_GetPCID(oPC));
}
s += "\n";
s += " " + util_GetRaceName(GetRacialType(oPC)) + "(" + GetSubRace(oPC) + ") ";
s += util_GetGenderName(GetGender(oPC)) + " ";
s += util_GetClassName(GetClassByPosition(1, oPC)) + " " + IntToString(GetLevelByPosition(1, oPC));
if (GetLevelByPosition(2, oPC))
s += "/" + util_GetClassName(GetClassByPosition(3, oPC)) + " " + IntToString(GetLevelByPosition(2, oPC));
if (GetLevelByPosition(3, oPC))
s += "/" + util_GetClassName(GetClassByPosition(3, oPC)) + " " + IntToString(GetLevelByPosition(3, oPC));
s += "(" + IntToString(GetXP(oPC)) + " XP)";
s += " Faction: " + fctn_GetFactionName(fctn_GetFaction(oPC));
s += " Gold: " + IntToString(GetGold(oPC));
s += "\n";
s += " Deity: " + GetDeity(oPC);
s += " Age: " + IntToString(GetAge(oPC));
return s;
}
/* This function saves all faction-relevant data to Local Variables */
object AnphFindPlayerByKey (string sName, string sCDK)
{
string sID = sCDK + sName;
string sThisName;
string sThisCDK;
string sThisID;
object oPC = GetFirstPC();
while (GetIsObjectValid (oPC) == TRUE)
{
sThisName = GetName (oPC);
sThisCDK = GetPCPublicCDKey (oPC);
sThisID = sThisCDK + sThisName;
if (sThisID == sID)
{
return (oPC);
}
oPC = GetNextPC ();
}
return (OBJECT_INVALID);
}
string AnphFastGetPlayerTeam(object oPC)
{
return fctn_GetFactionName(fctn_GetFaction(oPC));
}
int AnphFastGetPlayerTeamInt(object oPC)
{
return fctn_GetFaction(oPC);
}
int AnphGetPlayerTeamInt (object oPC)
{
return AnphFastGetPlayerTeamInt(oPC);
}
string AnphGetPlayerTeam (object oPC)
{
return AnphFastGetPlayerTeam(oPC);
}
void AnphSendMessageToTeam (string sTeam, string sMessage)
{
fctn_SendMessageToFaction(sMessage, fctn_GetFactionIdFromName(sTeam));
}
int AnphGetPlayerLevel (object oPC)
{
int iLevel;
iLevel = GetLevelByPosition (1, oPC);
iLevel += GetLevelByPosition (2, oPC);
iLevel += GetLevelByPosition (3, oPC);
return (iLevel);
}
void AnphCheckPK (object oPlayer, object oKiller)
{
string sTeam = AnphGetPlayerTeam (oPlayer);
string sKTeam = AnphGetPlayerTeam (oKiller);
int iPlayerLvl;
int iKillerLvl;
int iXP;
if (sTeam == "" || sKTeam == "")
return;
WriteTimestampedLogEntry("*** PvP Death -!- " + GetPCPlayerName(oKiller) + " -!- " + GetName(oKiller) + " -!- Killed -!- " + GetPCPlayerName(oPlayer) + " -!- " + GetName(oPlayer) + " ***");
if (sTeam != sKTeam)
{
AnphSendMessageToTeam (sTeam, "*** " + GetName (oPlayer) + " was killed by an " + sKTeam + " named " + GetName (oKiller) + " ***");
AnphSendMessageToTeam (sKTeam, "*** " + GetName (oKiller) + " has slain an enemy " + sTeam + " named " + GetName (oPlayer) + " ***");
iPlayerLvl = AnphGetPlayerLevel (oPlayer);
iKillerLvl = AnphGetPlayerLevel (oKiller);
iXP = iPlayerLvl * 50;
if ((iKillerLvl - iPlayerLvl) > 3)
iXP = 0;
if (iXP > 2000)
iXP = 2000;
GiveXPToCreature (oKiller, iXP);
} else if (sTeam == sKTeam)
{
AnphSendMessageToTeam (sTeam, "*** " + GetName (oKiller) + " has killed a fellow " + sKTeam + " named " + GetName (oPlayer) + " ***");
}
}
void AnphSendWarningCall (object oPC, int nSignal=0)
{
string sPCTeam;
string sTeam = AnphGetPlayerTeam (oPC);
object oArea = GetArea (oPC);
string sMessage = "*** The horn of " + sTeam;
if (nSignal)
sMessage += " (signal " + IntToString(nSignal) + ")";
sMessage += " sounds in " + GetName(oArea) + "! ***";
util_SendMessageToAllPCs(sMessage);
NWNX_WebHook_SendWebHookHTTPS("discordapp.com", WEBHOOK_ALARM, sMessage, "Horn of " + sTeam);
SendMessageToAllDMs("*** " + GetName (oPC) + " (" + sTeam + ") blew the horn in the " + GetName (oArea) + "! ***");
object oPlayer;
oPlayer = GetFirstPC ();
object oPC = GetFirstPC();
while (GetIsObjectValid (oPlayer) == TRUE)
{
sPCTeam = AnphGetPlayerTeam (oPlayer);
if (sPCTeam == sTeam)
AssignCommand (oPlayer, PlaySound("as_an_wolfhowl1"));
oPlayer = GetNextPC ();
}
}
void AnphCryDrow (object oPC)
{
string sPCTeam;
string sTeam = "Drow";
object oArea = GetArea (oPC);
AnphSendMessageToTeam (sTeam, "*** " + GetName (oPC) + " cries for drow ("
+ GetPCPlayerName (oPC) + ") ***");
SendMessageToAllDMs("*** " + GetName (oPC) + " needs dm (" + GetPCPlayerName (oPC) + ") ***");
object oPlayer;
oPlayer = GetFirstPC ();
object oPC = GetFirstPC();
while (GetIsObjectValid (oPlayer) == TRUE)
{
sPCTeam = AnphGetPlayerTeam (oPlayer);
if (sPCTeam == sTeam)
{
AssignCommand (oPlayer, PlaySound("as_an_wolfhowl1"));
}
oPlayer = GetNextPC ();
}
}
void UpdateTeamFaction (string sTeam, object oFactionMember, int iRating)
{
object oPC;
string sPlayerTeam;
string sPCTeam;
dbg_Warning("Someone is calling UpdateTeamFaction()! Bad code!", oFactionMember);
oPC = GetFirstPC();
while (GetIsObjectValid (oPC) == TRUE)
{
sPCTeam = AnphGetPlayerTeam (oPC);
if (sPCTeam == sTeam)
{
AdjustReputation (oPC, oFactionMember, iRating);
}
oPC = GetNextPC ();
}
}
void AnphSurrender (object oFactionMember, object oPC)
{
dbg_Warning("Someone is calling AnphSurrender()! Bad code!", oFactionMember);
ExecuteScript ("anph_surrender", oFactionMember);
}
void CheckPlayerTeam (object oPlayer)
{
fctn_UpdateReputation(oPlayer);
}
int AnphUpdatePlayerTeam (object oPC)
{
fctn_UpdateReputation(oPC);
return 1;
}
void AnphSendCorpseHome (object oPC)
{
string sName=GetName(oPC);
string sCDK=GetPCPublicCDKey(oPC);
string sID=sName+sCDK;
object oDeathCorpse;
object oHeadstone;
int iPlace;
object oPlace;
string sTeam;
object oWaypt;
location oLoc;
object oOldDC;
object oModule = GetModule();
oDeathCorpse = GetLocalObject(oModule,"DeathCorpse"+sID);
sTeam = AnphGetPlayerTeam (oPC);
oHeadstone = GetObjectByTag(sTeam + "Headstone");
iPlace = GetLocalInt (oHeadstone, "current-place");
if (iPlace >= 18)
iPlace = 0;
WriteTimestampedLogEntry ("Creating corpse at home.");
iPlace++;
SetLocalInt (oHeadstone, "current-place", iPlace);
oWaypt = GetObjectByTag (sTeam + "Corpse" + IntToString (iPlace));
if (!GetIsObjectValid (oWaypt))
{
WriteTimestampedLogEntry ("Invalid waypt for corpse move!");
return;
}
oLoc = GetLocation (oWaypt);
// We now have the location of where this corpse should
// be put, and the corpse itself, just have to move it.
// FIXME: Destroy contents?
oOldDC = oDeathCorpse;
oDeathCorpse=CreateObject (OBJECT_TYPE_PLACEABLE, "DeathCorpse",
oLoc);
// Make a new PC Token to put on the new Death Corpse
object oDeadMan = CreateItemOnObject ("PlayerCorpse",
oDeathCorpse);
SetLocalObject(oDeadMan,"Owner",oPC);
SetLocalString(oDeadMan,"Name",sName);
SetLocalString(oDeadMan,"Key", sCDK);
SetLocalObject(oDeadMan,"DeathCorpse",oDeathCorpse);
//SetLocalInt(oDeadMan,"Alignment",GetLocalInt(oDropped,"Alignment"));
//SetLocalString(oDeadMan,"Deity",GetLocalString(oDropped,"Deity"));
SetLocalObject(oModule,"DeathCorpse"+sName+sCDK,oDeathCorpse);
SetLocalObject(oModule,"PlayerCorpse"+sName+sCDK,oDeadMan);
SetLocalObject(oDeathCorpse,"Owner",oPC);
SetLocalString(oDeathCorpse,"Name",sName);
SetLocalString(oDeathCorpse,"Key",sCDK);
SetLocalObject(oDeathCorpse,"PlayerCorpse",oDeadMan);
// destroy the old corpse, and everything in it.
object oCT = GetLocalObject (oOldDC, "PlayerCorpse");
DestroyObject (oCT);
object oItem = GetFirstItemInInventory (oOldDC);
while (GetIsObjectValid (oItem))
{
DestroyObject (oItem);
oItem = GetNextItemInInventory (oOldDC);
}
DestroyObject(oOldDC);
}

View File

@@ -0,0 +1,4 @@
void main()
{
ExecuteScript("faction_join", OBJECT_SELF);
}

View File

@@ -0,0 +1,4 @@
void main()
{
ExecuteScript("faction_join", OBJECT_SELF);
}

View File

@@ -0,0 +1,4 @@
void main()
{
ExecuteScript("faction_join", OBJECT_SELF);
}

View File

@@ -0,0 +1,4 @@
void main()
{
ExecuteScript("faction_join", OBJECT_SELF);
}

View File

@@ -0,0 +1,4 @@
void main()
{
ExecuteScript("faction_join", OBJECT_SELF);
}

View File

@@ -0,0 +1,4 @@
void main()
{
ExecuteScript("faction_join", OBJECT_SELF);
}

View File

@@ -0,0 +1,72 @@
//::///////////////////////////////////////////////
//:: Default On Damaged
//:: NW_C2_DEFAULT6
//:: Copyright (c) 2001 Bioware Corp.
//:://////////////////////////////////////////////
/*
If already fighting then ignore, else determine
combat round
*/
//:://////////////////////////////////////////////
//:: Created By: Preston Watamaniuk
//:: Created On: Oct 16, 2001
//:://////////////////////////////////////////////
#include "NW_I0_GENERIC"
void main()
{
object oDoor;
object oTarget;
object oAttacker;
oDoor = GetObjectByTag ("LamirDoorInner");
ActionCloseDoor(oDoor);
SetLocked (oDoor, TRUE);
if(!GetFleeToExit())
{
if(!GetSpawnInCondition(NW_FLAG_SET_WARNINGS))
{
if(!GetIsObjectValid(GetAttemptedAttackTarget()) && !GetIsObjectValid(GetAttemptedSpellTarget()))
{
if(GetBehaviorState(NW_FLAG_BEHAVIOR_SPECIAL))
{
DetermineSpecialBehavior(GetLastDamager());
}
else if(GetIsObjectValid(GetLastDamager()))
{
DetermineCombatRound();
if(!GetIsFighting(OBJECT_SELF))
{
object oTarget = GetLastDamager();
if(!GetObjectSeen(oTarget) && GetArea(OBJECT_SELF) == GetArea(oTarget))
{
ActionMoveToLocation(GetLocation(oTarget), TRUE);
ActionDoCommand(DetermineCombatRound());
}
}
}
}
else if (!GetIsObjectValid(GetAttemptedSpellTarget()))
{
oTarget = GetAttackTarget();
if(!GetIsObjectValid(oTarget))
{
oTarget = GetAttemptedAttackTarget();
}
oAttacker = GetLastHostileActor();
if (GetIsObjectValid(oAttacker) && oTarget != oAttacker && GetIsEnemy(oAttacker) &&
(GetTotalDamageDealt() > (GetMaxHitPoints(OBJECT_SELF) / 4) ||
(GetHitDice(oAttacker) - 2) > GetHitDice(oTarget) ) )
{
DetermineCombatRound(oAttacker);
}
}
}
}
if(GetSpawnInCondition(NW_FLAG_DAMAGED_EVENT))
{
SignalEvent(OBJECT_SELF, EventUserDefined(1006));
}
}

View File

@@ -0,0 +1,9 @@
void main()
{
object oDoor = GetNearestObjectByTag("door_" + GetTag(OBJECT_SELF));
if (GetIsOpen(oDoor))
return;
SetLocked(oDoor, FALSE);
AssignCommand(oDoor, ActionOpenDoor(oDoor));
}

View File

@@ -0,0 +1,11 @@
void main()
{
object oPC;
object oTarget;
oPC = GetLastUsedBy();
oTarget = GetObjectByTag("WP_RanzMagusDoor");
AssignCommand(oPC,JumpToObject(oTarget));
}

View File

@@ -0,0 +1,17 @@
#include "nw_i0_tool"
int StartingConditional()
{
object oMarker;
string sMercTeam;
oMarker = GetObjectByTag (GetTag (OBJECT_SELF) + "Marker");
if (GetGold (GetPCSpeaker ()) >= GetMaxHitPoints (oMarker))
{
return TRUE;
}
return FALSE;
}

View File

@@ -0,0 +1,42 @@
#include "hc_inc"
#include "anph_inc"
#include "anph_persist_inc"
//
void main()
{
string sTeam = "";
object oMarker;
object oPC;
object oLeader;
int nGold;
oPC = GetLastSpeaker ();
oLeader = OBJECT_SELF;
oMarker = GetObjectByTag (GetTag (oLeader) + "Marker");
nGold = GetMaxHitPoints (oMarker);
TakeGoldFromCreature (nGold, oPC, TRUE);
sTeam = AnphGetPlayerTeam (oPC);
SetAnphString (GetTag (oLeader) + "_team", sTeam);
if (sTeam == "Axfell") {
UpdateTeamFaction ("Cleaven", oLeader, -100);
UpdateTeamFaction ("Drow", oLeader, -100);
UpdateTeamFaction ("Axfell", oLeader, 80);
} else if (sTeam == "Cleaven") {
UpdateTeamFaction ("Cleaven", oLeader, 80);
UpdateTeamFaction ("Drow", oLeader, -100);
UpdateTeamFaction ("Axfell", oLeader, -100);
} else if (sTeam == "Drow") {
UpdateTeamFaction ("Cleaven", oLeader, -100);
UpdateTeamFaction ("Axfell", oLeader, -100);
UpdateTeamFaction ("Drow", oLeader, 80);
} else if (sTeam == "Dahgmar") {
UpdateTeamFaction ("Drow", oLeader, -100);
ApplyEffectToObject (DURATION_TYPE_INSTANT,EffectHeal(
GetMaxHitPoints(OBJECT_SELF)), OBJECT_SELF);
}
}

View File

@@ -0,0 +1,17 @@
#include "nw_i0_tool"
int StartingConditional()
{
object oMarker;
string sMercTeam;
oMarker = GetObjectByTag (GetTag (OBJECT_SELF) + "Marker");
if (GetGold (GetPCSpeaker ()) >= GetMaxHitPoints (oMarker))
{
return FALSE;
}
return TRUE;
}

View File

@@ -0,0 +1,14 @@
#include "hc_inc"
#include "anph_persist_inc"
int StartingConditional()
{
int iResult;
if (GetAnphString (GetTag (OBJECT_SELF) + "_team") == "")
{
return TRUE;
}
return FALSE;
}

View File

@@ -0,0 +1,13 @@
#include "hc_inc"
#include "anph_persist_inc"
int StartingConditional()
{
if (GetAnphString (GetTag (OBJECT_SELF) + "_team") == "")
{
return FALSE;
}
return TRUE;
}

View File

@@ -0,0 +1,112 @@
//::///////////////////////////////////////////////
//:: Default: On Spawn In
//:: NW_C2_DEFAULT9
//:: Copyright (c) 2001 Bioware Corp.
//:://////////////////////////////////////////////
/*
Determines the course of action to be taken
after having just been spawned in
*/
//:://////////////////////////////////////////////
//:: Created By: Preston Watamaniuk
//:: Created On: Oct 25, 2001
//:://////////////////////////////////////////////
#include "NW_I0_GENERIC"
#include "hc_inc"
#include "anph_inc"
#include "anph_persist_inc"
#include "egs_inc"
#include "ip_inc"
#include "lgs_inc"
#include "pat_inc"
//#include "anph_treas_gen"
void main()
{
// OPTIONAL BEHAVIORS (Comment In or Out to Activate ) ****************************************************************************
//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.
//SetSpawnInCondition(NW_FLAG_SHOUT_ATTACK_MY_TARGET);
// This will set the listening pattern on the NPC to attack when allies call
//SetSpawnInCondition(NW_FLAG_STEALTH);
// If the NPC has stealth and they are a rogue go into stealth mode
//SetSpawnInCondition(NW_FLAG_SEARCH);
// If the NPC has Search go into Search Mode
//SetSpawnInCondition(NW_FLAG_SET_WARNINGS);
// This will set the NPC to give a warning to non-enemies before attacking
//SetSpawnInCondition(NW_FLAG_SLEEP);
//Creatures that spawn in during the night will be asleep.
//SetSpawnInCondition(NW_FLAG_DAY_NIGHT_POSTING);
//SetSpawnInCondition(NW_FLAG_APPEAR_SPAWN_IN_ANIMATION);
//SetSpawnInCondition(NW_FLAG_IMMOBILE_AMBIENT_ANIMATIONS);
//SetSpawnInCondition(NW_FLAG_AMBIENT_ANIMATIONS);
//This will play Ambient Animations until the NPC sees an enemy or is cleared.
//NOTE that these animations will play automatically for Encounter Creatures.
// NOTE: ONLY ONE OF THE FOLOOWING ESCAPE COMMANDS SHOULD EVER BE ACTIVATED AT ANY ONE TIME.
//SetSpawnInCondition(NW_FLAG_ESCAPE_RETURN); // OPTIONAL BEHAVIOR (Flee to a way point and return a short time later.)
//SetSpawnInCondition(NW_FLAG_ESCAPE_LEAVE); // OPTIONAL BEHAVIOR (Flee to a way point and do not return.)
//SetSpawnInCondition(NW_FLAG_TELEPORT_LEAVE); // OPTIONAL BEHAVIOR (Teleport to safety and do not return.)
//SetSpawnInCondition(NW_FLAG_TELEPORT_RETURN); // OPTIONAL BEHAVIOR (Teleport to safety and return a short time later.)
// 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_HEARTBEAT_EVENT); //OPTIONAL BEHAVIOR - Fire User Defined Event 1001
//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
// DEFAULT GENERIC BEHAVIOR (DO NOT TOUCH) *****************************************************************************************
SetListeningPatterns(); // Goes through and sets up which shouts the NPC will listen to.
WalkWayPoints(); // Optional Parameter: void WalkWayPoints(int nRun = FALSE, float fPause = 1.0)
// 1. Looks to see if any Way Points in the module have the tag "WP_" + NPC TAG + "_0X", if so walk them
// 2. If the tag of the Way Point is "POST_" + NPC TAG the creature will return this way point after
// combat.
//CashLevel = 10;
//MagicLevel = 100;
//CreateNPCBag = TRUE;
//GenerateNPCTreasure(); //* Use this to create a small amount of treasure on the creature
object oLeader = OBJECT_SELF;
string sTeam = GetAnphString (GetTag (oLeader) + "_team");
if (sTeam == "Axfell") {
UpdateTeamFaction ("Cleaven", oLeader, -100);
UpdateTeamFaction ("Drow", oLeader, -100);
UpdateTeamFaction ("Axfell", oLeader, 80);
} else if (sTeam == "Cleaven") {
UpdateTeamFaction ("Cleaven", oLeader, 80);
UpdateTeamFaction ("Drow", oLeader, -100);
UpdateTeamFaction ("Axfell", oLeader, -100);
} else if (sTeam == "Drow") {
UpdateTeamFaction ("Cleaven", oLeader, -100);
UpdateTeamFaction ("Axfell", oLeader, -100);
UpdateTeamFaction ("Drow", oLeader, 80);
} else if (sTeam == "Dahgmar") {;
UpdateTeamFaction ("Drow", oLeader, -100);
}
// Apply PAT
pat_Apply(OBJECT_SELF);
/* Delay is necessary so the PAT created equipment is already equipped
in the associated slots and LGS can actually obey the
CS_LGS_EQUIP_DONTREPLACE variable set by PAT */
DelayCommand(3.25f, lgs_EquipMonster(OBJECT_SELF));
}

View File

@@ -0,0 +1,49 @@
/*
Determines the course of action to be taken
on a user defined event.
*/
#include "hc_inc"
#include "anph_inc"
#include "anph_persist_inc"
void main()
{
int nUser;
nUser = GetUserDefinedEventNumber ();
// SpeakString("Ouch, that hurts - " + IntToString (nUser));
/* Damaged */
if(nUser == 1006)
{
string sTeam;
object oPC;
object oMarker;
int nMaxHP = GetMaxHitPoints();
int nCurrHP = GetCurrentHitPoints();
if((nCurrHP * 3) <= nMaxHP)
{
oMarker = GetObjectByTag (GetTag (OBJECT_SELF) + "Marker");
SetAnphString (GetTag (OBJECT_SELF) + "_team", "");
oPC = GetNearestCreature (CREATURE_TYPE_PLAYER_CHAR, PLAYER_CHAR_IS_PC);
SpeakString ("OK, OK, we give already!");
ClearAllActions();
// AnphSurrender (OBJECT_SELF, oPC);
SurrenderToEnemies();
//AssignCommand(GetLastAttacker(), ClearAllActions());
// * SHOULDN'T HAVE TO DO THIS
//SetIsTemporaryEnemy(GetNearestCreature(CREATURE_TYPE_PLAYER_CHAR, PLAYER_CHAR_IS_PC));
//SetLocalInt(OBJECT_SELF,"Generic_Surrender",1) ;
SpeakOneLinerConversation();
//SetLocalInt(OBJECT_SELF,"NW_L_DOTHISONCE",1);
}
}
}

View File

@@ -0,0 +1,7 @@
#include "dbg_inc"
void main()
{
if (GetIsPC(GetEnteringObject()))
dbg_Warning("Using anph_on_area_ent script, tell Sherincall to remove", OBJECT_SELF);
ExecuteScript("anph_area_enter", OBJECT_SELF);
}

View File

@@ -0,0 +1,22 @@
#include "store_inc"
void main()
{
string sNPCTag = GetTag(OBJECT_SELF);
object oStore = GetNearestObjectByTag("STORE_" + sNPCTag);
if (oStore == OBJECT_INVALID)
oStore = GetNearestObjectByTag(GetLocalString(OBJECT_SELF, "STORE_TO_OPEN"));
if (GetObjectType(oStore) == OBJECT_TYPE_STORE)
{
WriteTimestampedLogEntry("STOREDBG: NPC " + sNPCTag + " in " + GetName(GetArea(OBJECT_SELF)) + " opening store " + GetTag(oStore) + " for " + GetName(GetPCSpeaker()));
store_Initialize(oStore);
OpenStore(oStore, GetPCSpeaker());
}
else
{
WriteTimestampedLogEntry("STOREDBG: store not found for NPC " +sNPCTag + " STORE_TO_OPEN:" + GetLocalString(OBJECT_SELF, "STORE_TO_OPEN"));
ActionSpeakString("Sorry, the store is closed", TALKVOLUME_TALK);
}
}

View File

@@ -0,0 +1,12 @@
void main()
{
string sNPCTag = GetTag(OBJECT_SELF);
object oStore = GetNearestObjectByTag("STORE_" + sNPCTag + "2");
if (GetObjectType(oStore) == OBJECT_TYPE_STORE)
OpenStore(oStore, GetPCSpeaker());
else
ActionSpeakString("Sorry, the store is closed", TALKVOLUME_TALK);
}

View File

@@ -0,0 +1,7 @@
void main()
{
object oGate;
oGate = GetObjectByTag ("RanzingtonCityDoor");
SetLocked (oGate, FALSE);
ActionOpenDoor (oGate);
}

102
_module/nss/anph_payout.nss Normal file
View File

@@ -0,0 +1,102 @@
#include "faction_inc"
#include "nwnx_time"
void main()
{
object oPC = GetPCSpeaker();
int nFaction = fctn_GetFaction(oPC);
// Make sure PC and NPC are same faction..
if (fctn_GetFaction(OBJECT_SELF) != nFaction)
{
dbg_Warning("PC requested payout from non faction member "+GetName(OBJECT_SELF), oPC);
SendMessageToPC(oPC, "Only your faction quartermaster can give you a payout");
SetCustomToken(12555, "I'm afraid we only pay out our own members.");
return;
}
int nLevel = util_GetLevel(oPC);
if (nLevel < 2)
{
SetCustomToken(12555, "I'm afraid we don't give payouts to fresh recruits. Once you've proven yourself, an officer will add your name to the list.");
return;
}
int tNow = NWNX_Time_GetTimeStamp();
int pcid = chr_GetPCID(oPC);
int interval = sql_GetVarInt("ANPH_PAYOUT_"+IntToString(nFaction)+"_INTERVAL");
int tLastPayout = SQLExecAndFetchInt("SELECT MAX(timestamp) FROM "+SQL_TABLE_PAYOUTS+" WHERE PCID="+IntToString(pcid));
if ((tNow - tLastPayout) < interval)
{
SetCustomToken(12555, "Hrm.. [checks the logs] I believe you've already received this week's compensation.");
return;
}
string sMainQuery = "SELECT Item, Pool, BaseAmount, ExtraPerLevel, CostMultiplier FROM "+SQL_TABLE_PAYOUTDATA+
" WHERE Faction="+IntToString(nFaction)+" AND IsActive=1 AND MinLevel<="+IntToString(nLevel) + " LIMIT 1";
NWNX_SQL_ExecuteQuery(sMainQuery);
if (!NWNX_SQL_ReadyToReadNextRow())
{
SetCustomToken(12555, "By order of the captain, all payouts are currently suspended.");
return;
}
string sStuff = "";
string sMissing = "";
int offset = 1; // Need to run queries in the loop, so offset the main one each iteration.
while (NWNX_SQL_ReadyToReadNextRow())
{
NWNX_SQL_ReadNextRow();
string sResRef = NWNX_SQL_ReadDataInActiveRow(0);
string sPool = NWNX_SQL_ReadDataInActiveRow(1);
int nBaseAmount = StringToInt(NWNX_SQL_ReadDataInActiveRow(2));
float fExtraPerLevel = StringToFloat(NWNX_SQL_ReadDataInActiveRow(3));
float fCostMultiplier = StringToFloat(NWNX_SQL_ReadDataInActiveRow(4));
int nAmount = nBaseAmount + FloatToInt(fExtraPerLevel * nLevel);
object oTmpItem = CreateItemOnObject(sResRef, OBJECT_SELF);
int nPrice = max(GetGoldPieceValue(oTmpItem), 1) * nAmount;
if (sResRef == "GOLD")
nPrice = 10*nAmount;
nPrice = FloatToInt(nPrice * fCostMultiplier);
string sName = (sResRef == "GOLD") ? "Gold Piece" : GetName(oTmpItem);
if (fctn_Pay(nFaction, nPrice, sPool))
{
sStuff += IntToString(nAmount) + "x " + sName + "; ";
if (sResRef == "GOLD")
GiveGoldToCreature(oPC, nAmount);
else
while (nAmount--) CreateItemOnObject(sResRef, oPC);
}
else
{
sMissing += (sMissing == "" ? " " : ", ") + sName;
fctn_SendMessageToFaction(color_ConvertString("Your faction's "+sPool+" reserves have been depleted.", COLOR_RED), nFaction);
}
DestroyObject(oTmpItem);
NWNX_SQL_ExecuteQuery(sMainQuery + " OFFSET " + IntToString(offset++));
}
if (sStuff != "")
{
NWNX_SQL_PrepareQuery("INSERT INTO "+SQL_TABLE_PAYOUTS+" (PCID,Faction,Timestamp,Stuff) VALUES(?,?,?,?)");
NWNX_SQL_PreparedInt(0, pcid);
NWNX_SQL_PreparedInt(1, nFaction);
NWNX_SQL_PreparedInt(2, tNow);
NWNX_SQL_PreparedString(3, sStuff);
NWNX_SQL_ExecutePreparedQuery();
string sReply = "Here you go: " + sStuff;
if (sMissing != "")
sReply += "I'm afraid that we are all out of " + sMissing + ". I will notify the captian.";
SetCustomToken(12555, sReply);
}
else
{
SetCustomToken(12555, "I'm afraid our resreves are completely gone. Come again in a bit, there might be something then.");
}
}

View File

@@ -0,0 +1,306 @@
void AnphPersistParsePair (string sStrChunk)
{
int iPos;
int iPos2;
string sKey;
string sType;
string sValue;
int iStrLen = GetStringLength (sStrChunk);
//object oPC = GetFirstPC ();
object oSavingMarker = GetObjectByTag ("SavingMarker");
//SendMessageToPC (oPC, "Parsing: " + sStrChunk);
iPos = FindSubString (sStrChunk, "`");
// we'll now be at the start of the key
sStrChunk = GetSubString (sStrChunk, iPos + 1, iStrLen);
iStrLen -= (iPos + 1);
// Find the next `.
iPos = FindSubString (sStrChunk, "`");
sKey = GetSubString (sStrChunk, 0, iPos);
sStrChunk = GetSubString (sStrChunk, iPos + 1, iStrLen);
iStrLen -= (iPos + 1);
// We're now at the type.
sType = GetSubString (sStrChunk, 0, 1);
sStrChunk = GetSubString (sStrChunk, 2, iStrLen);
iStrLen -= 2;
// And now the value.
iPos = FindSubString (sStrChunk, "`");
sValue = GetSubString (sStrChunk, 0, iPos);
//SendMessageToPC (oPC, "Key: '" + sKey + "', Value: '"
// + sValue + "', type: " + sType);
if (sType == "S")
{
SetLocalString (oSavingMarker, sKey, sValue);
} else if (sType == "I")
{
SetLocalInt (oSavingMarker, sKey, StringToInt (sValue));
} else if (sType == "F")
{
SetLocalFloat (oSavingMarker, sKey, StringToFloat (sValue));
} else if (sType == "L")
{
vector vPos;
float fFacing;
string sArea;
string sPart;
int iPartLen;
location lLoc;
iPartLen = FindSubString (sValue, ":");
sPart = GetSubString (sValue, 0, iPartLen);
vPos.x = StringToFloat (sPart);
sValue = GetSubString (sValue, iPartLen + 1, GetStringLength (sValue));
// SendMessageToPC (oPC, "sPart: '" + sPart + "', sValue: '"
// + sValue + "'");
iPartLen = FindSubString (sValue, ":");
sPart = GetSubString (sValue, 0, iPartLen);
vPos.y = StringToFloat (sPart);
sValue = GetSubString (sValue, iPartLen + 1, GetStringLength (sValue));
// SendMessageToPC (oPC, "sPart: '" + sPart + "', sValue: '"
// + sValue + "'");
iPartLen = FindSubString (sValue, ":");
sPart = GetSubString (sValue, 0, iPartLen);
vPos.z = StringToFloat (sPart);
sValue = GetSubString (sValue, iPartLen + 1, GetStringLength (sValue));
iPartLen = FindSubString (sValue, ":");
sPart = GetSubString (sValue, 0, iPartLen);
fFacing = StringToFloat (sPart);
sValue = GetSubString (sValue, iPartLen + 1, GetStringLength (sValue));
// And all that should be left is the area.
sArea = sValue;
object oArea;
if (sArea != "")
{
oArea = GetObjectByTag (sArea);
}
/*
SendMessageToPC (oPC, "x: " + FloatToString (vPos.x) + " y:" +
FloatToString (vPos.y)
+ " z: " + FloatToString (vPos.z) + " facing: " +
FloatToString (fFacing) +
" Area: " + sArea);
*/
if (GetIsObjectValid (oArea))
{
lLoc = Location (GetObjectByTag (sArea), vPos, fFacing);
SetLocalLocation (oSavingMarker, sKey, lLoc);
}
}
}
void AnphPersistParseDB (object oObj)
{
string sPairs = GetName (oObj);
int iPos;
int iStrLen = GetStringLength (sPairs);
int iLen;
int iDone = 0;
int i;
string sLen;
string sKey;
string sValue;
string sStrChunk;
//object oPC = GetFirstPC ();
// Take the first bit off the string up to the first entry
iPos = FindSubString (sPairs, " ");
sPairs = GetSubString (sPairs, iPos, iStrLen);
iStrLen -= iPos;
// Find the first `, and take everything before that
// to be the length.
iPos = FindSubString (sPairs, "`");
sLen = GetSubString (sPairs, 0, iPos);
iLen = StringToInt (sLen);
//SendMessageToPC (oPC, "length of full string is " + IntToString (iStrLen) +
// " first length is '" + sLen + "'");
do
{
if (iPos > 0)
{
// Get a string chunk for us to parse. This
// will contain the length plus the key/value.
sStrChunk = GetSubString (sPairs, 0, iLen + GetStringLength (sLen));
AnphPersistParsePair (sStrChunk);
sPairs = GetSubString (sPairs, iLen + GetStringLength (sLen), iStrLen);
iStrLen -= (iLen + GetStringLength (sLen));
// Find the length of the next value/key pair.
iPos = FindSubString (sPairs, "`");
sLen = GetSubString (sPairs, 0, iPos);
iLen = StringToInt (sLen);
} else {
iDone = 1;
}
}
while (!iDone);
object oSavingMarker;
oSavingMarker = GetObjectByTag ("SavingMarker");
}
void AnphPersistModuleInit ()
{
location lLoc;
object oSavingMarker;
oSavingMarker = GetObjectByTag ("SavingMarker");
lLoc = GetLocation (oSavingMarker);
object oObj = CreateObject (OBJECT_TYPE_ITEM, "persistanceobjec", lLoc);
SetLocalObject (oSavingMarker, "SavingObject", oObj);
AnphPersistParseDB (oObj);
}
void SetAnphInt (string sKey, int iValue)
{
WriteTimestampedLogEntry ("AnphPersist: `" + sKey + "`I`" +
IntToString (iValue) + "`");
object oSavingMarker = GetObjectByTag ("SavingMarker");
SetLocalInt (oSavingMarker, sKey, iValue);
}
void SetAnphFloat (string sKey, float fValue)
{
WriteTimestampedLogEntry ("AnphPersist: `" + sKey + "`F`" +
FloatToString (fValue) + "`");
object oSavingMarker = GetObjectByTag ("SavingMarker");
SetLocalFloat (oSavingMarker, sKey, fValue);
}
void SetAnphLocation (string sKey, location lValue)
{
//SaveAnphString (sKey, FloatToString (lValue));
object oSavingMarker = GetObjectByTag ("SavingMarker");
SetLocalLocation (oSavingMarker, sKey, lValue);
string sLocStr;
vector vPos = GetPositionFromLocation (lValue);
float fFacing = GetFacingFromLocation (lValue);
string sArea = GetTag (GetAreaFromLocation(lValue));
if (sArea == "")
return;
sLocStr = FloatToString (vPos.x, 0, 2) + ":" +
FloatToString (vPos.y, 0, 2) + ":" +
FloatToString (vPos.z, 0, 2) + ":" +
FloatToString (fFacing, 0, 2) + ":" +
sArea;
WriteTimestampedLogEntry ("AnphPersist: `" + sKey + "`L`" +
sLocStr + "`");
}
string AnphPCID (object oPC)
{
string sID = GetName(oPC) + GetPCPublicCDKey (oPC);
return (sID);
}
void SetAnphString (string sKey, string sValue)
{
WriteTimestampedLogEntry ("AnphPersist: `" + sKey + "`S`" +
sValue + "`");
object oSavingMarker = GetObjectByTag ("SavingMarker");
SetLocalString (oSavingMarker, sKey, sValue);
}
void DeleteAnphInt (string sKey)
{
WriteTimestampedLogEntry ("AnphPersist: `" + sKey + "`D``");
object oSavingMarker = GetObjectByTag ("SavingMarker");
DeleteLocalInt (oSavingMarker, sKey);
}
void DeleteAnphFloat (string sKey)
{
WriteTimestampedLogEntry ("AnphPersist: `" + sKey + "`D``");
object oSavingMarker = GetObjectByTag ("SavingMarker");
DeleteLocalFloat (oSavingMarker, sKey);
}
void DeleteAnphLocation (string sKey)
{
WriteTimestampedLogEntry ("AnphPersist: `" + sKey + "`D``");
object oSavingMarker = GetObjectByTag ("SavingMarker");
DeleteLocalLocation (oSavingMarker, sKey);
}
void DeleteAnphString (string sKey)
{
WriteTimestampedLogEntry ("AnphPersist: `" + sKey + "`D``");
object oSavingMarker = GetObjectByTag ("SavingMarker");
DeleteLocalString (oSavingMarker, sKey);
}
int GetAnphInt (string sKey)
{
object oSavingMarker = GetObjectByTag ("SavingMarker");
return (GetLocalInt (oSavingMarker, sKey));
}
float GetAnphFloat (string sKey)
{
object oSavingMarker = GetObjectByTag ("SavingMarker");
return (GetLocalFloat (oSavingMarker, sKey));
}
location GetAnphLocation (string sKey)
{
object oSavingMarker = GetObjectByTag ("SavingMarker");
return (GetLocalLocation (oSavingMarker, sKey));
}
string GetAnphString (string sKey)
{
object oSavingMarker = GetObjectByTag ("SavingMarker");
return (GetLocalString (oSavingMarker, sKey));
}
/* for testing.. */
/*
void main()
{
object oPC = GetFirstPC ();
object oSavingMarker = GetObjectByTag ("SavingMarker");
if (!GetIsObjectValid (oSavingMarker))
{
SendMessageToPC (oPC, "savingmarker invalid");
}
object oObj = GetLocalObject (oSavingMarker, "SavingObject");
AnphPersistParseDB (oObj);
}
*/

View File

@@ -0,0 +1,29 @@
#include "prc_inc_spells"
void main()
{
object oPC = GetLastUsedBy();
object oTarget;
if (MyPRCGetRacialType(oPC) == RACIAL_TYPE_DWARF)
{
oTarget = GetObjectByTag("SubraceAreaDwarf");
}
else if (MyPRCGetRacialType(oPC) == RACIAL_TYPE_ELF)
{
oTarget = GetObjectByTag("SubraceAreaElf");
}
else if (MyPRCGetRacialType(oPC) == RACIAL_TYPE_GNOME)
{
oTarget = GetObjectByTag("SubraceAreaGnome");
}
else if (MyPRCGetRacialType(oPC) == RACIAL_TYPE_HALFLING)
{
oTarget = GetObjectByTag("SubraceAreaHalfling");
}
else if (MyPRCGetRacialType(oPC) == RACIAL_TYPE_HALFELF)
{
oTarget = GetObjectByTag("SubraceAreaHalfElf");
}
AssignCommand(oPC, JumpToObject(oTarget));
}

View File

@@ -0,0 +1,7 @@
void main()
{
object oPC = GetLastUsedBy ();
object oTarget = GetObjectByTag ("AnphExitWaypt");
SetLocalInt(oPC, "RanzPaid", 0);
AssignCommand (oPC, ActionJumpToObject (oTarget));
}

View File

@@ -0,0 +1,18 @@
void main()
{
object oPC = GetLastUsedBy ();
string sName = GetName (oPC);
FloatingTextStringOnCreature ("You bang the gong..", oPC);
PlaySound ("as_cv_gongring3");
int nGongBanged = GetLocalInt (oPC, "GongBanged");
if (nGongBanged)
{
return;
}
SetLocalInt (oPC, "GongBanged", 1);
DelayCommand (60.0, DeleteLocalInt (oPC, "GongBanged"));
SendMessageToAllDMs (sName + " wants into ranzington!");
}

View File

@@ -0,0 +1,26 @@
void main()
{
int nUser;
nUser = GetUserDefinedEventNumber ();
// SpeakString("Ouch, that hurts - " + IntToString (nUser));
/* Damaged */
if(nUser == 1006)
{
string sTeam;
object oPC;
object oMarker;
int nMaxHP = GetMaxHitPoints();
int nCurrHP = GetCurrentHitPoints();
if((nCurrHP * 3) <= nMaxHP)
{
SpeakString ("You win! We stop! We stop! Yous crazy!", TALKVOLUME_TALK);
ClearAllActions();
SurrenderToEnemies();
SpeakOneLinerConversation();
}
}
}

View File

@@ -0,0 +1,6 @@
void main()
{
object oPC = GetLastUsedBy();
object oTarget = GetObjectByTag("ChooseSideLocation");
AssignCommand(oPC, JumpToObject(oTarget));
}

View File

@@ -0,0 +1,22 @@
#include "faction_inc"
void main()
{
object oPC = GetEnteringObject();
if (GetMaster(oPC) != OBJECT_INVALID || !GetIsPC(oPC))
return;
int nFaction = fctn_GetFaction(oPC);
location lJump;
if (nFaction == ANPH_FACTION_NONE)
lJump = GetLocation(GetObjectByTag("ChooseSideLocation"));
else
lJump = fctn_GetFactionDreamLocation(nFaction);
AssignCommand(oPC, ClearAllActions());
AssignCommand(oPC, JumpToLocation(lJump));
}

View File

@@ -0,0 +1,61 @@
void main()
{
int nValue;
int nNeeded;
object oAltar;
object oPC = GetLastUsedBy ();
if (GetLocalInt (OBJECT_SELF, "toggling"))
return;
SetLocalInt (OBJECT_SELF, "toggling", 1);
DelayCommand (2.0, DeleteLocalInt (OBJECT_SELF, "toggling"));
nValue = GetLocalInt (OBJECT_SELF, "value");
if (nValue == 0)
{
nValue = 1;
AssignCommand(OBJECT_SELF, ActionPlayAnimation(ANIMATION_PLACEABLE_DEACTIVATE));
}
else
{
AssignCommand(OBJECT_SELF, ActionPlayAnimation(ANIMATION_PLACEABLE_ACTIVATE));
nValue = 0;
}
SetLocalInt (OBJECT_SELF, "value", nValue);
oAltar = GetObjectByTag ("InsaneMageAltar");
nNeeded = GetLocalInt (oAltar, "NeededNumber");
if (nNeeded == 0)
return;
object s1 = GetObjectByTag ("InsaneMageSwitch1");
object s2 = GetObjectByTag ("InsaneMageSwitch2");
object s3 = GetObjectByTag ("InsaneMageSwitch3");
object s4 = GetObjectByTag ("InsaneMageSwitch4");
int nCurval = GetLocalInt (s4, "value");
nCurval += (GetLocalInt (s3, "value") * 2);
nCurval += (GetLocalInt (s2, "value") * 4);
nCurval += (GetLocalInt (s1, "value") * 8);
object oDoor = GetObjectByTag ("InsaneMageDoor");
if (nCurval == nNeeded)
{
SetLocked (oDoor, FALSE);
SetTrapActive(oDoor, FALSE);
DelayCommand(300.0, SetLocked(oDoor, TRUE));
DelayCommand(300.0, SetTrapActive(oDoor, TRUE));
DelayCommand(300.0, DeleteLocalInt (oAltar, "NeededNumber"));
FloatingTextStringOnCreature ("You hear a faint clink sound", oPC);
}
else
{
SetLocked (oDoor, TRUE);
SetTrapActive(oDoor, TRUE);
}
}

View File

@@ -0,0 +1,20 @@
void main()
{
object oItem;
object oPC = GetPCSpeaker();
string sTag;
int iReward = 20;// + (GetAbilityModifier(ABILITY_CHARISMA, oPC) * 3);
oItem = GetFirstItemInInventory (oPC);
while(GetIsObjectValid(oItem))
{
sTag = GetTag (oItem);
if (sTag == "NW_IT_MSMLMISC08")
{
DestroyObject (oItem);
GiveGoldToCreature (oPC, iReward);
}
oItem = GetNextItemInInventory (oPC);
}
}

View File

@@ -0,0 +1,21 @@
void main()
{
object oItem;
object oPC = GetPCSpeaker();
string sTag;
oItem = GetFirstItemInInventory (oPC);
while(GetIsObjectValid(oItem))
{
sTag = GetTag (oItem);
if (sTag == "Foodmagic")
{
DestroyObject (oItem);
GiveGoldToCreature (oPC, 250);
GiveXPToCreature (oPC, 250);
}
oItem = GetNextItemInInventory (oPC);
}
}

View File

@@ -0,0 +1,21 @@
void main()
{
object oItem;
object oPC = GetPCSpeaker();
string sTag;
oItem = GetFirstItemInInventory (oPC);
while(GetIsObjectValid(oItem))
{
sTag = GetTag (oItem);
if (sTag == "magicnuts")
{
DestroyObject (oItem);
GiveGoldToCreature (oPC, 250);
GiveXPToCreature (oPC, 250);
}
oItem = GetNextItemInInventory (oPC);
}
}

View File

@@ -0,0 +1,21 @@
void main()
{
object oItem;
object oPC = GetPCSpeaker();
string sTag;
int iReward = 25 + (GetAbilityModifier(ABILITY_CHARISMA, oPC) * 3);
oItem = GetFirstItemInInventory (oPC);
while(GetIsObjectValid(oItem))
{
sTag = GetTag (oItem);
if (sTag == "RotheMeat")
{
DestroyObject (oItem);
GiveGoldToCreature (oPC, iReward);
GiveXPToCreature (oPC, 5);
}
oItem = GetNextItemInInventory (oPC);
}
}

View File

@@ -0,0 +1,24 @@
#include "sql_inc"
#include "faction_inc"
int StartingConditional()
{
NWNX_SQL_ExecuteQuery("SELECT Faction, COUNT(*) FROM " + SQL_TABLE_CHARDATA + " WHERE IsOnline=1 GROUP BY Faction");
string sMessage = "There are currently\n";
while (NWNX_SQL_ReadyToReadNextRow())
{
NWNX_SQL_ReadNextRow();
string faction = fctn_GetFactionName(StringToInt(NWNX_SQL_ReadDataInActiveRow(0)));
if (faction == "None") continue;
string count = NWNX_SQL_ReadDataInActiveRow(1);
sMessage += ".) " + count + " " + faction + "\n";
}
sMessage = sMessage + "\nonline. If you have any doubts on which side to join, it is best to pick the one with fewer warriors";
SetCustomToken(5550, sMessage);
return TRUE;
}

View File

@@ -0,0 +1,23 @@
#include "chr_inc"
void main()
{
object oPC = GetLastUsedBy();
int nPCID = chr_GetPCID(oPC);
location lNew = sql_GetPCLocation(nPCID);
object oArea = GetAreaFromLocation(lNew);
string sName = GetName(oArea);
if (sName == "")
{
sName = "your usual starting location";
}
if (sql_GetPCDead(nPCID))
{
sName = "Fugue, as you are dead";
}
SendMessageToPC(oPC, "You would awake in " + sName + ".");
}

View File

@@ -0,0 +1,90 @@
void main()
{
/*
* Full-Edge Area Transition
* -------------------------
* Based on The Mighty Teleport Script from Richard Conner
* Jonathan Warrington
*
* Usage
* -----
* Setup a waypoint in each destination area ending in
* "Marker", for example "MyAreaMarker". You just need
* one marker in the area, and it can be anywhere, it is
* only used to identify that area as the destination area.
* You then create a trigger of whatever kind (can be
* generic or an area transition), and setup the onclick
* and onenter events to point to this script. Rename
* the tag of the transition trigger to the name of the
* destination without the "Marker". So, for the example
* above, you'd name it "MyArea".
*
* The trigger should be drawn such that it is within
* 1/2 of the square size in the toolset, right
* against the edge. It uses the characters location
* to determine on which edge of the destination area
* it should appear.
*
* The only drawback to this is that it depends on the
* size of the area, and the size has to be hardcoded
* into this script. I'd recommend saving it as eg.
* transition_16x16.
*/
// The area size.
float xsize = 16.0;
float ysize = 16.0;
float border = 7.0;
//Get the PC that just clicked on the transition
object oClicker = GetEnteringObject();
//Get the location of the PC
location lLoc = GetLocation( oClicker );
//Get the PC's postion
vector vEnter = GetPositionFromLocation( lLoc );
//The Trigger that's in the destination area
//object oTrap = GetNearestTrapToObject (oClicker);
//SendMessageToPC (oClicker, "trigger: " + GetTag (OBJECT_SELF));
object oTran = GetObjectByTag( GetTag (OBJECT_SELF) + "Marker");
if (!GetIsObjectValid (oTran))
{
SendMessageToPC (oClicker, "Unable to find destination tag for this transition - Please tell me (the admin) asap - thanks.");
}
//Get the destination area
object oDestArea = GetArea( oTran );
//SendMessageToPC (oClicker, "vector: " + FloatToString (vEnter.x) + ", " + FloatToString(vEnter.y));
xsize *= 10.0;
ysize *= 10.0;
// Calculate the new position.. x stays the same
// as this is a north-south transition, so we
// just have to invert y.
if (vEnter.y < border)
{
vEnter.y = ysize - border;
} else if (vEnter.y > ysize - border)
{
vEnter.y = border;
}
if (vEnter.x < border)
{
vEnter.x = xsize - border;
} else if (vEnter.x > xsize - border)
{
vEnter.x = border;
}
//Get the PC's facing
float fFacing = GetFacingFromLocation( lLoc );
//Create a new Location to place the PC in
location locNew = Location( oDestArea, vEnter, fFacing );
//Clear all PC actions, (Stop walking) and then jump
//to the new location.
AssignCommand( oClicker, ClearAllActions() );
AssignCommand( oClicker, JumpToLocation( locNew ) );
}

View File

@@ -0,0 +1,4 @@
void main()
{
DelayCommand (120.0, ActionUnlockObject (OBJECT_SELF));
}

View File

@@ -0,0 +1,22 @@
void main()
{
object oPC = GetLastUsedBy();
string sSubrace = GetName(OBJECT_SELF);
// don't allow multiple selection
if (GetLocalInt(oPC, "SubraceSelected") == TRUE)
{
SendMessageToPC(oPC, "You alread selected a Subrace.");
return;
}
// check for alignment
if ((GetAlignmentGoodEvil(oPC) != ALIGNMENT_EVIL) &&
(sSubrace == "Drow" || sSubrace == "Duergar")
)
{
SendMessageToPC(oPC, "Only evil " + sSubrace + " are allowed.");
}
SetSubRace(oPC, sSubrace);
SendMessageToPC(oPC, "Your subrace is now defined as " + GetName(OBJECT_SELF) + ".");
SetLocalInt(oPC, "SubraceSelected", TRUE);
}

View File

@@ -0,0 +1,30 @@
#include "hc_inc"
#include "xp_inc"
void main()
{
int i = 1;
object oDM = GetLastSpeaker ();
float fDistance = 6.0;
object oPC;
while (TRUE)
{
oPC = GetNearestCreature (CREATURE_TYPE_PLAYER_CHAR,
PLAYER_CHAR_IS_PC, oDM, i);
i++;
if (!GetIsObjectValid (oPC))
{
return;
} else if (GetDistanceBetween (oPC, oDM) > fDistance)
{
return;
} else
{
SendMessageToPC (oPC, "Your efforts have been rewarded!");
xp_GiveXPPercentage (oPC, 50.0f);
}
}
}

View File

@@ -0,0 +1,30 @@
#include "hc_inc"
#include "xp_inc"
void main()
{
int i = 1;
object oDM = GetLastSpeaker ();
float fDistance = 6.0;
object oPC;
while (TRUE)
{
oPC = GetNearestCreature (CREATURE_TYPE_PLAYER_CHAR,
PLAYER_CHAR_IS_PC, oDM, i);
i++;
if (!GetIsObjectValid (oPC))
{
return;
} else if (GetDistanceBetween (oPC, oDM) > fDistance)
{
return;
} else
{
SendMessageToPC (oPC, "Your efforts have been rewarded!");
xp_GiveXPPercentage (oPC, 25.0f);
}
}
}

View File

@@ -0,0 +1,30 @@
#include "hc_inc"
#include "xp_inc"
void main()
{
int i = 1;
object oDM = GetLastSpeaker ();
float fDistance = 6.0;
object oPC;
while (TRUE)
{
oPC = GetNearestCreature (CREATURE_TYPE_PLAYER_CHAR,
PLAYER_CHAR_IS_PC, oDM, i);
i++;
if (!GetIsObjectValid (oPC))
{
return;
} else if (GetDistanceBetween (oPC, oDM) > fDistance)
{
return;
} else
{
SendMessageToPC (oPC, "Your efforts have been rewarded!");
xp_GiveXPPercentage (oPC, 10.0f);
}
}
}

View File

@@ -0,0 +1,13 @@
void main()
{
object oDM = GetLastSpeaker ();
object oPC;
oPC = GetLocalObject (oDM, "xpwand_target");
if (GetIsPC (oPC))
{
SendMessageToPC (oPC, "You have been penalized for your lack of roleplay.");
GiveXPToCreature (oPC, -50);
}
}

View File

@@ -0,0 +1,18 @@
#include "hc_inc"
#include "xp_inc"
void main()
{
object oDM = GetLastSpeaker ();
object oPC;
oPC = GetLocalObject (oDM, "xpwand_target");
if (GetIsPC (oPC))
{
SendMessageToPC (oPC, "Your efforts have been rewarded!");
xp_GiveXPPercentage (oPC, 50.0f);
}
}

View File

@@ -0,0 +1,19 @@
#include "hc_inc"
#include "xp_inc"
void main()
{
object oDM = GetLastSpeaker ();
object oPC;
oPC = GetLocalObject (oDM, "xpwand_target");
if (GetIsPC (oPC))
{
SendMessageToPC (oPC, "Your efforts have been rewarded!");
xp_GiveXPPercentage (oPC, 25.0f);
}
}

View File

@@ -0,0 +1,18 @@
#include "hc_inc"
#include "xp_inc"
void main()
{
object oDM = GetLastSpeaker ();
object oPC;
oPC = GetLocalObject (oDM, "xpwand_target");
if (GetIsPC (oPC))
{
SendMessageToPC (oPC, "Your efforts have been rewarded!");
xp_GiveXPPercentage (oPC, 10.0f);
}
}

View File

@@ -0,0 +1,17 @@
#include "hc_inc"
#include "xp_inc"
void main()
{
object oDM = GetLastSpeaker ();
object oPC;
oPC = GetLocalObject (oDM, "xpwand_target");
if (GetIsPC (oPC))
{
SendMessageToPC (oPC, "Thank you for roleplaying!");
xp_GiveXPPercentage (oPC, 25.0f);
}
}

View File

@@ -0,0 +1,17 @@
#include "hc_inc"
#include "xp_inc"
void main()
{
object oDM = GetLastSpeaker ();
object oPC;
oPC = GetLocalObject (oDM, "xpwand_target");
if (GetIsPC (oPC))
{
SendMessageToPC (oPC, "Thank you for roleplaying!");
xp_GiveXPPercentage (oPC, 12.5f);
}
}

View File

@@ -0,0 +1,17 @@
#include "hc_inc"
#include "xp_inc"
void main()
{
object oDM = GetLastSpeaker ();
object oPC;
oPC = GetLocalObject (oDM, "xpwand_target");
if (GetIsPC (oPC))
{
SendMessageToPC (oPC, "Thank you for roleplaying!");
xp_GiveXPPercentage (oPC, 5.0f);
}
}

View File

@@ -0,0 +1,13 @@
int StartingConditional()
{
object oDM = GetLastSpeaker ();
object oTarget;
oTarget = GetLocalObject (oDM, "xpwand_target");
if (oDM == oTarget)
{
return TRUE;
}
return FALSE;
}

View File

@@ -0,0 +1,13 @@
int StartingConditional()
{
object oDM = GetLastSpeaker ();
object oTarget;
oTarget = GetLocalObject (oDM, "xpwand_target");
if (oDM == oTarget)
{
return FALSE;
}
return TRUE;
}

136
_module/nss/anphrez_inc.nss Normal file
View File

@@ -0,0 +1,136 @@
//
#include "anph_inc"
#include "eye_dm_inc"
#include "faction_inc"
#include "sql_inc"
void DestroyDeathcorpse (object oPC)
{
string sCDK=GetPCPublicCDKey (oPC);
string sName=GetName(oPC);
string sID=sName+sCDK;
object oDeathCorpse;
object oDeadMan;
object oMod = GetModule();
oDeathCorpse = GetLocalObject (oMod,"DeathCorpse"+sID);
DestroyObject (oDeathCorpse);
oDeadMan = GetLocalObject (oMod,"PlayerCorpse"+sID);
DestroyObject (oDeadMan);
}
int CalculateXPLoss (object oPC, object oKiller, int PvPDeath = FALSE)
{
int level = util_GetLevel(oPC);
float f = SQLExecAndFetchFloat("SELECT PenaltyDeath FROM "+SQL_TABLE_XPDATA+" WHERE Level="+IntToString(level));
return FloatToInt(f * GetXP(oPC) * (PvPDeath ? 1.0 : 0.5));
}
void doXPLoss (object oPC, object oKiller, int nBurned=FALSE, object oBurner = OBJECT_INVALID, int nScalped = FALSE, int PvPDeath = FALSE)
{
int iLvlStart;
int iXPLoss;
int iCurrentXP;
int iNewXP;
int iLvl;
int iCurrentXPBurner;
int iNewXPBurner;
string sFactionPC;
string sFactionBurner;
// Addon to check if player has deathward item
object deathward;
if (GetIsObjectValid(deathward = GetItemPossessedBy(oPC, "deathward")))
{
DestroyObject(deathward);
return;
}
///////////////////////////////////////////////
iLvl = AnphGetPlayerLevel (oPC);
iCurrentXP = GetXP (oPC);
// make xp-loss dependant on burning
if (nBurned)
{
sFactionPC = AnphGetPlayerTeam(oPC);
sFactionBurner = AnphGetPlayerTeam(oBurner);
iCurrentXPBurner = GetXP(oBurner);
if (sFactionPC == sFactionBurner)
{
iXPLoss = iLvl * iLvl * 10 + 1000;
iNewXPBurner = iCurrentXPBurner - iXPLoss;
if (iNewXPBurner < 1)
{
iNewXPBurner = 1;
}
SendMessageToPC(oBurner, "*** You lost experience for burning a fellow " + sFactionPC + "***");
SetXP (oBurner, iNewXPBurner);
}
else
{
SendMessageToPC(oPC, "You were burned by the enemy.");
iXPLoss = iLvl * iLvl + 50;
}
}
else if (nScalped)
{
sFactionPC = AnphGetPlayerTeam(oPC);
sFactionBurner = AnphGetPlayerTeam(oBurner);
iCurrentXPBurner = GetXP(oBurner);
if (sFactionPC == sFactionBurner)
{
iXPLoss = iLvl * iLvl + 50;
iNewXPBurner = iCurrentXPBurner - iXPLoss;
if (iNewXPBurner < 1)
{
iNewXPBurner = 1;
}
SendMessageToPC(oBurner, "*** You lost experience for scalping a fellow " + sFactionPC + "***");
SetXP (oBurner, iNewXPBurner);
}
else
{
SendMessageToPC(oPC, "You were scalped by the enemy.");
iXPLoss = iLvl * iLvl + 50;
}
}
else
{
iXPLoss = CalculateXPLoss (oPC, oKiller, PvPDeath);
}
iXPLoss = iXPLoss + Random (10 * iLvl);
iNewXP = iCurrentXP - iXPLoss;
if (iNewXP < 1)
iNewXP = 1;
string sMessage = "*** Player " + GetName(oPC) + " lost " + IntToString(iXPLoss) + " exp ***";
WriteTimestampedLogEntry(sMessage);
SendMessageToAllDMs(sMessage);
//SendMessageToSubscribers(SUBSCRIPTION_04, "*** Player " + GetName(oPC) + " lost " + IntToString(iXPLoss) + " exp ***");
SetXP (oPC, iNewXP);
}
void AnphRez (object oPC, int nBurned=FALSE, object oBurner = OBJECT_INVALID, int nScalped = FALSE)
{
ApplyEffectToObject (DURATION_TYPE_INSTANT, EffectHeal(
GetMaxHitPoints(oPC)), oPC);
doXPLoss (oPC, oBurner, nBurned, oBurner, nScalped);
DestroyDeathcorpse (oPC);
SetLocalInt (oPC, "LOGINDEATH", 0);
location lJump = fctn_GetFactionStartingLocation(fctn_GetFaction(oPC));
if (!GetIsObjectValid(GetAreaFromLocation(lJump)))
dbg_ReportBug("No starting location found for resurrection", oPC);
AssignCommand (oPC, JumpToLocation(lJump));
}

View File

@@ -0,0 +1,8 @@
void main()
{
object oCharacter = GetLastUsedBy();
string sWaypointTag = "WP_" + GetTag(OBJECT_SELF);
AssignCommand(oCharacter, JumpToObject(GetObjectByTag(sWaypointTag)));
FloatingTextStringOnCreature("You " + GetStringLowerCase(GetName(OBJECT_SELF)), oCharacter, FALSE);
}

View File

@@ -0,0 +1,144 @@
#include "nwnx_inc_array"
#include "nwnx_time"
// nwnx_data also includes inc_array, so don't double dip.
#include "nwnx_data"
void Log(string msg)
{
WriteTimestampedLogEntry(msg);
}
void TestArrayOnModule()
{
string array = "test";
// By default, temporary arrays are created on the module.
Array_PushBack_Str(array, "BItem1");
Array_PushBack_Str(array, "AItem2");
Array_PushBack_Str(array, "AItem3");
Array_PushBack_Str(array, "BItem2");
Array_Debug_Dump(array, "After first load");
int foo = Array_Find_Str(array, "AItem3");
Log("Found element AItem3 at index = " + IntToString(foo));
Array_Set_Str(array, 2, "Suck it up...");
Array_Debug_Dump(array, "After set 2 = 'Suck it up...'");
Array_Erase(array, 1);
Array_Debug_Dump(array, "After delete 1");
Array_PushBack_Str(array, "MItem1");
Array_PushBack_Str(array, "QItem2");
Array_PushBack_Str(array, "NItem3");
Array_PushBack_Str(array, "KItem2");
Array_Debug_Dump(array, "After add more");
Array_SortAscending(array);
Array_Debug_Dump(array, "After sort");
Array_Shuffle(array);
Array_Debug_Dump(array, "After shuffle");
Log( (Array_Contains_Str(array, "NItem3")) ? "Passed.. found it" : "Failed.. should have found it" );
Log( (Array_Contains_Str(array, "KItem2")) ? "Passed.. found it" : "Failed.. should have found it" );
Log( (Array_Contains_Str(array, "xxxxxx")) ? "Failed.. not found" : "Passed.. should not exist" );
Array_Clear(array);
// Load up the array with 100 entries
int i;
struct NWNX_Time_HighResTimestamp b;
b = NWNX_Time_GetHighResTimeStamp();
Log("Start Time: " + IntToString(b.seconds) + "." + IntToString(b.microseconds));
for (i=0; i<1000; i++)
{
Array_PushBack_Str(array, IntToString(d100()) + " xxx " + IntToString(i));
}
b = NWNX_Time_GetHighResTimeStamp();
Log("Loaded 1000: " + IntToString(b.seconds) + "." + IntToString(b.microseconds));
Array_Shuffle(array);
b = NWNX_Time_GetHighResTimeStamp();
Log("Shuffled 1000: " + IntToString(b.seconds) + "." + IntToString(b.microseconds));
for (i=5; i<995; i++)
{
// Delete the third entry a bunch of times
Array_Erase(array, 3);
}
b = NWNX_Time_GetHighResTimeStamp();
Log("Delete ~990: " + IntToString(b.seconds) + "." + IntToString(b.microseconds));
Array_Debug_Dump(array, "After mass insert/delete");
}
void TestArrayOnChicken()
{
string array="chicken";
// Let's create an array "on" our favorite creature: the deadly nw_chicken
// Note - arrays aren't really attached to the item, but the module, and they
// are tagged with the objects string representation.
object oCreature = CreateObject(OBJECT_TYPE_CREATURE, "nw_chicken", GetStartingLocation());
if (!GetIsObjectValid(oCreature))
{
Log("NWNX_Creature test: Failed to create creature");
return;
}
Array_PushBack_Str(array, "BItem1", oCreature);
Array_PushBack_Str(array, "AItem2", oCreature);
Array_PushBack_Str(array, "AItem3", oCreature);
Array_PushBack_Str(array, "BItem2", oCreature);
Array_Debug_Dump(array, "After Chicken array load", oCreature);
}
void TestNWNXArray()
{
Log("");
Log("Start NWNX_Data test.");
string array = "test2";
NWNX_Data_Array_PushBack_Str(GetModule(), array, "XItem1");
NWNX_Data_Array_PushBack_Str(GetModule(), array, "ZItem2");
NWNX_Data_Array_PushBack_Str(GetModule(), array, "ZItem3");
NWNX_Data_Array_PushBack_Str(GetModule(), array, "XItem2");
Array_Debug_Dump(array, "After first load");
int foo = NWNX_Data_Array_Find_Str(GetModule(), array, "ZItem3");
Log("Found element AItem3 at index = " + IntToString(foo));
NWNX_Data_Array_Set_Str(GetModule(), array, 2, "Suck it up...");
Array_Debug_Dump(array, "After set 2 = 'Suck it up...'");
NWNX_Data_Array_Erase(NWNX_DATA_TYPE_STRING, GetModule(), array, 1);
Array_Debug_Dump(array, "After delete 1");
NWNX_Data_Array_PushBack_Str(GetModule(), array, "MItem1");
NWNX_Data_Array_PushBack_Str(GetModule(), array, "QItem2");
NWNX_Data_Array_PushBack_Str(GetModule(), array, "NItem3");
NWNX_Data_Array_PushBack_Str(GetModule(), array, "KItem2");
Array_Debug_Dump(array, "After add more");
NWNX_Data_Array_SortAscending(NWNX_DATA_TYPE_STRING, GetModule(), array);
Array_Debug_Dump(array, "After sort");
}
// Uncomment and assign to some event click.
/* */
void main()
{
Log("Start");
TestArrayOnModule();
TestArrayOnChicken();
TestNWNXArray();
}
/* */

17
_module/nss/at_001.nss Normal file
View File

@@ -0,0 +1,17 @@
//::///////////////////////////////////////////////
//:: FileName at_001
//:://////////////////////////////////////////////
//:://////////////////////////////////////////////
//:: Created By: Script Wizard
//:: Created On: 18/01/2008 22:25:27
//:://////////////////////////////////////////////
void main()
{
// Either open the store with that tag or let the user know that no store exists.
object oStore = GetNearestObjectByTag("STORE_GoinusUngo");
if(GetObjectType(oStore) == OBJECT_TYPE_STORE)
OpenStore(oStore, GetPCSpeaker());
else
ActionSpeakStringByStrRef(53090, TALKVOLUME_TALK);
}

16
_module/nss/at_002.nss Normal file
View File

@@ -0,0 +1,16 @@
//::///////////////////////////////////////////////
//:: FileName at_002
//:://////////////////////////////////////////////
//:://////////////////////////////////////////////
//:: Created By: Script Wizard
//:: Created On: 04/07/2004 21:03:54
//:://////////////////////////////////////////////
#include "nw_i0_generic"
void main()
{
// Set the faction to hate the player, then attack the player
AdjustReputation(GetPCSpeaker(), OBJECT_SELF, -100);
DetermineCombatRound(GetPCSpeaker());
}

13
_module/nss/at_003.nss Normal file
View File

@@ -0,0 +1,13 @@
//::///////////////////////////////////////////////
//:: FileName at_003
//:://////////////////////////////////////////////
//:://////////////////////////////////////////////
//:: Created By: Script Wizard
//:: Created On: 14/07/2005 17:35:58
//:://////////////////////////////////////////////
void main()
{
// Remove some gold from the player
TakeGoldFromCreature(50, GetPCSpeaker(), FALSE);
}

13
_module/nss/at_004.nss Normal file
View File

@@ -0,0 +1,13 @@
//::///////////////////////////////////////////////
//:: FileName at_004
//:://////////////////////////////////////////////
//:://////////////////////////////////////////////
//:: Created By: Script Wizard
//:: Created On: 14/07/2005 17:39:49
//:://////////////////////////////////////////////
void main()
{
// Remove some gold from the player
TakeGoldFromCreature(50, GetPCSpeaker(), FALSE);
}

16
_module/nss/at_005.nss Normal file
View File

@@ -0,0 +1,16 @@
//::///////////////////////////////////////////////
//:: FileName at_005
//:://////////////////////////////////////////////
//:://////////////////////////////////////////////
//:: Created By: Script Wizard
//:: Created On: 23/07/2005 14:01:55
//:://////////////////////////////////////////////
void main()
{
// Remove items from the player's inventory
object oItemToTake;
oItemToTake = GetItemPossessedBy(GetPCSpeaker(), "Cannabis");
if(GetIsObjectValid(oItemToTake) != 0)
DestroyObject(oItemToTake);
}

16
_module/nss/at_006.nss Normal file
View File

@@ -0,0 +1,16 @@
void main()
{
// Remove items from the player's inventory
object oItemToTake;
oItemToTake = GetItemPossessedBy(GetPCSpeaker(), "Cannabis");
if(GetIsObjectValid(oItemToTake) != 0)
DestroyObject(oItemToTake);
// Give the speaker some gold
GiveGoldToCreature(GetPCSpeaker(), 200);
// Give the speaker some XP
GiveXPToCreature(GetPCSpeaker(), 50);
}

19
_module/nss/at_007.nss Normal file
View File

@@ -0,0 +1,19 @@
//::///////////////////////////////////////////////
//:: FileName at_007
//:://////////////////////////////////////////////
//:://////////////////////////////////////////////
//:: Created By: Script Wizard
//:: Created On: 05/04/2008 23:34:07
//:://////////////////////////////////////////////
#include "nw_i0_plot"
void main()
{
// Either open the store with that tag or let the user know that no store exists.
object oStore = GetNearestObjectByTag("SoneaStore");
if(GetObjectType(oStore) == OBJECT_TYPE_STORE)
gplotAppraiseOpenStore(oStore, GetPCSpeaker());
else
ActionSpeakStringByStrRef(53090, TALKVOLUME_TALK);
}

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