mikkel20088 Posted July 5, 2020 Share Posted July 5, 2020 So i'm trying to fix an issue with one of my mods where a character (through dialogue) is supposed to give you money. My issue is that in my attempt of getting the character to only give the money once i kinda broke the script. I'm doing it through the dialogue "Result" box, which might be the issue? It could be that i have to create a proper script for it? I just don't fully understand how i would integrate it. Currently my result box looks like this: short moneygiven set moneygiven to 0 if (moneygiven == 0) ;player->AddItem "gold_001" 400 set moneygiven to 1 endif At the moment whenever the conversation is run ingame the game crashes. This is all i could get out of modding guides/articles online. Got any ideas? Thank you very much in advance! Link to comment Share on other sites More sharing options...
cyran0 Posted July 5, 2020 Share Posted July 5, 2020 It crashes because the local variable 'moneygiven' is not found. Variables cannot be declared in dialogue results, so unless it is declared in a local script attached to the NPC (or is a global variable) the game engine is not aware of it. You have a couple of simple options. Place, or amend, a script attached to the NPC to declare short moneygiven. If this is a new NPC that the mod introduces, that is a safe solution. If this is an existing NPC, then adding the script creates the possibility of mod conflicts. In that case, it would be safer to create a new global short variable named moneygiven (with the prefix you are using to distinguish your work on this mod). However you proceed, do not declare the variable in dialogue results. Also, do not set the variable to 0 - that is its value by default. By setting it to 0 in the script, you are making it do-forever since this is run every time the topic is discussed by the player. Link to comment Share on other sites More sharing options...
abot Posted July 7, 2020 Share Posted July 7, 2020 also, the do-once conditions in simple dialog usually are implemented advancing the related quest journal e.g.dialog condition: MyQuestId < 20give moneyjournal MyQuestId 20 Link to comment Share on other sites More sharing options...
Oblivionaddicted Posted July 9, 2020 Share Posted July 9, 2020 Why did you put a ; before the additem line? The ; sets this line as a comment and the script ignores it. Link to comment Share on other sites More sharing options...
leonardo2 Posted July 10, 2020 Share Posted July 10, 2020 @mikkel20088: Yep, that's considered to be a sort of a remark (information). I suggest that you remove the ; from that line. Why did you put a ; before the additem line? The ; sets this line as a comment and the script ignores it. Link to comment Share on other sites More sharing options...
Recommended Posts