Larian Banner: Baldur's Gate Patch 9
Previous Thread
Next Thread
Print Thread
Joined: Sep 2017
J
jhex Offline OP
stranger
OP Offline
stranger
J
Joined: Sep 2017
Hi there everyone. Hope this is the correct board for questions like this.


I've naturally been spellbound by D:OS2 for the past two days, but I'm not satisfied with the fact that traders don't seem to drop all their items when they die. How am I supposed to get all the books for no money at all, or how am I supposed to "farm"?
[i]Before you object:[/i] I'm playing this by myself, and thus have every right to cheese the game any way I want. ;)

I've thus concluded that - since I've no desire to wait and hope Larian "fixes" it - perhaps it won't be impossible to mod the respective functionality in.

After unpacking a "shared" file, I've had a look at the character scripts. Is there any [i]documentation[/i] available anywhere, or... how exactly does one do scripting for this game? The Engine's script editor doesn't seem to include documentation, either.

I am a professional software engineer, so I believe I can make an educated guess as to how these "behaviours" in these scripts work, but since I've never seen this system before, I've got another question... [b]How difficult would it be to make merchants drop all their items on death[/b], and how would I go about it? Maybe all NPCs instead of merchants, why not. I just want the good ol' farming days to be back.
And finally, the first question reiterated: [b]where's the scripting documentation?[/b]

I appreciate any help on the matter. Cheers!

Joined: Mar 2016
Location: Belgium
T
addict
Offline
addict
T
Joined: Mar 2016
Location: Belgium
First of all, there are actually two separate scripting systems:
* Behaviour scripts: these are generally scripts attached to items/characters, and use an imperative programming language.
* Osiris (aka "Story"): these are generally global scripts that use a declarative programming language (a bit like Prolog). The documentation for this scripting system is still very much incomplete though. On the other hand, while this language evolved quite a bit since DOS EE, the old video tutorials are still relevant and would teach you a good basis. We will make new tutorials about the state of the language in DOS2 (don't know about videos though), but if you want a head start, that's definitely a good place and it won't be time wasted.

That said, making every NPC drop everything they had when they die (in addition to whatever is defined as their regular "treasure") should be fairly easy from Osiris once you know the language:
* you can detect when a character is dying (event CharacterDying)
* you can iterate over its inventory (InventoryLaunchIterator)
* you can drop items from its inventory (ItemDrop)

I say "should", because I'm not certain when the regular inventory gets replaced by the treasure table (and maybe it happens before the CharacterDying event, although I would assume not).

I haven't documented any of the above events/calls yet at https://docs.larian.game/Category:Osiris_APIs, so at least I have good next candidates to add smile (there are 879 Osiris APIs in total, so it will take quite a while to document them all — although some are probably no longer functional and merely leftovers; Osiris was first used in the original Divine Divinity!)

In any case, I will start today on a general Osiris overview that explains the basics of the language.

Last edited by Tinkerer; 16/09/17 11:13 AM.
Joined: Sep 2017
J
jhex Offline OP
stranger
OP Offline
stranger
J
Joined: Sep 2017
Cheers. I'll have a peek at the old tutorials then.

Joined: Mar 2016
Location: Belgium
T
addict
Offline
addict
T
Joined: Mar 2016
Location: Belgium
I've just added an Osiris Overview page to https://docs.larian.game/Osiris. It's less comprehensive than the video tutorials, but it should be quicker to look up things than a couple of hours of video.

Joined: Sep 2017
J
jhex Offline OP
stranger
OP Offline
stranger
J
Joined: Sep 2017
Many thanks for that overview page. I managed to concoct a couple of... statements(?) that sound like they ought to do the trick* based on [url=http://larian.com/forums/ubbthreads.php?ubb=showflat&Number=604088#Post604088]a forum post[/url].

However, in the process of trying to open the "story editor", using the Divinity Engine, and unpacking files, my entire game folder became a fantastic mess. My little addition to the "Start.txt" story file didn't work, either.
I ended up wiping the whole folder, so as to pay more attention to what's going where next time. Is there a guide about which files need to be where, and what the game's directory structure is supposed to look like?



* on CharacterKilledBy, if victim not player-controlled, but attacker (owner) is player-controlled, then InventoryLaunchIterator with a custom event name, handled by a StoryEvent call that takes the item and drops it.

Joined: Mar 2016
Location: Belgium
T
addict
Offline
addict
T
Joined: Mar 2016
Location: Belgium
You should not have to unpack anything. As https://docs.larian.game/Working_with_projects#Project_Type:_Adventure_or_Add-on.3F mentions, if you wish to change story, you have to create an "Adventure" module. Then create an extra story file in your module and add your code there.

Joined: Sep 2017
J
jhex Offline OP
stranger
OP Offline
stranger
J
Joined: Sep 2017
I was hoping to avoid breaking savegame compatibility. Assuming that's not an option, then?

Joined: Sep 2017
Location: Belgium, Ghent
addict
Offline
addict
Joined: Sep 2017
Location: Belgium, Ghent
Hey jhex,

Adding/Changing story in add-ons should not break savegame compatibility. Did you get a specific error message?


CTRL+K the elf
Joined: Sep 2017
J
jhex Offline OP
stranger
OP Offline
stranger
J
Joined: Sep 2017
So do I pick an adventure or an add-on? Conflicting information!

I'm getting a permanent [i]"The files of mod '[/i]Divinity Original Sin 2[i]' and/or its dependencies are invalid" message when I launch the game, despite the fact that I've "reinstalled" the game (Steam) and wiped the folder in My Documents. Dunno what to make of that, really.

Furthermore, if I've got nothing unpacked, the Story Editor throws me a "failed to check out file" error any time I try modifying any story file.

Last, but not least... how do I know that a certain "goal" will be perpetually running? Perhaps adding my snippet to the "Start" goal wasn't correct, as that has calls to GoalCompleted and seems to revolve around character creation. Are the "GLO_*" truly global, and would they do the job? Do I have to add a new file of my own? Where's the control flow defined, dammit?! :D

Joined: Sep 2017
Location: Belgium, Ghent
addict
Offline
addict
Joined: Sep 2017
Location: Belgium, Ghent
Sorry for the confusion, I did not see Tinkerer's post or I would've made things clearer.
Tinkerer had slightly outdated information due to an old line that was still present on the wiki.

On adventures and add-ons

Both adventure and add-on support story scripting, the difference is this:

- Adventure: Like our main campaign, an adventure is the main story you'll be playing. It is selected in the main menu's Story menu (only shows when you have multiple adventures available). Here's how it looks. You'll be picking an adventure if you want to make your personal campaign from scratch. Nice little showcases are these already published adventures: The Noice Crypt and Divinityball.

- Add-on: An add-on is something you enable on top of a campaign. It can be toggled on/off and just adds its content to the adventure. You'll want to use an add-on when adding or changing items/skills/quests/... both general as well as story changes are allowed.

On invalid files

There will indeed be invalid or even more likely additional files in your folder. Steam generally doesn't throw files away, even when verifying. You'd have to completely remove everything from your folder. This is not limited to your Documents, but also the installation folder in Program Files and in the steam folder where the data is located.

On story files

Are you still able to modify them? We are aware of some false warnings and are investigating.

On perpetual goals

That would be something @Tinkerer will be able to help you with far better than I'd ever could smile

Last edited by Larian_KVN; 18/09/17 12:42 PM.

CTRL+K the elf
Joined: Mar 2016
Location: Belgium
T
addict
Offline
addict
T
Joined: Mar 2016
Location: Belgium
Originally Posted by jhex
Last, but not least... how do I know that a certain "goal" will be perpetually running?

As long as a goal does not call "GoalCompleted;" it will run. Goals cannot be closed by other goals; they can only close themselves.

Quote

Perhaps adding my snippet to the "Start" goal wasn't correct, as that has calls to GoalCompleted and seems to revolve around character creation.

As mentioned in the Osiris overview, a goal calling GoalCompleted closes that goal itself, and initialises/activates all of its subgoals. So unless you need to be active during character creation, you can initialise afterwards too. It probably won't hurt to be active during character creation as well though, since no one dies there smile

Quote

Are the "GLO_*" truly global, and would they do the job? Do I have to add a new file of my own? Where's the control flow defined, dammit?! laugh

All control flow is event-driven. Any top-level goal is active right from the start the story of a mod initialises (and hence will be able to process events), and until that goal calls "GoalCompleted". The name is irrelevant, but GLO_* is a good way to specify your intention. Creating a new goal of your own is indeed best.

One word of caution: make sure not to call any helpers from a top-level's goal initialisation code (or from procedures called from there). The reason is that at that point, most other goals will not have initialised yet and while you won't get compilation errors (since the compiler can find the routines), at run time nothing will happen as the goals containing these routines may not be active yet (and hence the events your module throws to call those routines are not caught by anyone).

Joined: Sep 2017
J
jhex Offline OP
stranger
OP Offline
stranger
J
Joined: Sep 2017
Cheers, but I discovered that Thievery is stupidly OP coupled with free re-specs and the potential for easy savegame editing, so I don't need to bother with any additional cheese. Besides, I've too little time to learn how to mod D:OS 2 right now.

Perhaps this thread might serve as a basic guideline for someone who decides to go through with the same goal.

Originally Posted by Larian_KVN

On story files
Are you still able to modify them? We are aware of some false warnings and are investigating.:)

I do believe I am. However, attempting to save them requires saving to a plain-text file, which is why I believed extracting them was a prerequisite.

Joined: Jan 2010
Location: USA
F
enthusiast
Offline
enthusiast
F
Joined: Jan 2010
Location: USA
Originally Posted by jhex
I'm not satisfied with the fact that traders don't seem to drop all their items when they die.

In Shared\Public\Shared\Stats\Generated\Data\Data.txt, make these changes...

From:

key "TraderDroppedItemsPercentage","20"
key "TraderDroppedItemsCap","5"

To:

key "TraderDroppedItemsPercentage","100"
key "TraderDroppedItemsCap","500"

If you want everyone to inherit those values, you'd need to write a script that adds the TRADER tag to everyone. (I have no idea what the consequences of doing that would be.)


Moderated by  Larian_KVN 

Link Copied to Clipboard
Powered by UBB.threads™ PHP Forum Software 7.7.5