Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories

New Premium Module: Tyrants of the Moonsea! Read More
Attention, new and old users! Please read the new rules of conduct for the forums, and we hope you enjoy your stay!

Transitions and Area Cleanup

Having a heck of a time with this for some reason, cant seem to find a common cause.
When PCs transition sometimes they lose henchmen, familiars, companions etc. Also enemies flood through the transition when running away killing them before the area load screen is finished (and sometimes they dont).
I think its an on exit, area cleanup issue. Any insights?
// ffbj_area_clean // created by: ffbj Administrative Team & Moderator of The Builder's Project // put in onarea exit ffbj void TrashObject(object oObject) { if (GetObjectType(oObject) == OBJECT_TYPE_DOOR) ActionCloseDoor(oObject); if (GetObjectType(oObject) == OBJECT_TYPE_PLACEABLE) { if (GetTag(oObject)!= "PlayerCorpse") { object oItem = GetFirstItemInInventory(oObject); while (GetIsObjectValid(oItem)) { TrashObject(oItem); oItem = GetNextItemInInventory(oObject); } } } if (GetTag(oObject)!= "PlayerCorpse") DestroyObject(oObject); } void main() { if(!GetIsPC(GetExitingObject()) ) { return; } object oPC = GetExitingObject(); if (!GetIsPC(oPC)) return; oPC = GetFirstPC(); while (oPC != OBJECT_INVALID) { if (OBJECT_SELF == GetArea(oPC)) return; else oPC = GetNextPC(); } object oObject = GetFirstObjectInArea(OBJECT_SELF); while (oObject != OBJECT_INVALID) { if (GetIsEncounterCreature(oObject)) if (GetPlotFlag(oObject) == FALSE) DestroyObject(oObject); if (GetObjectType(oObject)== OBJECT_TYPE_CREATURE) if (GetPlotFlag(oObject) == FALSE) DestroyObject(oObject); if (GetObjectType(oObject) == OBJECT_TYPE_DOOR) ActionCloseDoor(oObject); oObject = GetNextObjectInArea(OBJECT_SELF); } object oItem = GetFirstObjectInArea(); while (GetIsObjectValid(oItem)) { int iObjectType = GetObjectType(oItem); switch (iObjectType) { case OBJECT_TYPE_PLACEABLE: if (GetTag(oItem) != "BodyBag") { break; } case OBJECT_TYPE_ITEM: TrashObject(oItem); } oItem = GetNextObjectInArea(); } }

Comments

  • ProlericProleric Member Posts: 558
    The biggest problem is that the script says delete any creature that isn't plot, which presumably includes associates.

    There seems to be an implicit assumption that associates have already moved to the new area when OnExit fires. If that's not working, use GetMaster iteratively to exclude associates from deletion. You'll nned to store the PC who is leaving - at present, the code uses oPC both for the exiting PC and for a loop to check that no other PCs remain.

    However, it might simply be that the party has been overwhelmed by monsters before they can leave and/or following pursuit.

    You can block pursuit in nw_g0_transition by returning if the creature is not a PC... but perhaps the mob is just too overwhelming and needs to be scaled back?

    Probably lots of other issues - the first statement of the main section is redundant, for example.

  • vonstormvonstorm Member Posts: 21
    Thanks, Ill trawl through it. However if I do is not a PC in transition doesnt that cut off henchmen etc?

  • ProlericProleric Member Posts: 558
    As it happens, associates are treated differently from PCs and NPCs. Both of the latter actually have to go through the transition, which may be blocked by the transition script. Associates on the other hand simply jump to their master/mistress when the PC transitions to a new area.

  • vonstormvonstorm Member Posts: 21
    Thanks. Cleaned up the script quite a lot and fixed stability of henchmen etc coming through. Turned Hostile NPCs coming through back on to stop PCs exploiting the transition to get out of trouble.
    Still a lot to learn about how NWN handles stuff.
    Appreciate all the insights.

Sign In or Register to comment.