Larian Banner: Baldur's Gate Patch 9
Previous Thread
Next Thread
Print Thread
Joined: Jun 2013
addict
OP Offline
addict
Joined: Jun 2013
I am puzzled (in a bad way) by the osiris tutorial.
What is osiris used for ? Only dialogs and journals ?
I managed to have some nice stuff going on thanks to scripting, but I can't figure out Osiris.
Is there a way to use Osiris for anything else ?
Could we have a simple tutorial, step by step, with some simple goal to achieve ?

I know I am not clear, but neither is my vision of Osiris...

Last edited by Cromcrom; 23/09/17 03:44 PM.

Un chemin de 1000 lieues commence par un premier pas.

Project:
Steam workshop Frontiere
Joined: Oct 2015
apprentice
Offline
apprentice
Joined: Oct 2015
Osiris is used for quite a lot, but yes it's not very documented yet. The wiki is still in extremely early stages, so pretty much everything needs better documentation at this point. I'm not sure how a step by step tutorial would really help though because Osiris is basically a scripting language, so all a step by step tutorial for it would do is show you how to do that specific thing.

Joined: Jun 2013
addict
OP Offline
addict
Joined: Jun 2013
The Osiris Wiki is quite big already, but unusable. what is the point of that DB_fruit stuff? what is it supposed to do ? How can I call osiris stories from actions within the game ?

I am pissed by the terms, too: an osiris program is a story ? So, if I want to tell a quest, i will use a story ? And Goals ? The quest has goals, and so does the osiris story, to tell the story of the quest... so confusing.

Yes, but then, it would be possible to expand. Right now, I just don't know what to do with osiris. I am pretty sure it is very powerful, because the scripting langage is quite weak in some issues, but I don't know.
How to give XPs to a player when it interacts with an object for example ?
I haven't seen a giveXP or stuff like that in the scripting langage. But then, where is the Osiris switch that will fire that XP giving ?

Is it possible to call osiris from the scripting langage ?

I am quite frustrated here.



Un chemin de 1000 lieues commence par un premier pas.

Project:
Steam workshop Frontiere
Joined: Sep 2017
C
stranger
Offline
stranger
C
Joined: Sep 2017
The DB_ stuff are just global tables/lists which you don't have to make a formal declaration. As far as I know they take on the type of the first time one is set.

Therefore DB_fruit("apple") creates a table called DB_fruit of the String type with one entry.

Osiris can catch when one of these entries is set. (as an event.) And you should be able to set an entry or a tag or an event or something like that from a script to trigger an osiris event.

Joined: May 2017
enthusiast
Offline
enthusiast
Joined: May 2017
With the lack of current documentation, the best way to learn how to use Osiris is to look at other scripts, such as those provided by the base game (need to unpack Shared.pak to get to these).

For syntax, a lot of references are on the wiki: https://docs.larian.game/Category:Osiris_APIs, and Norbyte posted a large list of function calls here: http://larian.com/forums/ubbthreads.php?ubb=showflat&Number=602683#Post602683, though be aware that not all of these are currently accurate, since some stuff changed between back then and now.

Joined: Jun 2013
old hand
Offline
old hand
Joined: Jun 2013
Wind's tutorial on making a basic quest has some Osiris scripting in it:
http://larian.com/forums/ubbthreads.php?ubb=showflat&Number=615811#Post615811

I use Osiris for almost everything if I can get away with it. It may not be proper if you are making a large scale game like D:OS 2 but it's just easier for small mods.

Some of the general stuff you can do with the story editor/Osiris:
Set up events based on walking into triggers (ambushes, waypoints, almost anything)
Script teleportation events
Set up conditions for quest success and set a flag when they are complete.


Databases aren't terribly complicated but I wouldn't worry about them at all for now outside of setting up dialogs.

The 3 basic parts are Events, Queries, and Calls.

Events: Purple colored, they allow you to script reactions based on things that happen.

Queries Red colored. These follow events, they go after the event in a statement. You can query multiple things in a statement using AND. Queries are used to get information and can see if the event should actually happen.

Calls (Green) - Calls do most of the things you see on screen. But sometimes offscreen too.


Simple example:
Code

IF
CharacterLeveledUp(_Player)   //This is the event
AND
CharacterGetLevel(_Player,3)  // This is the query
THEN
ObjectSetFlag(_Player,"Level3");  //This is the call
DisplayText(_Player,"Level3");



So in this example, a character levels up. It checks to see what level that character is in the query. If the character has just leveled up(event), and the character is now level 3 (query), Then the character (call) sets the object flag "Level3", and displays the text "Level3".

The text must come from the translated string key. And you could use the object flag in dialog. Say your character is training, you can check that object flag to open up a new dialog node like "Oh I see you're getting stronger" or what have you.



As for your question of can you do things between object scripts and osiris scripts, yes you can. You can set flags in object scripts and set IF statements in Osiris to pick up on it.

For giving experience, that's also Osiris.


The #1 things I can say about using the story editor is press control + space. So in a blank space in a story file, type something you want to do something with. type character. Then press CONTROL + Space. This will pull up a list of everything you can do with a character.

Object is another common one. Type Object and press control + space.

Just an aside, all characters are objects. But not all objects are characters. So most(all?) calls that reference an object, you can use on a character. As I did in the example above.

Originally Posted by LaughingLeader
With the lack of current documentation, the best way to learn how to use Osiris is to look at other scripts, such as those provided by the base game (need to unpack Shared.pak to get to these).




If you make a mod dependent on Origins you can see all the scripts as read only in the story editor without having to extract.

Last edited by SniperHF; 23/09/17 06:07 PM.
Joined: Jun 2013
addict
OP Offline
addict
Joined: Jun 2013
Thanks a lot people.

Your example and tips are great.

However, how do I add some Osiris code into the game ? Through the story editor ? Do I have to tie it to anything ?


Un chemin de 1000 lieues commence par un premier pas.

Project:
Steam workshop Frontiere
Joined: Jun 2013
old hand
Offline
old hand
Joined: Jun 2013
Open the story editor, create a new goal file on the file menu.

I usually lazily move my new goal file as a subgoal (drag and drop) under the included __Start goal. Some scripts don't work properly if it's not under another goal. Some need to be the parent goal.
Safest way is as a subgoal for your purposes.

Sub goals look like the one in the orange box, under another goal.
[Linked Image]


Stuff in the INIT section loads before the game is running. The KB section is where you put IF statements.


Last edited by SniperHF; 23/09/17 08:28 PM.
Joined: Jun 2013
addict
OP Offline
addict
Joined: Jun 2013
SO, one file can be sufficient for all osiris story that are related to my mod (beside organisation issues ?)
Some other example please, and should be well enough fed to get me going:
So I have this script:
Code
INIT
	ITEM:__Me
	EXTERN CHARACTERTEMPLATE:%animalToSpawn=null
	
EVENTS
EVENT onuseitem
VARS
FLOAT3:_trackspositions
FLOAT3:_spawnDestination
CHARACTER:_Source
ON
OnUseItem(_Source,__Me)

ACTIONS
IF "c1"
IsRandom(0.4)
THEN
GetRandom(_spawnDestination,{-2;0;2},{2;0;-2},{2;0;2},{-2;0;-2},{-2;0;0},{2;0;0},{0;0;-2},{0;0;2})
GetPosition(__Me,_trackspositions)
Add(_trackspositions,_spawnDestination)
SpawnCharacter(_,%animalToSpawn,_trackspositions,0)
DisplayText(__Me,"You successfully follow the tracks",3)
//DialogStart(_,"dialog_tracks",__Me,_Source)
ELSE
DisplayText(__Me,"You fail to follow the tracks",3)
ENDIF
ItemDestroy(__Me) 

that is tied to an item, whatever.
I would like to add much more variables to that script, like some player tags (whether he is novice, companion, or master tracker, I already have this dialog running, and it works fine), and maybe some equipment check.
Then, I would like to give the player XPs if he succeeds (and a little more if he fails, whatever).

I am pretty sure I need to use Osiris at some point, but how to do this ? I guess I can create a story, but how do I refer to that particular object. Actually, this would be a template, because those objects are created on the fly (when a creature disappears, it leaves "tracks", this item, so they are created on the fly)
Moreover, but it is much less "urgent" I know it is possible to create functions, in script and osiris ? Some links or tuts ?

Thank you so much for your help people, especially you SniperHF.



Un chemin de 1000 lieues commence par un premier pas.

Project:
Steam workshop Frontiere
Joined: Dec 2013
old hand
Offline
old hand
Joined: Dec 2013
Hi Cromcrom,

The DOS1 video series on Osiris scripting is still a nice introduction to the syntax and overall scope of story scripting. You can ignore the dialogue related one for now as the dialogue editor is pretty different (although you can still create scripts for it similar to the ones you see in the tutorial).

There is also quite a bit of good information on the wiki about Osiris:
Osiris on the Larian Wiki

Osiris is essentially an event driven model. When you create story scripts, you basically inform Osiris of the kind of events you want to be notified about, and then take some course of action. So you can catch an event like, anytime someone uses item X, anytime something gets added to a character's inventory, etc, and then perform certain actions which may themselves trigger additional events. There are a lot of different options really.

You can create procedures in Osiris. They are kind of like inline functions.


DOS2 Mods: Happily Emmie After and The Noisy Crypt

Steam Workshop
Nexus Mods

Moderated by  Larian_KVN 

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