Jump to content

Modding help


mikkel20088

Recommended Posts

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

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

also, the do-once conditions in simple dialog usually are implemented advancing the related quest journal e.g.
dialog condition: MyQuestId < 20
give money
journal MyQuestId 20

Link to comment
Share on other sites

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...