script fixes, additions to merchant

This commit is contained in:
EpicValor
2023-08-31 20:34:52 -05:00
parent e6bd2ef68d
commit eb5060ffdd
28 changed files with 2441 additions and 40 deletions

View File

@@ -2,12 +2,12 @@ void main()
{
effect eEffect = GetFirstEffect(OBJECT_SELF);
//while(GetIsEffectValid(eEffect))
while(GetIsEffectValid(eEffect))
{
if(GetEffectTag(eEffect) == "BUFFS")
RemoveEffect(OBJECT_SELF, eEffect);
eEffect = GetNextEffect(OBJECT_SELF);
}
int nGolemHench = GetStringLeft(GetTag(OBJECT_SELF), 6) == "GOLEMH" ? TRUE : FALSE;
if(nGolemHench)
{

View File

@@ -21,6 +21,7 @@
void main()
{
ExecuteScript("random_drop", OBJECT_SELF);
ExecuteScript("prc_npc_damaged", OBJECT_SELF);
object oDamager = GetLastDamager();

View File

@@ -0,0 +1,114 @@
//:://////////////////////////////////////////////////
//:: NW_C2_DEFAULT7
/*
Default OnDeath event handler for NPCs.
Adjusts killer's alignment if appropriate and
alerts allies to our death.
*/
//:://////////////////////////////////////////////////
//:: Copyright (c) 2002 Floodgate Entertainment
//:: Created By: Naomi Novik
//:: Created On: 12/22/2002
//:://////////////////////////////////////////////////
//:://////////////////////////////////////////////////
//:: Modified By: Deva Winblood
//:: Modified On: April 1st, 2008
//:: Added Support for Dying Wile Mounted
//:://///////////////////////////////////////////////
const string sHenchSummonedFamiliar = "HenchSummonedFamiliar";
const string sHenchSummonedAniComp = "HenchSummonedAniComp";
const string sHenchLastHeardOrSeen = "LastSeenOrHeard";
#include "x2_inc_compon"
#include "x0_i0_spawncond"
// Clears the last unheard, unseen enemy location
void ClearEnemyLocation();
void main()
{
object oKiller = GetLastKiller();
object oMaster = GetMaster();
int nAlign = GetAlignmentGoodEvil(OBJECT_SELF);
if(GetLocalInt(GetModule(), "X3_ENABLE_MOUNT_DB") && GetIsObjectValid(oMaster))
SetLocalInt(oMaster, "bX3_STORE_MOUNT_INFO", TRUE);
// If we're a good/neutral commoner,
// adjust the killer's alignment evil
if(GetLevelByClass(CLASS_TYPE_COMMONER)
&& (nAlign == ALIGNMENT_GOOD || nAlign == ALIGNMENT_NEUTRAL))
{
AdjustAlignment(oKiller, ALIGNMENT_EVIL, 5);
}
//Start Hench AI
if(GetLocalInt(OBJECT_SELF, "GaveHealing"))
{
// Pausanias: destroy potions of healing
object oItem = GetFirstItemInInventory();
while(GetIsObjectValid(oItem))
{
if(GetTag(oItem) == "NW_IT_MPOTION003")
DestroyObject(oItem);
oItem = GetNextItemInInventory();
}
}
if(GetLocalInt(OBJECT_SELF, sHenchSummonedFamiliar))
{
object oFam = GetLocalObject(OBJECT_SELF, sHenchSummonedFamiliar);
if(GetIsObjectValid(oFam))
{
//if(DEBUG) DoDebug(GetName(OBJECT_SELF) + " destroy familiar");
DestroyObject(oFam, 0.1);
ApplyEffectAtLocation(DURATION_TYPE_TEMPORARY, EffectVisualEffect(VFX_IMP_UNSUMMON), GetLocation(oFam));
}
}
if(GetLocalInt(OBJECT_SELF, sHenchSummonedAniComp))
{
object oAni = GetLocalObject(OBJECT_SELF, sHenchSummonedAniComp);
if(GetIsObjectValid(oAni))
{
//if(DEBUG) DoDebug(GetName(OBJECT_SELF) + " destroy ani comp");
DestroyObject(oAni, 0.1);
ApplyEffectAtLocation(DURATION_TYPE_TEMPORARY, EffectVisualEffect(VFX_IMP_UNSUMMON), GetLocation(oAni));
}
}
ClearEnemyLocation();
//End Hench AI
// Call to allies to let them know we're dead
SpeakString("NW_I_AM_DEAD", TALKVOLUME_SILENT_TALK);
//Shout Attack my target, only works with the On Spawn In setup
SpeakString("NW_ATTACK_MY_TARGET", TALKVOLUME_SILENT_TALK);
// NOTE: the OnDeath user-defined event does not
// trigger reliably and should probably be removed
if(GetSpawnInCondition(NW_FLAG_DEATH_EVENT))
SignalEvent(OBJECT_SELF, EventUserDefined(1007));
craft_drop_items(oKiller);
ExecuteScript("prc_npc_death", OBJECT_SELF);
ExecuteScript("prc_pwondeath", OBJECT_SELF);
}
void ClearEnemyLocation()
{
DeleteLocalInt(OBJECT_SELF, sHenchLastHeardOrSeen);
DeleteLocalLocation(OBJECT_SELF, sHenchLastHeardOrSeen);
object oInvisTarget = GetLocalObject(OBJECT_SELF, sHenchLastHeardOrSeen);
if (GetIsObjectValid(oInvisTarget))
{
DestroyObject(oInvisTarget);
DeleteLocalObject(OBJECT_SELF, sHenchLastHeardOrSeen);
}
}

View File

@@ -324,5 +324,5 @@ void main()
}
ExecuteScript("prc_pwonspawn", OBJECT_SELF);
DelayCommand(0.5, ExecuteScript("random_drop", OBJECT_SELF));
//DelayCommand(0.5, ExecuteScript("random_drop", OBJECT_SELF));
}

View File

@@ -1,9 +1,9 @@
//:://////////////////////////////////////////////////
//:: prc_pwonspawn
/*
OnSpawn catch all for the PRC
OnSpawn catch all for the PRC
*/
//:://////////////////////////////////////////////////
@@ -22,5 +22,5 @@ void main()
// ***** ADD ANY SPECIAL ON-SPAWN CODE HERE ***** //
ExecuteScript("random_drop",OBJECT_SELF);
//ExecuteScript("random_drop",OBJECT_SELF);
}

View File

@@ -1,22 +1,30 @@
void main()
void MakeItemsDroppable(object oNPC)
{
object oNPC = OBJECT_SELF;
object oItem = GetFirstItemInInventory(oNPC);
while (GetIsObjectValid(oItem))
{
if (GetDroppableFlag(oItem) == TRUE)
{
//items already set as droppable should stay that way
SetLocalInt (oItem, "droppable", 1);
GetNextItemInInventory(oNPC);
}
if (GetLocalInt(oItem, "droppable") == FALSE)
{
//20% chance to drop item inventory not already set as droppable
int bDroppable=d100()>80;
SetDroppableFlag(oItem, bDroppable);
oItem = GetNextItemInInventory(oNPC);
}
{
if (GetDroppableFlag(oItem) == FALSE)
{
SetLocalInt(oItem, "notdroppable", 1);
}
if (GetLocalInt(oItem, "notdroppable") == TRUE)
{
// 20% chance to drop item from inventory not already set as droppable
if (d100() <= 20)
{
SetDroppableFlag(oItem, TRUE);
}
}
oItem = GetNextItemInInventory(oNPC);
}
}
void main()
{
object oNPC = OBJECT_SELF;
DelayCommand(0.0f,MakeItemsDroppable(oNPC));
}

View File

@@ -0,0 +1,24 @@
void main()
{
object oNPC = OBJECT_SELF;
object oItem = GetFirstItemInInventory(oNPC);
while (GetIsObjectValid(oItem))
oItem = GetNextItemInInventory(oNPC);
{
if (GetDroppableFlag(oItem) == FALSE)
{
SetLocalInt (oItem, "notdroppable", 1);
}
if (GetLocalInt(oItem, "notdroppable") == 1)
{
//20% chance to drop item inventory not already set as droppable
//object oDrop = GetLocalObject(oItem, "notdroppable");
int bDroppable = d100()>50;
SetDroppableFlag(oItem, bDroppable);
}
}
}

View File

@@ -13,6 +13,7 @@
void main()
{
object oSelf = OBJECT_SELF;
DelayCommand(30.5, ExecuteScript("_golemstats", OBJECT_SELF));
// modifed by primogenitor
// aribeth uses her blackguard spellbook
if(GetTag(oSelf) == "H2_Aribeth")
@@ -61,5 +62,5 @@ void main()
}
CheckNewSpellbooks(oSelf);
}
DelayCommand(30.5, ExecuteScript("_golemstats", OBJECT_SELF));
}