Jump to content

Are scripts run simultaneously?


temnix

Recommended Posts

I'm thinking of adding quite a large chunk of code to BALDUR.BCS for my next mod. It's unusual for me, but this kind of checking and variable-setting needs to be done on a constant basis. I could put the code in area scripts instead, but that's probably not much different in terms of impact on performance. Or is it? In any event, in place of both of those I might only put a self-resetting timer in BALDUR, to cast a custom spell on the party, say, every 3 rounds, which would summon an invisible minion who would take account of the changes in statistics, adjust variables and disappear. This makes me wonder, though: are creature scripts run in parallel with BALDUR, or are the same resources distributed between actions in creature scripts and engine-level scripts? Doing the check all the time with a minion has a couple of drawbacks and it is only worthwhile if it frees up whatever attention span the engine dedicates to BALDUR.

Link to comment

Well, if you think on adding anything to baldur.bcs, then you should understand what you do.

Simple fact, a script that runs, finds the very first thing in it that is true and excecutes that ... and nothing else. On that run. You bork that up and you fuck up the whole game. Cause it's running endlessly and so forth. Did we mention that the scripts are ran with every tik, fortunately the game has a limited framerate set in it, that doesn't get faster the faster your computer is, unlike in the Fallout.

You could add in a Continue() in the script, but that has less than stellar outcomes as well, cause you then need to addin stepped progressions and you can't use timers. Cause timers count up, which is an action.

... point I want to go into also, what is this action that requires all this scripting ? Could a player never run a game while it wouldn't be ran into ? In most cases, you don't need to put it in the baldur.bcs, or any of the area .bcs'es either. You can rather set a Global to 1 via a spell, that the baldur.bcs sees and summons a creature and sets the same Global to 2... and that's that for baldur.bcs's part. The summon's own script can do the rest. It can wait the 3 rounds, it can check the stats and use ActionOverride's.

Edited by Jarno Mikkola
Link to comment

Continue() works perfectly at the end of an addition, there are no problems or glitches with it. But I still would like to avoid stuffing BALDUR so much. The constant checking here is to keep track of Reputation. Every master area will have a separate Reputation value, recorded in a global and restored from it when the party returns from a different area. But there will also be an overall Reputation global to follow the party around everywhere, catching up with a delay for new areas. At least that's the idea. I'm still thinking about the mechanism, but either way Reputation has to be tracked all the time, because it's not going to be a fixed value anymore. The concession to making the check once every three rounds with a minion is already a bit of a stretch - the characters may rush out of an area after killing someone, and the global won't be set to reflect this.

About the frame rate I can say that a fast computer may not speed up the gameplay, I wouldn't know, but a slow computer can definitely bog it down. Switching between screens, numerous creatures running scripts, special effects, all of them have an effect.

Link to comment
44 minutes ago, temnix said:

.... At least that's the idea.

Then we take that you want to have this reputation effect the areas people... why not check for an area reputation, aka the areas own dedicated global, not the overall one saved in the savegame, which you don't need to touch at all.

Have the areas run scripts that checks if people in there are dead, at the end of their scripts... this should be easy via script names, and global indexing, aka each "crime" reduces the area's own specific global by one, and it can be done off the specific areas too. As there you are looking at the SPRITE_IS_DEAD ...variables, to set a specific global or actually you want to set two, as one is to remove the possibility of repeated effect added to the IF -condition, while the other is the area specific global. Hmm, I would use this (action 446.)

Link to comment

The system for changing Reputation will be different, it's already done. This is about taking stock of Reputation. The area global is one thing, and the game-wide global is another. It's also necessary, otherwise no one at the Nashkel Carnival would ever know that the party has wiped out Nashkel itself. Both need to be set and tracked (I hate that word). The global value is going to affect the local reputation with a delay. Fallout had an enviable system, with Karma but also reputation in every town. I think Torment has this too, in faction reactions. A town would simply be one faction. But for BGs and Icewind Dale nothing like this naturally exists, a lot of scripting has to be mounted instead.

Link to comment
On 6/21/2020 at 1:59 AM, temnix said:

The concession to making the check once every three rounds with a minion is already a bit of a stretch - the characters may rush out of an area after killing someone, and the global won't be set to reflect this.

The same can happen with baldur.bcs.

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...