At the moment my brother is beta testing my module and one of the companions suddenly became immortal, or whatever is happening. It’s just a white 0 above the head when she gets hit. So I tried solving this by putting some additional code in the script at the OnClientEnter of the area, and tried with one of my brother’s savegames before getting into that area. I’m now using the Campaign mode by the way, so I should be able to replace scripts without problems. This is the script for the OnClientEnter of the area, and STILL the character called Loreen doesn’t take damage in a fight. Is there some other issue here? I mean, ok, if it is a bug, but I should be able to fix it with some code like this, shouldn’t I? It doesn’t make sense to me.
#include "ginc_object"
//ft1 = Swamp
//ft2 = Road with camp
//ft3 = Dein
//ft4 = Mountains
//ft5 = Hills
//ft6 = Outside Fallbrook
void PrepForDestruction(object oTarget)
{
SetPlotFlag(oTarget,FALSE);
SetImmortal(oTarget,FALSE);
AssignCommand(oTarget,SetIsDestroyable(TRUE,FALSE,FALSE));
}
void Death(string sTagString, int iInstance = 0)
{
PrettyDebug("Applying Death Effect To: " + sTagString + " Instance = " + IntToString(iInstance));
object oObject = GetObjectByTag(sTagString, iInstance);
AssignCommand(oObject, SetIsDestroyable( FALSE,FALSE,TRUE ));
SetImmortal( oObject, FALSE );
SetPlotFlag( oObject, FALSE );
effect eFX = EffectDeath();
PrettyDebug("Name of oObject = " + GetName(oObject));
ApplyEffectToObject( DURATION_TYPE_INSTANT,eFX,oObject );
}
void main()
{
object oPlayerPc = GetFirstPC();
object oTaik = GetObjectByTag("taik");
object oElvera = GetObjectByTag("elvera");
object oCelestine = GetNearestObjectByTag("celestine");
object oLoreen = GetNearestObjectByTag("loreen");
//int nJe = GetLocalInt(oPlayerPc,"NW_JOURNAL_ENTRYq_church");
DelayCommand(0.5,PrepForDestruction(oCelestine));
DelayCommand(0.5,PrepForDestruction(oLoreen));
if(!GetGlobalInt("swampenter"))
{
SetGlobalInt("swampenter",1);
}
if(!GetLocalInt(OBJECT_SELF,"Spawnscared") && GetFactionEqual(oPlayerPc,oElvera))
{
SetLocalInt(OBJECT_SELF,"Spawnscared",1);
object oScared = SpawnCreatureAtWP("scared","scared_wp");
}
int nJe2 = GetLocalInt(oPlayerPc,"NW_JOURNAL_ENTRYq_summon");
if(!GetLocalInt(OBJECT_SELF,"Fasttravel") && GetGlobalInt("fasttravelset") && GetFactionEqual(oPlayerPc,oElvera))
{
object oFT6 = SpawnPlaceableAtWP("ft6", "ft6_wp");
SetLocalInt(OBJECT_SELF,"Fasttravel",1);
}
if(nJe2 > 30)
{
object oHoodGuy = SpawnCreatureAtWP("hoodedman", "hoodwp");
object oNote = SpawnObjectAtWP(OBJECT_TYPE_ITEM,"hoodnote","hoodnwp");
Death("hoodedman");
}
else return;
}
Sometimes working with NWN2 is depressing.
Here are two pictures of how it looks ingame: