Jump to content

Adding ~250 script blocks to baldur.bcs: is there a measurable impact on the EE engine?


Recommended Posts

If I add many script blocks to (bd)baldur.bcs (bdbaldur.bcs for BG_SoD, baldur.bcs for EET), is there a noticeable impact (lagging etc.) to be expected (EE engine)?

I'm talking about ~250 script blocks for SoD. I'll tagg all of them with some kind of %IT_IS_SOD% variable in the hopes it will make the engine skip them faster in the other parts of the game. All of the script blocks are true once max.

Link to comment

I could decrease the number of blocks significantly by not working with variables that get counted up but just using unique variable names for all instances. That would mean I'll introduce ~80 global variables.

The concept of the mod is tracking knoweldge the party gathers. Depending on how detailed the info is, the value of the variable gets counted up. This means that I need script blocks that keep track of what the group already knows in case they encounter an info point which would decrese the variable. If I'd work with unique variables for all instances I can just set the variables at the info points (e.g. in dialogues) and wouldn't have to care about variables being decreased again. It would mean I'd have to work with OR structures to know what is already known to the group, though, as I wouldn't be able to work with GlobalGT/GlobalLT any more. I'm not decided that would be a good idea yet, as it would mean I wouldn't be able to use OR structures for more than one variable(group) any more.

Link to comment
3 minutes ago, jastey said:

What would the impact on an area script or an NPC override scrip be? Would such an amount of script blocks lead to any lagging/ impact with regard to the specific areas and / or the NPC in question?

It depends. If these blocks are added only to a few selected area scripts then it might be a better option. For NPC override scripts you would also have the option to assign these scripts temporarily on demand.

Link to comment

Thanks for your answers.

Switch():

I'm not sure. If I understand correctly the Switch() trigger would give different responses depending on what value the according variable specified has. What I need is a way to count a variable up - and only up, despite the value of another trigger variable jumping from lower to higher ot lower values.

An example, although I'm sure you don't need it to understand. Let's say I have a variable KnowsLocation which keeps track whether A Location is known to the group.

KnowsLocation = 1: group heard about it

KnowsLocation = 2: group knows how to travel there

KnowsLocation = 3: group visited The Location.

What I want to prevent is that, after already traveling to this example area, they might hear it being mentioned by someone else which would set KnowsLocation back to "1". If I do not use another set of variables to keep track this would mean that although the party already visited, the KnowsLocation would be reset to a value which would indicate that they only heard about it, giving NPCs and quest characters all sorts of wrong reply options and reactions.

1 minute ago, argent77 said:

For NPC override scripts you would also have the option to assign these scripts temporarily on demand.

Ooh, that's a good idea. I didn't think about this. That's a really cool idea. I could do the same to area scripts, actually. Instead of having all 250 script blocks I could set one extra trigger variable which sets the area script to another that does the "variable setting" and afterwards changes back to the area script in question. This would mean I have more files in the override unless I'd find a smart way to use only one script for all areas. Would there be any obvious reason not to use this for area scripts? I know NPC banter are triggered this way, to it should be save or would this be a "trick" that could mess up area scripts if too many mods would use it too intensely?

Also, can I be sure that in SoD, area scripts of the master area are always also executed in the "lower" areas attached to it or is it not that trivial?

Link to comment
35 minutes ago, jastey said:

Ooh, that's a good idea. I didn't think about this. That's a really cool idea. I could do the same to area scripts, actually. Instead of having all 250 script blocks I could set one extra trigger variable which sets the area script to another that does the "variable setting" and afterwards changes back to the area script in question. This would mean I have more files in the override unless I'd find a smart way to use only one script for all areas. Would there be any obvious reason not to use this for area scripts? I know NPC banter are triggered this way, to it should be save or would this be a "trick" that could mess up area scripts if too many mods would use it too intensely?

Also, can I be sure that in SoD, area scripts of the master area are always also executed in the "lower" areas attached to it or is it not that trivial?

In that case the mechanism used by breakable cutscenes might help you to save some work. It sets a script to a temporary area script slot with the SetAreaScript(S:Script*,I:ScriptSlot*ASCRLEV) action. The same action can also be used to clear the script slot after the script is done. Breakable cutscenes use the OVERRIDE slot, but any other slot type should work as well.

For example, add this to an area script:

IF
  Global("should_update","GLOBAL",1)
THEN
RESPONSE #100
  SetGlobal("should_update","GLOBAL",2)
  SetAreaScript("myscript",OVERRIDE)  // or use slots DEFAULT, GENERAL, RACE, CLASS
  Continue()
END

And add this block to the bottom of your custom script ("myscript.bcs" in this example):

IF
  True()
THEN
  RESPONSE #100
    SetGlobal("should_update","GLOBAL",0)
    SetAreaScript("",OVERRIDE)  // or use slots DEFAULT, GENERAL, RACE, CLASS
END

The master/non-master relation of area scripts should also work for these scripts since they are technically still area scripts.

Link to comment

@argent77 super cool!

I could add a "set area script override" script block to baldur.bcs that changes the area script, then it would be one additional script block only and it would cover all areas (and NPC mods too as they could also set the variable if necessary).

This is the same mechanics as in NPC banters in SoD (where the area script is set via the NPC override script).

2 hours ago, argent77 said:

SetAreaScript("",OVERRIDE) // or use slots DEFAULT, GENERAL, RACE, CLASS

A question to this: where exactly is "the" area script defined - I mean the standard AR/bdxxxx.bcs that is attached to each area file. I think I get confused because I know the OVERRIDE, CLASS, RACE etc slots from cre files - where all the individual actions are inside the OVERRIDE and setting this to nothing would just "delete" it. Is the "normal" area script as it was in the classic engine a slot like these categories or is this something different? Because the possibility to set the area script to something else and reset it by setting it to "" did not exist in BGII, did it?

2 hours ago, argent77 said:

The master/non-master relation of area scripts should also work for these scripts since they are technically still area scripts.

I'm not sure I understand this sentence, but if I trigger the area script change via baldur.bcs is shouldn't make any difference, right?

I see two possible problems:

1. In case the area script of the current area is set to the example script myscript.bcs and the player changes areas while it runs - this might mess up either my script or the area script of the left area? I could prevent this by adding a "if this script was called (or is still active) but no variable is detected, reset to the normale area script" fail safe. 🤔 But this technique is also used for NPC banter which take a while to complete so it should be kind of stable. I never tried to leave an area while they happened.

2. This procedure of set variable -> call baldur.bcs -> call myscript.bcs -> reset area script might take a little moment. It could fail to set my variables just in case e.g. two (paused) dialogues are started one after the other in too short time for the scripts to run through. If the second dialogue (as an example) sets the same variable to a lower number, the higher number could be lost because the scripts didn't finish running. Same situation in case there is a cutscene with a dialogue afterwards, maybe. I would assume chances of this are rather slim, though.

Link to comment

I came here to see what answers had been given regarding the capabilities of the EE engine, but I suppose there's no reason not to contribute. I've seen the scripting that Argent77 is talking about for when cutscenes are broken, but I'm not sure if using that resolves all of the issues you were wondering about?

3 hours ago, jastey said:

The concept of the mod is tracking knoweldge the party gathers.

This is awesome. I was thinking of doing this exact same thing as an (optional) method of tracking the parties' knowledge of the Iron Throne's activities, in order to determine the point at which Scar (or perhaps Eltan) says: 'Right then, you've got me convinced: off you go to the Iron Throne building to investigate them. Here's the key.'.

3 hours ago, jastey said:

An example, although I'm sure you don't need it to understand. Let's say I have a variable KnowsLocation which keeps track whether A Location is known to the group.

KnowsLocation = 1: group heard about it

KnowsLocation = 2: group knows how to travel there

KnowsLocation = 3: group visited The Location.

What I want to prevent is that, after already traveling to this example area, they might hear it being mentioned by someone else which would set KnowsLocation back to "1". If I do not use another set of variables to keep track this would mean that although the party already visited, the KnowsLocation would be reset to a value which would indicate that they only heard about it, giving NPCs and quest characters all sorts of wrong reply options and reactions.

Your example sounds simpler than your earlier posts, so maybe this won't be of any help, but I'll try anyway.

Your situation seems very similar to the position in the vanilla game where it has to ensure that journal updates for the main quest in a chapter are not given once that chapter has finished. For that, it just uses a response trigger. The dialog ends up, or can end up, at a state with no reply text. The topmost transition updates the journal. The lower transition has a response trigger GlobalGT("Chapter","GLOBAL",X) and, if chosen, you don't get the journal update. Obviously if you need replytext then you just use mutually exclusive response triggers.

Link to comment
1 hour ago, jastey said:

I could add a "set area script override" script block to baldur.bcs that changes the area script, then it would be one additional script block only and it would cover all areas (and NPC mods too as they could also set the variable if necessary).

Yes, that should work.

1 hour ago, jastey said:

A question to this: where exactly is "the" area script defined - I mean the standard AR/bdxxxx.bcs that is attached to each area file. I think I get confused because I know the OVERRIDE, CLASS, RACE etc slots from cre files - where all the individual actions are inside the OVERRIDE and setting this to nothing would just "delete" it. Is the "normal" area script as it was in the classic engine a slot like these categories or is this something different? Because the possibility to set the area script to something else and reset it by setting it to "" did not exist in BGII, did it?

These script slots exist only in memory. They are not saved with the game, so after a reload (and possibly an area transition) the script is cleared automatically.

 

1 hour ago, jastey said:
4 hours ago, argent77 said:

The master/non-master relation of area scripts should also work for these scripts since they are technically still area scripts.

I'm not sure I understand this sentence, but if I trigger the area script change via baldur.bcs is shouldn't make any difference, right?

Yes, it's badly worded. I mean master scripts are still executed in linked non-master areas. For example, after entering an interior map the script of the exterior map (e.g. city map) will still be executed.

 

1 hour ago, jastey said:

1. In case the area script of the current area is set to the example script myscript.bcs and the player changes areas while it runs - this might mess up either my script or the area script of the left area? I could prevent this by adding a "if this script was called (or is still active) but no variable is detected, reset to the normale area script" fail safe. 🤔 But this technique is also used for NPC banter which take a while to complete so it should be kind of stable. I never tried to leave an area while they happened.

My example from above is probably not fail-safe enough. It's probably better to reset the variable to 0 directly in the block where the new area script is assigned. Otherwise the variable may not reset at all if the player saves and reloads or changes the area.

Link to comment

@argent77 thanks again for your answer!

@The_Baffled_King I'm not sure I got your reply correctly, but adding x additional transactions with different triggers and different actions to account for the status of the group's knowledge is not an option. It would not work if it's a state with reply options for once, and for dialogue states with transactions it would skip all existing ones, making the mod highly incompatible with other mods that might have added transactions to the exiting onces. Plus, I have 18 variables with up to 5 states. But maybe I got what you said wrong.

What my mod does currently is ADD_TRANS_ACTION to the dialogue states in question and then the value set will be evaluated via script. (The mod also adds variables via script where appropriate.)

Link to comment

No, I think you got what I said entirely right : )

As I said, from my reading of your example with "KnowsLocation", it seemed like part of the situation you were describing was a lot more straightforward than it sounded in your second post (and in your most recent post). And obviously if you're modding existing dialog rather than creating new dialog then that also changes things. Sorry to have muddied the water; I did think that the position was probably more complicated than it sounded from reading your example!

Edited by The_Baffled_King
Link to comment

Well, the one part of my reply that's still valid is that tracking knowledge gained is a pretty cool idea.

From my perspective, it's all good; as I said, I'd already seen what tricks are used when a cutscene is broken, but I've still learned a few extra things from reading this thread.

But sorry again for muddying the waters!

 

Link to comment

Join the conversation

You are posting as a guest. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...