Jump to content

Anyone know how to make a local script variable not carry over between dialogs?


Owrocc

Recommended Posts

So I've been trying to make this work without melting the game. This script is supposed to subject vendor repair costs to a modifier based on barter and charisma. The question is where I hook it in. Well, there's not that many choices in the first place and I figured the best way to do it is through dialog as all vendor repairs go through dialog first.

I can't run it together with the repair window as the function needs to be executed before it even appears. Here's the script:

scn aaoRepairCostScript

begin menuMode 1009 ; start on dialog

int makeitstop
if makeitstop == 0 ; do-once loop

    float repaircostvariable ; where the result is stored
    
    set repaircostvariable to (2-(((playerref.getactorvalue barter)+(playerref.getpermanentactorvalue charisma*10))*875/100000))*aaoRepairCostMod ; calculation, with global modifier

    if repaircostvariable < 0.25
        set repaircostvariable to 0.25 ;failsafe for skills above 100
    endif

    setnumericgamesetting fItemRepairCostMult repaircostvariable ; actual gamesetting gets set

    set makeitstop to 1
endif ; end do-once loop

end

The issue here is, since the "makeitstop" variable persists between dialogs, the whole thing only runs once and never again. But if I remove it then the entire script will run all the time during any dialog. Any more efficient way to do this?

I could try to specify the different vendors but that would break compatibility with, well, everything.

Link to comment
Share on other sites

If I were you I would make a second script that runs on gamemode. This one would make makeitstop 0. Just attach it to a quest. You could even cause the quest to end immediately after setting makeitstop to 0 and just restart the quest every time you enter the loop in this script you posted
Link to comment
Share on other sites

  • Recently Browsing   0 members

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