Skip to content

Advanced Rest Scripting

nwfan87nwfan87 Member Posts: 99
edited November 2023 in Builders - Scripting
I'm wondering what files in the game deal with the specifics of resting? Is it hard coded? When talking about specifics, I mean things like heal rates, how the game deals with removing effects after resting, spellbooks etc.

This would be useful in creating a custom rest system!

Comments

  • ProlericProleric Member Posts: 1,316
    The module OnPlayerRest script is the place to understand the default code and add mods.

    See also restduration.2da.

    Anything you don't see explicitly there is likely hard-coded.
  • MelkiorMelkior Member Posts: 204
    The OnPlayerRest script is called under three conditions:
    A player begins to rest;
    A player's rest ends normally;
    A player's rest is cancelled.
    There are two reasons for rest being cancelled:
    The player cancelled their own rest;
    A creature hostile to the player wandered within range.
    Functions can tell you which of the first three caused the OnPlayerRest script to be called, but you can only tell whether or not a creature wandering within range cancelled the rest by searching for creatures within range which are hostile to the player.
  • nwfan87nwfan87 Member Posts: 99
    @Proleric @Melkior Ok, this is helpful to know, thank you! Would be interesting to look at the NWN.EXE through a hex editor, but must make a backup first. I've done some hex editing before, so might have a look into it :)
  • TarotRedhandTarotRedhand Member Posts: 1,481
    edited November 2023
    Good luck with that. While I'm not saying that Bioware/BD have done so, you do know that a fair bit of commercial code is obfuscated (encrypted?) to prevent such prying, don't you? FWIW, I think that VS has an option to do just that. Don't know about Turbo C++ though.

    TR
  • nwfan87nwfan87 Member Posts: 99
    edited November 2023
    @TarotRedhand As of now, I've not needed to go into the hard code since I found a work-around solution for my script, that doesn't involve anything to do with the hard-code. Better to use a workaround than mess around with the NWN.EXE code, and then needing that modified EXE to run your project, not to mention all the possible conflicts that could be generated. Short and simple is what we like :smile:
Sign In or Register to comment.