I’ve come across a really strange bug that I can’t for the life of me figure out how and why it appears.
So, I have this area, a prefab, where I’ve placed a creature. The creature has a conversation. In the first node I’ve marked it as “Once per game”. When I click the character in game, no conversation fires. If I change the first node to “Always” everything is fine, but then again I only want the conversation to fire at one time in the game. If I move the character to another area everything works as it should, so there’s no weird thing with scripts on the character as far as I can see.
I have checked the area for OnClientEnter scripts or such but there are no scripts at all firing on the properties on the area.
The only thing I can think of that may have something to do with it is the On Module Load script where I use a modified version Colorsfade’s script since I use his companion system…but I’ve searched there and I can’t see anything…and if there was something it should have been the same on every area, right? As for right now it’s only in this area that this weird thing happens.
If anyone has any clue as to what might be causing this weird thing, please tell me.
Are there any speak triggers or any other triggers in the area that might be referencing the creature and/or it’s convo?
You can be sure something runs once only by setting and checking a local integer via script if the toolset option doesn’t seem to work right.
as a policy i won’t use the OncePerModule option. too problematic, if for example something goes wrong the node won’t show again (and i don’t think there’s any way to clear it).
I tried removing all triggers in the area (I’ve only placed three of them so far) but still the creature behaves the same way.
Sure, I could use a local integer and solve it that way, as you say kamal, but I would rather get to the bottom of this, cause I think it’s so strange. Right now I’m thinking it must be connected to something in my override folder, one of the haks I use perhaps or the OnModuleLoad script…
It doesn’t seem to be the hak files. The only type of files that are in the haks are mdb, dds and tga.
However, in the hak_city that I use there are also two 2da files, but those are doortypes.2da and placeables.2da.
Alright, I guess I might as well post my slightly modified version of Colorsfade’s OnModuleLoad script, which is a modified version of the k_mod_load script:
//Author: Christopher Holmes
//cb.holmes@gmail.com
//Replacement for the k_mod_load script. Removes the Spirit Eater stuff.
//*******************************************************************/
// k_mod_load
/*
Module Load event
based on x2_mod_def_load
*/
// 8/16/05 ChazM (OEI) - created, added SpawnCompanions()
// 10/20/05 ChazM (OEI) - modified item event related stuff
// 11/18/05 ChazM (OEI) - Add Companions To Roster instead of Spawning them
// 12/1/05 ChazM (OEI) - Now useing ginc_companions
// 1/13/06 ChazM (OEI) - Modified roster companion additions to only happen once
// 2/22/06 DBR - Setup Default Destinations for Overland map.
// 3/02/06 DBR - Put in the Gather Party variable. I'm Sorry.
// 8/17/06 BDF - Since we don't use personal reputation, we have to make the spell
// targeting system aware of this somehow (x0_i0_spells: spellsIsTarget());
// USES_PERSONAL_REPUTATION = FALSE
// 9/18/06 ChazM - added switch MODULE_SWITCH_ENABLE_MULTI_HENCH_AOE_DAMAGE + other comments; fixed global flags
// 10/08/06 BMA-OEI - Added CAMPAIGN_SWITCH_UNPLOT_ON_ROSTER_SPAWN flag for Patch 1
// 3/8/07 ChazM - set N2_SCRIPT_SPAWN_CREATURE (to kb_default_sp)
// ChazM 5/3/07 - Companion Initialization
// MDiekmann 6/6/07 - Added CAMPAIGN_SWITCH_ONLY_SHOW_TIME which sets in game clock popup to not show the specific date
// ChazM 6/11/07 - If campaign switch enabled, smith hammer can be used to rename any item.
// ChazM 6/11/07 - If campaign switch enabled, showing world map will attempt single player autosave.
// ChazM 6/14/07 - Added CAMPAIGN_VAR_WM_MIN_THRESHOLD
// ChazM 6/18/07 - Defualt Max Henchmen to 5
// ChazM 6/19/07 - Set max henchmen for each module
// MDiekmann 7/25/07 - Checks and set OOM's custom title token.
// ChazM 8/9/07 - NX1 uses CAMPAIGN_SWITCH_CRAFTING_USE_TOTAL_LEVEL for the caster level rules (promotes use of crafting)
// ChazM 8/13/07 - NX1 uses CAMPAIGN_SWITCH_REST_SYS_USE_FORCE_REST for the rest rules (removes unwanted rest progress bar)
#include "x2_inc_switches"
#include "ginc_restsys"
#include "ginc_transition"
//#include "d_ginc_party"
#include "andg_party"
const string VAR_MODULE_SETUP_FLAG = "MODULE_SETUP_FLAG";
const string VAR_CAMPAIGN_SETUP_FLAG = "CAMPAIGN_SETUP_FLAG";
void main()
{
SetGlobalInt("bNX2_TRANSITIONS", FALSE);
//SetLocalString(GetModule(),"X2_S_UD_SPELLSCRIPT", "my_spellhook");
if (GetGameDifficulty() == GAME_DIFFICULTY_CORE_RULES || GetGameDifficulty() == GAME_DIFFICULTY_DIFFICULT)
{
// * Setting the switch below will enable a seperate Use Magic Device Skillcheck for
// * rogues when playing on Hardcore+ difficulty. This only applies to scrolls
SetModuleSwitch (MODULE_SWITCH_ENABLE_UMD_SCROLLS, TRUE);
}
// * AI: Activating the switch below will make the creaures using the WalkWaypoint function
// * able to walk across areas
SetModuleSwitch (MODULE_SWITCH_ENABLE_CROSSAREA_WALKWAYPOINTS, TRUE);
// * Spells: Activating the switch below will make the Glyph of Warding spell behave differently:
// * The visual glyph will disappear after 6 seconds, making them impossible to spot
// SetModuleSwitch (MODULE_SWITCH_ENABLE_INVISIBLE_GLYPH_OF_WARDING, TRUE);
// * Craft Feats: Want 50 charges on a newly created wand? We found this unbalancing,
// * but since it is described this way in the book, here is the switch to get it back...
// SetModuleSwitch (MODULE_SWITCH_ENABLE_CRAFT_WAND_50_CHARGES, TRUE);
// * Craft Feats: Use this to disable Item Creation Feats if you do not want
// * them in your module
// SetModuleSwitch (MODULE_SWITCH_DISABLE_ITEM_CREATION_FEATS, TRUE);
// * Palemaster: Deathless master touch in PnP only affects creatures up to a certain size.
// * We do not support this check for balancing reasons, but you can still activate it...
// SetModuleSwitch (MODULE_SWITCH_SPELL_CORERULES_DMASTERTOUCH, TRUE);
// * Epic Spellcasting: Some Epic spells feed on the liveforce of the caster. However this
// * did not fit into NWNs spell system and was confusing, so we took it out...
// SetModuleSwitch (MODULE_SWITCH_EPIC_SPELLS_HURT_CASTER, TRUE);
// * Epic Spellcasting: Some Epic spells feed on the liveforce of the caster. However this
// * did not fit into NWNs spell system and was confusing, so we took it out...
// SetModuleSwitch (MODULE_SWITCH_RESTRICT_USE_POISON_TO_FEAT, TRUE);
// * Spellcasting: Some people don't like caster's abusing combat expertise to raise their AC
// * Uncommenting this line will drop expertise mode whenever a spell is cast by a player
// SetModuleSwitch (MODULE_VAR_AI_STOP_EXPERTISE_ABUSE, TRUE);
// * Item Event Scripts: The game's default event scripts allow routing of all item related events
// * into a single file, based on the tag of that item. If an item's tag is "test", it will fire a
// * script called "test" when an item based event (equip, unequip, acquire, unacquire, activate,...)
// * is triggered. Check "x2_it_example.nss" for an example.
// * This feature is disabled by default.
SetModuleSwitch (MODULE_SWITCH_ENABLE_TAGBASED_SCRIPTS, TRUE);
// Enabling this causes tagbased scripting to use 7 different scripts for item events instead of
// having them packaged all in one.
// The scripts are postfixed with "_aq", "_ua", "_eq", "_ue", "_ac", "_ci", and "hc"
SetModuleSwitch (MODULE_SWITCH_ENABLE_SEPERATE_ITEM_SCRIPTS, TRUE);
if (GetModuleSwitchValue (MODULE_SWITCH_ENABLE_TAGBASED_SCRIPTS) == TRUE)
{
// * If Tagbased scripts are enabled, and you are running a Local Vault Server
// * you should use the line below to add a layer of security to your server, preventing
// * people to execute script you don't want them to. If you use the feature below,
// * all called item scrips will be the prefix + the Tag of the item you want to execute, up to a
// * maximum of 16 chars, instead of the pure tag of the object.
// * i.e. without the line below a user activating an item with the tag "test",
// * will result in the execution of a script called "test". If you uncomment the line below
// * the script called will be "1_test.nss"
SetUserDefinedItemEventPrefix("i_");
}
// * This initializes the wandering monster system.
// * If you want to use it, make sure you use an appropriate script such as "gmod_def_rest" as your module's OnRest Script
// SetModuleSwitch (MODULE_SWITCH_USE_XP2_RESTSYSTEM, TRUE);
SetModuleSwitch (MODULE_SWITCH_USE_NX1_SINGLE_PARTY_RESTSYSTEM, TRUE);
if ((GetModuleSwitchValue(MODULE_SWITCH_USE_XP2_RESTSYSTEM) == TRUE) ||
(GetModuleSwitchValue(MODULE_SWITCH_USE_NX1_SINGLE_PARTY_RESTSYSTEM) == TRUE))
{
// * This allows you to specify a different 2da for the wandering monster system.
//WMSet2DAFileName(WM_DEFAULT_2DA_FILE); // "restsys_wm_table"
WMBuild2DACache();
}
// Only setup once for entire campaign
if ( GetGlobalInt(VAR_CAMPAIGN_SETUP_FLAG) == FALSE )
{
SetGlobalInt(VAR_CAMPAIGN_SETUP_FLAG, TRUE );
// Set our party size. It's 4 (PC + 3 companions)
SetRosterNPCPartyLimit(3);
// Setup all Companions
InitializeCompanions();
// Add all campaign companions to roster for easy access
//InitializeNX1Companions();
//SetupDefaultDestinations();
//This variable makes all transitions a "gather your party" transition.
SetGlobalInt( VAR_GLOBAL_GATHER_PARTY, 1 );
// Defaults weapons visible during conversations - checked on Creature SpawnIn
// May be unnecessary in future build.
//SetGlobalInt( CAMPAIGN_CUTSCENE_WEAPONS_VISIBLE, TRUE );
// Force kills dominated group members if no valid members remain - checked on HeartBeat ( nw_g0_dominate )
SetGlobalInt( CAMPAIGN_SWITCH_FORCE_KILL_DOMINATED_GROUP, TRUE );
// Removes effect and prevents transition if object is dominated - checked in ginc_transition / nw_g0_transition
SetGlobalInt( CAMPAIGN_SWITCH_REMOVE_DOMINATED_ON_TRANSITION, TRUE );
// A flag that reflects the engine setting for whether or not we use personal reputation; this is a consideration in spell targeting
SetGlobalInt( CAMPAIGN_SWITCH_USE_PERSONAL_REPUTATION, FALSE );
// standard script for spawn modifications for this campaign
// This is a DARKSKY overridden script. We use it to set perceptions
// for USER DEFINED event usage.
SetGlobalString("N2_SCRIPT_SPAWN_CREATURE", "d_default_spawn" );
// Makes sure that clock only contains hour information, no date and time for this campaign
SetGlobalInt( CAMPAIGN_SWITCH_ONLY_SHOW_TIME, TRUE );
// can the smith hammer be used to rename any item?
SetGlobalInt( CAMPAIGN_SWITCH_SMITH_HAMMER_RENAME_ITEM, TRUE );
// Enables single player auto save on world map transition
SetGlobalInt( CAMPAIGN_SWITCH_WORLD_MAP_AUTO_SAVE, TRUE );
// Set minimum value for wandering monsters check. Default is 0 (all rolls allowed)
SetGlobalInt( CAMPAIGN_VAR_WM_MIN_THRESHOLD, 15);
// Set use of total level for determining caster level for magical crafting.
SetGlobalInt( CAMPAIGN_SWITCH_CRAFTING_USE_TOTAL_LEVEL, TRUE);
// This will cause the NX1 single party rest system to use ForceRest instead of ActionRest (thus no resting bar)
SetGlobalInt( CAMPAIGN_SWITCH_REST_SYS_USE_FORCE_REST, TRUE );
}
// stuff to do just once per module
if ( GetLocalInt(OBJECT_SELF, VAR_MODULE_SETUP_FLAG) == FALSE )
{
SetLocalInt(OBJECT_SELF, VAR_MODULE_SETUP_FLAG, TRUE);
SetMaxHenchmen(5); // each module has it's own max
// Set our DEBUG LEVEL. Anything higher than zero will print stuff
// to the chat window.
SetLocalInt(OBJECT_SELF, "CF_DEBUG_LEVEL", 1);
}
// 10/08/06 BMA-OEI: Out of CAMPAIGN_SETUP_FLAG block for Patch 1
// Set companion's Plot Flag FALSE on UserDefined EVENT_ROSTER_SPAWN_IN (2051)
SetGlobalInt( CAMPAIGN_SWITCH_UNPLOT_ON_ROSTER_SPAWN, TRUE );
// Set custom title token for OOM
string sTitle = GetGlobalString("OOM_PlayerTitle");
if(sTitle != "")
{
SetCustomToken(130, sTitle);
}
//SendMessageToPC(GetFirstPC(FALSE), "Load...");
//SendMessageToPC(GetFirstPC(FALSE), "Variablen " + GetGlobalString("X2_S_UD_SPELLSCRIPT") );
}
Just for testing purposes, make a brand new creature (not the same as the original) and place it next to the original. Make sure it has a unique tag. Apply the same convo file to this new creature. Does the new creature do the same thing when you try to talk to it?
Yes, I’ve already done that, and that behaved the exact same way.
It gets more and more bizarre. I tried with taking another conversation and putting it on the character. This conversation had “Always” on the first node, so I changed that to “Once per game”, and now it worked! So, I thought, ok, maybe something strange happened when I created the conversation. Thus I created a new conversation with just three nodes and marked the first node as “Once per game”. Again, it didn’t work. Is there something wrong when I’m creating new conversations in the toolset for some strange reason, or what?
I’m suspecting some weird crap going on in my toolset. I tried with creating a new conversation called “idon” and it actually worked. I then took and copied the text from the old conversation onto this, and it still worked. Then I renamed the “idon” to “wylla_conv” which is the name of the original conversation. Now it no longer worked. Ok, maybe it had to do with the name then? I tried changing it back to “idon” and I get an error message in the form of a red X if you know what I mean. I restarted the toolset, loaded the module directory, and renamed it to “idon” again, this time I didn’t get an error message, but in game the conversation doesn’t work.
I have Win 7 on my main computer. I also have a Win 10 laptop with NWN2 and the toolset installed there. I’ll try and make a conversation there and see what happens.
you probably have a dublicate of your convo in teh campaign folder or the override folder.
This module is not a campaign, so that’s not possible, and I don’t have any conversations at all in my override folder (I double checked to be absolutely sure)…
However, at one time, when I began making this module I tried to convert it to a campaign to be able to use the world map system, but the world map was so extremely buggy (and it was a known bug I read here on the boards) so I abandonded that. I erased the campaign folder and all that. This conversation I made only a few days ago, way later after abandoning it being a campaign. But maybe it still has something to do with that…some leftover file I’ve forgot to erase maybe? Checking: I see that there is a gtr_world_map_II.nss and
ncs file. Could that have something to do with it? Maybe I could try with erasing that…
Suggestion. Before deleting them, archive them in the same folder and keep the archive. That way if deleting them screws stuff up you have a backup to restore.
TR
I’ll do that.
The deleting of those files didn’t change anything.
I tried with starting a whole new module, loading the prefab, placing a creature with a conversation with “Once per game” and then it worked. So there must be something else in my original module that screws things up somehow.
Gaahh. I can’t take this anymore. I think I might go crazy.
Here’s what I did to solve this: I went with kamal’s suggestion using a local integer telling the conversation to only run once. So far so good. But after that conversation tree I made another underneath that is marked as “Always”, and that second conversation tree is a bark string. So, what I want is the first conversation tree to fire, and after that when you click on the character the next tree runs. What happens now is, and this is really mysterious, when I approach the character the bark string appears above the character before I’ve even clicked on it (there is no trigger there to cause this). If I then click on it, the first conversation tree fires, and next time I click the bark string appears again (so, appart from the first mysterious thing it works as it should).
I’ve gone through the all of the area contents to find some hidden triggers or items or whatnot that could be causing this but I can’t see anything. And as I tested before to just load the area into an empty module things work just fine so there must be some other script that fires that has to do with…something. I tried to change the OnModuleLoadScript to the default x2_mod_def_load but that didn’t change anything. The only other thing I have in my module properties that are different from the default is the OnPlayerDeathScript where I use k_mod_player_death and in the Variables I use X2_S_UD_SPELLSCRIPT with the script my_spellscript (which controls a situation where a particular spell is casted).
I tried with empty my override folder - still the same weirdness
I tried removing all my hak paks - still the same weirdness
I SOLVED IT!
I went through the list of my scripts for my module and there I found something suspicious. I found that I had copied the default scripts nw_c2_default1, nw_c2_default7, nw_c2_default9 and nw_c2_defaultd there. I think I might have copied them there to study the behaviour of an NPC at some point, but I really don’t remember. I don’t think I modified them at all, but I must have done that. When I erased all those scripts from my module scripts everything worked fine again.
How do I manage to f*** everything up time and again in the toolset…
Thank you to everyone that has tried to help me in this thread! I hope I wont make these kind of stupid mistakes again.
That is called the learning process aka SNAFU.
TR
Everyone makes stupid mistakes. The key is to not make the same ones too many times.