Jump to content

making changes only affect player-controllable characters


Recommended Posts

I'm working on something that will change the way spellcasting works... but not in a scriptable way. It is only visible to players, changing the way they interact with the UI; it is useless and could be detrimental to AI enemies. Generally the way this is handled is to put abilities into the "CLAB__.2da" ability tables, because those are applied to PCs when they are created and to NPCs when they join the party.

But SCS applies all CLAB abilities to all NPCs, including AI-controlled ones that fight against you.  I want to protect these creatures from being affected by my changes and leave their abilities and scripts alone, since SCS already has them working pretty well.  So, easy enough to distinguish joinable NPCs from non-joinable ones in Weidu and give non-joinable characters 206 protection against my CLAB ability.

BUT, there are the rare cases in which a creature might be joinable, but might fight against you if they don't join you.  Baeloth I think, probably Ascension Balthazar too. Maybe one or two mod-added NPCs.  And I guess you can theoretically pick a fight with any joinable NPC when they are blue-circle and thereby turn them to red-circle.

I know this is edge-case stuff, but can anyone think of a way to distinguish in-game between joinable and non-joinable, to make sure the changes are only applied to party members? Off the top of my head I can only think of:

1) Insert checks into BALDUR.BCS to remove the 206 protection from PLAYER1 through PLAYER6. (My mod's changes take a few seconds to kick in, so the game script should update them before it happens)

2) Pull the mod changes out of the CLAB table and into an innate ability: "Initilialize Modified Spellcasting Abilities." And have the player manually make the change when each character is created or joins the party. (This would be quite reliable, but players don't like it for breaking the 4th wall.)

Any ideas?

Edited by subtledoctor
Link to comment
1 hour ago, Allbrother said:

Couldn't you do the innate ability and then have baldur.bsc ReallyForceSpell it on joining? That's not much different than 1), but I don't get what's wrong with that option in the first place

Right, so make a mess of it and you can't finnish the game. Cause you F-ed up one of the important files in the game.

Link to comment
2 hours ago, Allbrother said:

Couldn't you do the innate ability and then have baldur.bsc ReallyForceSpell it on joining?

I try to never touch that script, so that sort of thing never even occurs to me. But I guess I could do something like:

IF
	    NextTriggerObject(Player1,Locals(ThisVariable,0))
	    OR(6)
	        Class(Player1,MAGE_ALL)
	        Class(Player1,BARD)
	        Class(Player1,CLERIC_ALL)
	        Class(Player1,DRUID_ALL)
	        Class(Player1,PALADIN)
	        Class(Player1,RANGER)
	THEN
	    ReallyForceSpell(Player1,ThisSpell)
	    ActionOverride(Player1,SetGlobal(LOCALS,ThisVariable,1)
	    Continue()

Need to clean up that syntax, obvs, and repeat through Player6, but that could run once on each party member and then get out if the way. My understanding is, casters would have the local variable set upon being activated, and thereafter escape the trigger; and non-casters would never activate it; so hopefully it would not clog up the script?

It just irks me at a gut level to check for something on 6 characters once per second across a ~100-hour game (so, ~216,000 checks?) for something that only needs to happen once, ever, for each character...

Is there no condition in opcode 318 that can limit a spell’s effects to party members? Like EA/30 (GOODCUTOFF)? I confess I’ve never fully understood EA values, like does that mean actual green-circles, or does it mean “anyone allied with the caster of this spell?”

Link to comment
1 hour ago, subtledoctor said:

It just irks me at a gut level to check for something on 6 characters once per second across a ~100-hour game (so, ~216,000 checks?) for something that only needs to happen once, ever, for each character...

x15 ... 😡

Link to comment

Is this aversion something left over from the original engine 15-20 years ago when pentium 4 was the peak of computing power? I've not seen any evidence to suggest any issues on the EEs and modern machines. In fact, the only thing I found googling was someone in 2007 having stutters on a BWS setup and pasting a nearly 10k lines long baldur.bcs. I hardly think a few extra blocks appended to the 4 different baldur.bcs' (which combined are still like half the lines) the trilogy is broken into these days is comparable, even without accounting for the updated engine and the fact today's browsers pull more resources than BG.

 

Anyway...

2 hours ago, subtledoctor said:

Is there no condition in opcode 318 that can limit a spell’s effects to party members? Like EA/30 (GOODCUTOFF)? I confess I’ve never fully understood EA values, like does that mean actual green-circles, or does it mean “anyone allied with the caster of this spell?”

Per https://gibberlings3.github.io/iesdp/files/ids/bgee/ea.htm goodcutoff is all green circles, including party members, summons, possibly charmed creatures and others that turn green without being controllable. PC is only party members

Edited by Allbrother
Link to comment
18 minutes ago, Allbrother said:

Is this aversion something left over from the original engine 15-20 years ago when pentium 4 was the peak of computing power? I've not seen any evidence to suggest any issues on the EEs and modern machines. In fact, the only thing I found googling was someone in 2007 having stutters on a BWS setup and pasting a nearly 10k lines long baldur.bcs. I hardly think a few extra blocks appended to the 4 different baldur.bcs' (which combined are still like half the lines) the trilogy is broken into these days is comparable, even without accounting for the updated engine and the fact today's browsers pull more resources than BG.

Thing is, the browsers can utilize multiple cores and multiple threads. It's not a single core/thread resources that they read.

Yes, the aversion is is left from there, but there's a good reason for it. Google "bag of holding" and the term "lag". Ouh, and there's this. Written in the ancient times by no one else than me.

It doesn't matter if the baldur.bcs is one line or 100k, if there's one faulty line, the game lurches each time it's passed, which with 15 times a second is kinda bad. The rate comes from half the frame rate.

Link to comment
49 minutes ago, Jarno Mikkola said:

Thing is, the browsers can utilize multiple cores and multiple threads. It's not a single core/thread resources that they read.

But that single core nowadays has 3-4-5 times the frequency and who knows how many times the instructions per cycle than the glorified calculators we used to play this game on. 

49 minutes ago, Jarno Mikkola said:

Google "bag of holding" and the term "lag".

Couldn't find anything, everything is people asking where to find one in bgee. I assume there used to be a problem lugging around too much stuff in it? Even though I hoarded everything in it back in the day and don't remember having issues.

49 minutes ago, Jarno Mikkola said:

Ouh, and there's this

I'm sure it helped people 10 years ago, but very little holds up today. 

49 minutes ago, Jarno Mikkola said:

It doesn't matter if the baldur.bcs is one line or 100k, if there's one faulty line, the game lurches each time it's passed, which with 15 times a second is kinda bad. The rate comes from half the frame rate.

And making a typo in the resource field will crash the game, but that's not a reason to not make spells and items. NE allows us to easily compile and check for faulty lines, there's no reason for there to be any once a mod is packaged and released.

And if despite everything one is still unconvinced, a script like that can always be put in dplayer2/3 instead, which can be turned off with party AI in case of issues. Then it'll even be a single block, since player1-6 can be replaced with myself

Edited by Allbrother
Link to comment
39 minutes ago, Allbrother said:

And if despite everything one is still unconvinced, a script like that can always be put in dplayer2/3 instead, which can be turned off with party AI in case of issues. Then it'll even be a single block, since player1-6 can be replaced with myself

Then WHY did you say this in the first place ? 

7 hours ago, Allbrother said:

Couldn't you do the innate ability and then have baldur.bsc ReallyForceSpell it on joining?

 

Link to comment
2 hours ago, Allbrother said:

Is this aversion something left over from the original engine 15-20 years ago when pentium 4 was the peak of computing power?

In part. Yes, I remember the bad old days when tons of mods made tons of additions to baldur.bcs, and it didn't go well. My preference became to use spells instead of scripts; I'll note that 1) single-threaded performance on modern processors is not actually that much better than it was on those old beefy Pentium chips; and 2) I play the game on a tablet with a mobile processor that is 10 years old, which is actually pretty darn slow. Even if the risk of script-based hiccups is low, the risk of hiccups in spell effects is effectively nil; overloaded scripts are prone to simply skipping blocks, whereas overloaded spells will briefly pause the game until they are finished processing. So best practice, to me, is to default to avoiding scripts and use spells instead. With the new EE opcodes, there is almost nothing you can do in scripts that can't be done in spells, so this practice works fine.

2 hours ago, Allbrother said:

Per https://gibberlings3.github.io/iesdp/files/ids/bgee/ea.htm goodcutoff is all green circles, including party members, summons, possibly charmed creatures and others that turn green without being controllable. PC is only party members

Thanks, I never messed with that stuff so I never fully learned whether the descriptions of them is meant in an absolute sense (which I guess it is), or relative to the caster of the spell (which I gather effect targeting is). I'll try simply adding a 318 effect to block the spell for !(EA=PC).

Link to comment
1 hour ago, Jarno Mikkola said:

Then WHY did you say this in the first place ? 

 

Two reasons

1.Same reason the second option in the OP wasn't desirable - firing the script from dplayer relies on the player doing (or in this case not doing) something for it to work.

And 

2.I didn't think of it :)

Another option I didn't think of that may work (though I've never tried it) could be to fire the script from the party join dialogue of each npc. Doesn't matter now though

40 minutes ago, subtledoctor said:

I'll try simply adding a 318 effect to block the spell for !(EA=PC).

GL, hope it works, sounds like it should

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