Larian Banner: Baldur's Gate Patch 9
Previous Thread
Next Thread
Print Thread
Joined: Jun 2013
addict
OP Offline
addict
Joined: Jun 2013
Should I add it at the end of all my custom goals, to make sure it doesn't interfere with the rest ?

Should all my stories be subed to the _start menu ?
I know all stories are alphabetically linked in Osiris...

I have some terrible issues I don't understand, sometimes, removing a single, irrelevant line on a story makes another story bug, sometimes, the stories won't build, but the effect will fire...

I am so lost. And drowning.


Un chemin de 1000 lieues commence par un premier pas.

Project:
Steam workshop Frontiere
Joined: Sep 2014
journeyman
Offline
journeyman
Joined: Sep 2014
Hello, Cromcrom. Let me try to help you here.

Can you make a screenshot of the structure of your goals in Story Editor so I can better understand what do you have there?

Now a bit of theory.

You are indeed right that the order of the goal (story script) is important for scripting cause all these scripts are compiled in single file and scripts are executed from top to bottom.

http://take.ms/ORK1H

This is the example of new project without dependency on DivinityOrigins (DOS2) mod.
There are only very basic system scripts in in.

As you can see some scripts are placed on root level and some scripts are docked under their parents. Why is that?

Well, this is because depending on what you are going to do in your script, the game might not be ready yet to execute it. Osiris scripts themselves are loaded very quickly so you can execute some scripts almost immediately. As soon as osiris is loaded code in INIT sections of goal will start executing in scripts from top to bottom going from script to script in alphabetical order. Sometimes code in INIT section also triggers code in KB section if we e.g. will call a procedure from INIT.

It might be ok to start doing something in your script and might be not ok. How do decide what is ok and what is not?
Well if it is something related to osiris only - e.g you just want to create a new database and store the number 2 in it (for some reason smile )

INIT (of some script)
DB_MyCont(2);

This is totally fine, and DB will be created.

What might not be ok to do, for example, is to use call to make a character move somewhere.

CharacterMoveTo(CHARACTERGUID_MyChar,TRIGGERGUID_SomeGuid,1,1);

Why is that? Well this may fail simply because game engine is not ready yet to execute your calls and/or because level is not loaded yet and character is just not created in the engine.

That is why I marked the "GAMEEVENT_GameStarted" event in my screenshot. This is very important event for scripting.

IF
GameEventSet("GAMEEVENT_GameStarted")
THEN
DO_Something();

This event is system event and is called from engine. Basically it says - Game is loaded and ready - you can do your stuff. This is why we have that __Start script in our story. It is there to wait for the event that game started, do some init and then start processing scripts that are docked to this goal and start executing code inside.

IF
GameEventSet("GAMEEVENT_GameStarted")
THEN
GoalCompleted;

If we take a look at this script we may see GoalCompleted; command. What this one does?
Well this is another important command. It says - I'm done with this goal, no longer execute it and proceed further. Further, in this case, will actually start executing docked goals __GLO_Shovel, __GLOBAL_ExplorationBonus etc etc will start be executing in the order (INIT sections first) and the code will be now able to call events and procedures in KB section of these scripts.

So now going back to your question.

I suggest to organize your story scripts like this:
1) Create some goal that will serve as parent goal for your entire project. Something like __MyModStart
2) Add scipt bit to KB section of this goal
IF
GameEventSet("GAMEEVENT_GameStarted")
THEN
GoalCompleted;
3) Start docking all your goals to this __MyModStart goal.

This will most likely fix you problems with something not executing or executing in incorrect order. Note: if it is important that something in your scripts to happen earlier than something else it needs to be placed closer to the top of the script because the script is executed from top to bottom. If code is placed in different scripts, then script needs to be placed earlier in the list (alphabetically)

Something like this
http://take.ms/S000V

Let me know if this solved your issues, don't be afraid to ask more questions. Scripting is failry confusing, I know smile

Happy modding!



Joined: Sep 2014
journeyman
Offline
journeyman
Joined: Sep 2014
Also check this very thorough articles explaining how osiris works
https://docs.larian.game/Osiris_Overview
https://docs.larian.game/Osiris_Design_Patterns

Last edited by Cadmus88; 07/10/17 10:56 AM.
Joined: Jun 2013
addict
OP Offline
addict
Joined: Jun 2013
Thank you so much for taking the time to write this detailed answer. I have been through Larian's explanations already. I didn't get the DB system at first. No w I have a good grasp on it, and can use it for some fairly interesting bits of systems.
I am also starting from scratch, not taking the Native game as parent. I did that because od some character creation issues. It seems starting from scratch makes things harder, because --Rant on-- some options are missing, like quite a lot of convo scriptflags, for example. Couldn't they just simply be made global ? I tried to copy past the DOS2 ones into my mod, but "of course", nothing happens, way to simple. If you don't follow 15 obscur hidden steps in this editor, nothing happens as "expected".-- Rant off--.

1/ I will give a try to your solution. Should _MyModStart be located under _Start ?

2/ So, to make things clear and simple, I could just create on single big old story ?
Because how do I know what stuff have been implemented in the base osiris stuff ? How do I know what will be broken if I add a DB ? My main problems it seems have come from DB_isPlayer(); "Sometimes" it seems to be needed, and "Sometimes", not. Moreover, a DB in Init is used to store stuff, and in KB, to call stuff or to store stuff. So confusing overall...

I think my routines are biased, because I code with object oriented procedures in mind.

Again, I can feel the power, but can't reach it :-(


Un chemin de 1000 lieues commence par un premier pas.

Project:
Steam workshop Frontiere
Joined: Jun 2013
addict
OP Offline
addict
Joined: Jun 2013
And I mean, if I create a script, I should give it a name that ensures it will be placed at the proper location in the story list ? How do I know a location is proper ?
The more I think about it, the more I think I will pass on all this, because creating maps, like 90% of modders, is just not my stuff. They really improved the engine between DOS1 and DOS2, but some very basic stuff is missing. I just SHOULD NOT wonder for hours how to check if a convo node can appear if I have the proper amount of gold in my inventory. Or how to make players teleport from an area to another.
Mount and blade Bannerlord is "around the corner", and hopefully, it will be as moddable as M&B Warband.

Cheers.


Un chemin de 1000 lieues commence par un premier pas.

Project:
Steam workshop Frontiere
Joined: Sep 2017
M
member
Offline
member
M
Joined: Sep 2017
Hey bro - i feel your pain - My standalone has now 5 fully finished quests (more in development) Teleporting to trigger - showing messages with condition - all that works now finally actually very smooth for me - All i do is put my story goals below _Start .

Id say a save location is a location you can be 100% zu your goals are last initialized

I name it based on what the goal does like "trader", "riddle","journey". Thing is as all other sub-start goals are listed with _ they will all ini before my goals so i am on the save site. Not to say the way i do it is perfect but i never had any dependace issues.

The biggest issue i see is the following (quote from wiki)

If you call PROCs from your INIT code, ensure that these are defined in goals that are guaranteed to already have been intialised. You will not get a compile-time nor run-time error if you call a routine declared in a goal that is not yet active; the call will simply not do anything.

Example: consider the screenshot of the Goal Initialisation and Completion section. Calling a PROC defined in the FTJ_Origins_Ifan goal from the INIT code (or from a PROC called from the INIT code) of the AtaractionArtifacts goal will silently fail here. The reason is that both goals are subgoals of the _Start goal, and goals are initialised and activated in alphabetical order. So when the AtaractionArtifacts goal gets initialsed, the FTJ_Origins_Ifan goal is not yet active.


THAT is just lame , why no info ....

ps: i noticed some issues if i have origin as dependancy ... well for my standalone i actually dont need ir smile

Last edited by monzua; 07/10/17 10:06 PM.

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