Is NBDE Location Function Broken In EE?
Whitegrave
Member Posts: 37
I can't seem to get NBDE campaign locations to work with EE. I've tried a dozen different workarounds and approaches from delays to shorter variable names etc but I have not once gotten a valid location from NBDE
As a simplified test for this I wrote and tested the below code
The first VFX fires as expected. The delayed VFX at the location retrieved from NBDE does not fire. Additional testing such as debug text GetName(GetAreaFromLocation(TestGetLoc())) also returns "" leading me to believe NBDE is not returning valid locations for me.
The String and Int versions of NBDE seem to be working as usual, but zero success with Locations.
Any ideas?
UPDATE: Changing the NBDE location functions to vanilla NWN counterparts works perfectly, further leading me to believe NBDE Location functions are broken for EE.
As a simplified test for this I wrote and tested the below code
#include "nbde_inc"
location TestGetLoc()
{
return NBDE_GetCampaignLocation("DB_TEST", "TEST_LOC");
}
void main()
{
// Get PC Location
object oTest = GetFirstPC();
location lTest = GetLocation(oTest);
// Store PC Location
NBDE_SetCampaignLocation("DB_TEST", "TEST_LOC", lTest);
// Flush DB, delayed just to eliminate possible issues
DelayCommand(1.0, NBDE_FlushCampaignDatabase("DB_TEST"));
// Apply an immediate VFX at the location from GetLocation(oTest)
ApplyEffectAtLocation(DURATION_TYPE_INSTANT, EffectVisualEffect(VFX_FNF_IMPLOSION), lTest);
// A delayed effect at the location retreived from NBDE (doesn't fire, loc returns invalid)
DelayCommand(5.0, ApplyEffectAtLocation(DURATION_TYPE_INSTANT, EffectVisualEffect(VFX_FNF_IMPLOSION), TestGetLoc()));
}
The first VFX fires as expected. The delayed VFX at the location retrieved from NBDE does not fire. Additional testing such as debug text GetName(GetAreaFromLocation(TestGetLoc())) also returns "" leading me to believe NBDE is not returning valid locations for me.
The String and Int versions of NBDE seem to be working as usual, but zero success with Locations.
Any ideas?
UPDATE: Changing the NBDE location functions to vanilla NWN counterparts works perfectly, further leading me to believe NBDE Location functions are broken for EE.
Post edited by Whitegrave on
0
Comments
// Write Player Location void StorePlayerLocation(object oPC, location lLoc) { string sAreaTag=GetTag(GetAreaFromLocation(lLoc)); float fFacing=GetFacingFromLocation(lLoc); vector vPos=GetPositionFromLocation(lLoc); NBDE_SetCampaignString("FSDB_PLAYER","FS_PLAYER_LOC"+"AREA_TAG",sAreaTag,oPC); NBDE_SetCampaignFloat("FSDB_PLAYER","FS_PLAYER_LOC"+"FACING",fFacing,oPC); NBDE_SetCampaignVector("FSDB_PLAYER","FS_PLAYER_LOC"+"VECTOR",vPos,oPC); DelayCommand(2.0, NBDE_FlushCampaignDatabase("FSDB_PLAYER")); } // Read Player Location void RestorePlayerLocation(object oPC) { string sAreaTag = NBDE_GetCampaignString("FSDB_PLAYER","FS_PLAYER_LOC"+"AREA_TAG",oPC); object oArea = GetObjectByTag(sAreaTag); string sLastLoc = GetName(oArea); float fFacing = NBDE_GetCampaignFloat("FSDB_PLAYER","FS_PLAYER_LOC"+"FACING",oPC); vector vPos = NBDE_GetCampaignVector("FSDB_PLAYER","FS_PLAYER_LOC"+"VECTOR",oPC); location lReturn = Location(oArea,vPos,fFacing); SetLocalLocation(oPC, "LastKnownLoc", lReturn); }