nwn2fixes / player

Fixes for the casual NwN2 player
27 stars 11 forks source link

SOZ : Bugged human mob special encounter #18

Closed Question2 closed 5 years ago

Question2 commented 5 years ago

This encounter seems bugged. I just managed to get it to appear, and the mob immediately runs away from me with the "player level too high" icon above their head which isnt supposed to happen for special encounters. I was level 15 at the time.

nwn2_ss_091518_160435

Edit : This is probably why i cannot find certain encounters even with very high survival skills and combing the wilderness for hours.

The problem might be that certain special encounters are flagged as "bhostile" in the om_eng_g_special2.2da and om_enf_f_special.2da files. I will see if setting that to 0 fixes them.

Question2 commented 5 years ago

Okay after changing them to hostile, i managed to get the encounter to spawn again. This time, there was no fear icon above their head, but they just walked for a while and dissapeared before I could catch up to them.

kevL commented 5 years ago

the 'bHostile' var in the .2da is not used (at least not for SpecialEncounters)

more bad SoZ code ```c++ // JSH-OEI 7/11/08 - Commented out line in SpawnSpecialEncounter which was breaking stuff. object SpawnSpecialEncounter(string sTable, location lLocation) { int nEncounterRow = Random(GetNumValidRows(sTable))+1; string sResRef = Get2DAString(sTable, "ENC_RESREF", nEncounterRow); int nValidTerrain = StringToInt(Get2DAString(sTable, "nTerrain", nEncounterRow)); int bSEFired = GetGlobalInt(sResRef + "_FIRED"); if( GetTerrainAtLocation(lLocation) == nValidTerrain && !bSEFired) { SetGlobalInt(sResRef + "_FIRED", TRUE); PrettyDebug("Spawning sEncounterRR:"+sResRef); object oSE = CreateObject(OBJECT_TYPE_CREATURE, sResRef, lLocation); //if(Get2DAInt(sTable, "bHostile", nEncounterRow)) SetEncounterLocalVariables(oSE, sTable, nEncounterRow); SetSEStartLocation(lLocation, oSE); SetLocalInt(OBJECT_SELF, VAR_SE_FLAG, TRUE); return oSE; } else return OBJECT_INVALID; } ```


i reworked the OL Ai (for personal use) from top to bottom because it's so mungy. But doing that for public integration is an enormous undertaking ... so I'll leave the issue open in case someone wants to look into it -- i won't because I still get flashbacks from the last time ...

Question2 commented 5 years ago

Whats causing some special encounters to run away then?

I just started a new game and got the fiends of the samarlogh encounter to spawn, but immediately after it appeared, they walked away and eventually dissapeared.

It seems that some special encounters just walk away and dissapear immediately after spawning, which means its nearly impossible to get them.

Is it possible to disable whatever is causing them to walk away and dissapear?

Which file even controls the special encounters behaviour?

Question2 commented 5 years ago

Even after setting them to non hostile in the 2da file, they are still acting as normal hostile encounters rather than static special encounters :

image

You can see that it has the ? mark symbol because I succeeded at a hide check. It shouldnt be making that hide check at all.

I had partial success setting their lifetime to a very large number (more than 1 million), this prevents them from walking away and dissapearing, but im guessing that they will still eventually dissapear when the lifetime hits 0.

Question2 commented 5 years ago

I found this in the ginc_overland_ai.NSS file in the campaigns subfolder :

case BEHAVIOR_STATE_DESPAWNING:
        **if( GetLocalInt(OBJECT_SELF, VAR_SE_FLAG) &&      //if I have a Local Location I am a Special Encounter**
            GetDistanceBetweenLocations( GetLocation(OBJECT_SELF), GetSEStartLocation() ) < 1.0f)

            TransitionDespawningToNone();
        else
            RunDespawningAI();
    break;

So im guessing that they forgot to give certain special encounters a "local location" which would correctly flag them as a special encounter...but i have no idea where that is defined...

kevL commented 5 years ago

try looking at the blueprint UTI of the overland creature, found under "ENC_RESREF" in the encounter-2da

open that creature you want to examine in the toolset. Look at its scriptset. Especially its OnHeartbeat script. Open that script ... then trace whatever function is there that leads back to 'ginc_overland_ai' and that's the AI it's using on the OL map.

but don't expect things to make sense based on how they're labelled; it's a complete hodgepodge and yes bug-ridden, imo.

Basically there are 3 types of "encounters" on the OL - neutrals (guards/caravans), hostiles (wander around attacking guards/caravans/PC party), and specials (these should just stand there and wait for PC to talk to them). BUT if i remember correctly, the specials try to use a minimal subset of the hostile AI functions - which makes them difficult to debug because you'll find yourself looking through a bunch of code that's for hostiles (instead of just the minimal subset that's for Specials ...)

if you need to take another step back the actual spawn is invoked by the overland area's OnHeartbeat script 'nx2_ol_hb' - or by a script that that script calls, which is defined by the area's "sHeartbeatScript" variable ...

hm. You might be onto something regarding the "nLifespan" variable ... its presence/value might be what's used [in part] to determine if an encounter-creature is Hostile or Special (iirc)

kevL commented 5 years ago

the two #include files 'ginc_overland' and 'ginc_overland_ai' work in conjunction w/ each other. Spawning and setting vars is handled in 'ginc_overland' while the AI itself runs through 'ginc_overland_ai'.

kevL commented 5 years ago

a 4th type of encounter is Plot - these can be pseudo-Hostile or pseudo-Special ...

and, Guards are a subset of Neutral ... i forget how they're differentiated - either by a variable or by using different HB scripts

Question2 commented 5 years ago

Hmm, wouldnt it be easier to just set all the special ecounters to use the special encounter AI instead of the hostile AI to stop them from moving and dissapearing?

How do i open f00_ac_slave_revolt in the toolset?

kevL commented 5 years ago

open the toolset turn View|Options|Autosave FALSE

open module F_X2 that's under \modules

select Blueprints|Creatures

type "f00_ac_slave_revolt" into the filter

click the Resref radiobutton.