Hello modders!

TL;DR

If you want to change traits of a character, you absolutely need to load the DualDialogue template ( You can find it under ...Mods/Story/Keywords) and from there you can safely launch :

ACTION SetCharacterFlag("GLO_IncreaseTrait",1)
***Replace the word Trait with the trait name***


I've been banging my head on this one for a few hours now... I can't seem to figure out a solution to my problem.

I'm trying to add a Trait to my character using the story
CharacterAddTrait() function.

I'm calling it from the dialog by sending a SetCharacterFlag() function ( Which is how the MAIN campaign does it ).

I'm catching it from a simple storyevent and I receive it correctly. If I try to launch CharacterAddTrait() function, I get this error :
"Trying to show empty speakertext, is this intended? I prohibit this. Talk to Thomas."
followed by infinite loop of Trying to access protected memory which of course, causes my game to freeze.

Then I thought, I'll make sure NO DIALOGS are running before adding a trait, which seems to be the error message I'm getting. Below is my code.


Code
IF
	DialogCharacterEventSet(_Event,_Character,_DialogInstance)
AND
	DB_TraitsModification(_Event,_Trait)
THEN
	DebugBreak("EventCaught");
	DB_TraitToAdd(_Trait,_Character,_DialogInstance);
	DialogClearCharacterEvent(_Event,_Character,_DialogInstance);

IF
	DialogEnded(_,_DialogInstance)
AND
	DB_TraitToAdd(_Trait,_Character,_DialogInstance)
AND
	DialogIsRunning(_IsRunning)
AND
	_IsRunning == 0
THEN
	DebugBreak("AddingTrait");
	CharacterAddTrait(_Character,_Trait,1);
	NOT DB_TraitToAdd(_Trait,_Character,_DialogInstance);



This successfully removes the Thomas error but does not successfully break the infinite loop, which is still happening.

I took this further, I even added a 2 second timer afterwards, and the infinite loop is still there. Everything seems to point to the function CharacterAddTrait() having issues with my standalone mod...

Any insight on this could really help!

Last edited by TheMasterRat; 11/01/15 10:10 PM.