My intent for this is when the party kills the boss: check the party, see if the members of the party are in the current area, and if they are check their journals individually. If a journal is at the correct point, then update it.
The problem I am having is it doesn't always seem to fire correctly for everyone? I am not sure if it is stopping on an invalid object or something?
I would love some help fixing it.
[nwscript]
#include "pqj_inc"
#include "x2_inc_compon"
#include "x0_i0_spawncond"
#include "spawn_functions"
#include "spawn_main"
void main()
{
string sDeathScript = GetLocalString(OBJECT_SELF, "DeathScript");
if (sDeathScript != "")
ExecuteScript(sDeathScript, OBJECT_SELF);
int nclass = GetLevelByclass(class_TYPE_COMMONER);
int nAlign = GetAlignmentGoodEvil(OBJECT_SELF);
object oKiller = GetLastKiller();
// If we're a good/neutral commoner,
// adjust the killer's alignment evil
if(nclass > 0 && (nAlign == ALIGNMENT_GOOD || nAlign == ALIGNMENT_NEUTRAL))
{
AdjustAlignment(oKiller, ALIGNMENT_EVIL, 5);
}
// 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);
craft_drop_items(oKiller);
//Custom Death Section
//Section, Should check for party members in the area, check their journals and update where nesseccary.
object oPC = GetLastKiller();
//If Last Killer was an animal companion or summon, set the master as oPC
while (GetIsObjectValid(GetMaster(oPC)))
{
oPC=GetMaster(oPC);
}
object oPartyMember = GetFirstFactionMember(oPC, TRUE);
object oArea = GetArea(oPC);
while(GetIsObjectValid(oPartyMember) == TRUE)
{
int iNoGiveQuest = 0;
int iJournal = GetJournalEntry("stonewater_keep_jrnl",oPartyMember);
//If PC is "not a partymember", or not in the "proper area", or does not have their journal at the correct spot, Then don't update their quest.
if (!GetIsPC(oPartyMember))
{
iNoGiveQuest = 1;
}
if (GetArea(oPartyMember) != oArea)
{
iNoGiveQuest = 1;
}
if(iJournal != 14)
{
iNoGiveQuest = 1;
}
if (iNoGiveQuest == 0)
{
AddPersistentJournalQuestEntry("stonewater_keep_jrnl", 15, oPartyMember, FALSE, FALSE, FALSE);
oPartyMember = GetNextFactionMember(oPC, TRUE);
}
if (iNoGiveQuest == 1)
{
oPartyMember = GetNextFactionMember(oPC, TRUE);
}
}
//End Custom Death Section
NESS_ProcessDeadCreature (OBJECT_SELF);
// safety mechanism in case creature kills itself
if(GetLastKiller() == OBJECT_SELF) return;
ExecuteScript("pwfxp",OBJECT_SELF);
// resurrect & self kill to bypass bioware xp message
ApplyEffectToObject(DURATION_TYPE_INSTANT, EffectResurrection(), OBJECT_SELF);
ApplyEffectToObject(DURATION_TYPE_INSTANT, EffectDamage(10000, DAMAGE_TYPE_MAGICAL, DAMAGE_POWER_PLUS_TWENTY), OBJECT_SELF);
}
[/nwscript]
Modifié par Quilistan, 08 octobre 2010 - 03:41 .





Retour en haut






