Jump to content


Photo

Parallel scripts for the carrier of BALDUR.BCS


  • Please log in to reply
No replies to this topic

#1 temnix

temnix
  • Member
  • 983 posts

Posted 08 December 2017 - 06:36 AM

This is still something I'm looking into, but the "subject" of BALDUR.BCS, the invisible creature who runs the main script of the games, can be given multiple files at other script tiers. Just like a regular invisible minion, only it's always present. I've given it a script for Override with this insertion at the start of BALDUR.BCS:

 

IF

OnCreation()

THEN

RESPONSE #1

ChangeAIScript("-DET",OVERRIDE)

Wait(2)
Kill(Player1)
END

 

-DET.BCS is just a custom file with True() and DisplayStringHead. The string began to be displayed (before I added the next actions). Originally I had wanted to replace BALDUR with -DET so I could phase the main script in and out at will, but apparently that's not how it works. I succeeded in adding a script to an empty slot, but BALDUR stayed. I know this, because had BALDUR been at the Override level of the invisible creature, the next action after the switch to a new script would not have happened - this is how it works with creatures. But the killing of Player1, which I added later to check, kept happening regardless, no matter which tier I filled with a new script, and the string was not displayed. This probably means that for the invisible creature BALDUR is on some superior level even to Override, so the engine processes BALDUR first and then gets to the scripts in the usual hierarchy.

 

Still, consider what this means. We can insert scripts in parallel to BALDUR (and without endangering the code in it) with any content that we find convenient, and the code in them will be executed in any area and in any situation. There is no need for invisible minions here, for massive code from various mods sitting in the top of BALDUR, with Continue() after every block. All we need is one global in BALDUR, or even not in BALDUR but in AR2600, Candlekeep, where every game starts. If this global is 0, we fill the tiers of the invisible creature with our scripts, our conditions and effects, and set the global to 1 - presto!