@jastey getting characters to leave originally with EscapeAreaMove is working fine. I'm wondering if I can get a joinable NPC like Anomen to move from one area to a completely different area on a timer while being out of your party the whole time. I tried EscapeAreaMove and MoveBetweenAreas in bbaldur and that didn't do anything.
Alternately, destroy/create would work if I could sure of creating the exact same version of the NPC that left.
If this isn't possible, I have managed a workaround but this would be less clunky.
@Ratatoskr
Ah, I didn't get that it is a joinable NPC. I think the problem is that both actions need to be performed by the area the NPC is in.
Do not create joinable characters anew, as it would spawn them as the raw cre file without any canges/items the player left him with.
For joinable NPCs you can use MoveGlobal().
Anomen should be in the GAM file from the start. The way to go is to MoveGlobal() him to the area of destiny. The game uses this for e.g. Minsc inside baldur.bcs. If he wasn't in party before it would be safe to MakeGlobal() him first but it shouldn't be necessary for the original NPCs (as they are in the GAM, but for a mod NPC it would be needed). Then you can use what is also used e.g. for Minsc in baldur.bcs:
IF
Global("MinscByeBye","GLOBAL",2)
THEN
RESPONSE #100
MoveGlobal("AR0400","Minsc",[519.529]) // Minsc
END
(This script block is not a good example, though - no check variable... I'm surprised it doesn't block the rest of the script.)
Jahira is being moved to the PC after her absence with MoveGlobalObject:
IF
PartyRested()
GlobalTimerExpired("JaheiraReturn","GLOBAL")
Global("JaheiraReturns","GLOBAL",0)
THEN
RESPONSE #100
SetGlobal("JaheiraReturns","GLOBAL",1)
MoveGlobalObject("Jaheira",Player1) // Jaheira
END
SoD uses this a lot to move NPCs to the new camps etc., too.
@jastey Thank you. I think that should solve my problem. Just to clarify a couple things, can the initial leaving still use EscapeAreaMove as usual? Or does that need to use MoveGlobal as well?
And then I would just need to put move global object Anomen etc. in bbaldur or in the area script where he is to send him back?
Edit: nevermind, I got it. That solved all my problems, thank you again.
Just to not let the questions hang in case someone else is reading this: with an NPC that is either in the GAM file of was added to it using MakeGlobal() before, you can just let him wander off (EscapeArea() or even DestroySelf()), and then call him back with MoveGlobal() the moment you want to have him back.
So, I find myself in rather desperate need of help again. I've run into a weird glitch where baldur.bcs just stops registering after certain cutscenes from other mods. I lost part of it after one of the willowisp cutscenes and I seem to have lost the whole thing after Tiax reappears at the end of the Spellhold fight with that mod. The game just isn't running anything from that script.
Does anyone know what causes this and most importantly, how I can fix it? My mod shouldn't be making it happen, but it's breaking my code and possibly my game. If I can just code something into my mod to stop this in the future, that would be ideal.
What exactly do you mean? You are patching the baldur.bcs but your script blocks do not get executed?
Could it be an "always true" looping script block blocking yours? To detect that I'd suggest installing the DebugStutter Tool (link) to see whether you have a looping baldur.bcs script block in your game after the mentioned cutscenes.
@jastey Yes, I think that's what I mean. I've extended bottom on baldur.bcs and everything works fine until those cutscenes run. Then baldur.bcs just stops executing anything. I tried uninstalling my mod and the same thing happened so I'm fairly certain the issue is with one of those cut scenes.
As far as I can tell everything else is still working perfectly. I didn't even realize this had happened at first since I don't use baldur.bcs very often.
EDIT: looks like that is definitely the problem. I have a block 574 and 374/372 running continually depending on which problem save I load. I'll message whichever mods those belong to if I can. Thank you as always.
@Ratatoskr good finds on the looping script blocks!
One way to prevent this from blocking your mod is to add Continue() at the end of your script blocks and do EXTEND_TOP instead of patching to the end of the file.
(But do not forget the Continue() just to be sure.)
Thanks @jastey I could definitely switch our install to extend top for the future. Out of curiosity, does continue () stop other mods from blocking mine or is that something I'd put at the end of my code to make sure that I don't break someone else's?
The latter: with Continue() at the end you make sure your block runs through no matter what so yours will never block any other. It's especially important if you EXTEND_TOP to area scripts that might have an OnCreation() trigger in their first block. But it's mainly a safety feature (imagine one of the looping blocks you identified would have been added at the top of the file - you get the idea).
Hi all,
I've got a question. I've added an item that does protection from spell school, but it also adds an animation (the swirly white lights that circle in 3d around the person). I want to make the animation go away (I want to have the protection without the animation).
Is there any way to do that? I assume immunity to specific animation might do that, but I don't know which animation file it would be.
Hi all,
I've got a question. I've added an item that does protection from spell school, but it also adds an animation (the swirly white lights that circle in 3d around the person). I want to make the animation go away (I want to have the protection without the animation).
Is there any way to do that? I assume immunity to specific animation might do that, but I don't know which animation file it would be.
Thanks.
It's the animation effect that the Cloak of Mirroring gives you. I want to have an item do that, but turn the effect off, and unfortunately the animation seems to be attached to the Protection-from-spell effect.
@BCaesar: It's a hardcoded visual effect which is applied by the majority of the spell-related protection opcodes. Looks like the only graceful way of disabling the graphic is to apply Opcode #291 to the target creature, as described by the IESDP. Unfortunately, this has the side effect of disabling the animations for all of the described opcodes - unless you want to go to the trouble of adding the graphics back to each spell manually.
As for the graphics files, these protection opcodes are hardcoded to use "spturni2" and "spmagglo", though I think nothing short of the above opcode or deleting them from the game will do anything.
@BCaesar: It's a hardcoded visual effect which is applied by the majority of the spell-related protection opcodes. Looks like the only graceful way of disabling the graphic is to apply Opcode #291 to the target creature, as described by the IESDP. Unfortunately, this has the side effect of disabling the animations for all of the described opcodes - unless you want to go to the trouble of adding the graphics back to each spell manually.
As for the graphics files, these protection opcodes are hardcoded to use "spturni2" and "spmagglo", though I think nothing short of the above opcode or deleting them from the game will do anything.
Thanks! It will just disable the animations for that one creature though, not every creature? That's not so bad, in fact I think that'll do exactly what I'm looking for. Conveniently the creature involved is Bodhi as an NPC and she can't use most items anyways.
I'm having trouble with specialist mage bonus spell slots; specifically, my Swashbuckler/mage multiclass gnome is getting them and I don't want them to (I presume the engine thinks any gnome mage that's multiclassed must be an illusionist...).
My preferred solution is just to eliminate the bonus spell slots entirely and then add an effect to the specialist mage kits to re-add them. I know that an effect won't be properly multiplied by a ring of wizardry, but that's good enough for me. I just need to know how to eliminate the original bonus spell slots.
Hi folks, I've got another issue I hope you can help me with, specially with setting the chapters for EET. As far as I can tell, I'm using the same code as every other mod, but my chapters are not setting properly in the normal game.
I have this code in my setup file:
ALWAYS
ACTION_IF NOT VARIABLE_IS_SET bg2_chapter BEGIN
ACTION_IF GAME_IS ~eet~ BEGIN
OUTER_SET bg2_chapter = 12
END ELSE BEGIN
OUTER_SET bg2_chapter = 0
END
OUTER_FOR (i=1; i<=10; i=i+1) BEGIN
OUTER_SET bg2_chapter = bg2_chapter + 1
OUTER_SPRINT name_source ~bg2_chapter_%i%~
OUTER_SET EVAL ~%name_source%~ = bg2_chapter
END
END
END
And I put my chapter globals in scripts with this style: Global("Chapter","GLOBAL",%bg2_chapter_6%). That should theoretically read as Global("Chapter","GLOBAL",6). But when I check my install, I get stuff like Global("Chapter","GLOBAL",158701) instead.
Is there a step I'm missing? I've compared my code to my other installed mods that register properly and it all looks the same.
Edit: Nevermind, I figured it out. I just needed EVALUATE BUFFER on the script files and the dialogue files. I was missing the scripts b/c the mod I was using for reference didn't have any with chapter triggers.
Hi all, we have a problem that pops up here and there. We update our mod and add a new conversation triggered by a script, but the script won't read. So for example I make a new dialogue with Aerie, make requirements for that to dialogue to happen, but when I install the updated mod and load my save it won't work, even though all the requirements are met. It's like the game simply refuses to read the script.
There doesn't seem to be any rhyme or reason to it. Most of the time I can code a new talk and update the mod and it plays fine, but every so often one just refuses to play (and yes I'm absolutely sure that all the requirements to trigger the talk are met, but it still doesn't trigger).
However, if I load an older save from before I first got that NPC in my party and then do it the talk triggers fine. So it always works in a new game, but sometimes breaks in an old save.
Is there a way to fix that? Other than just add a disclaimer, "This mod works best if you start a new game."
I can't speak to the specifics, but I remember this being an issue back in the old pre-EE engine. I think that several of @LavaDelVortel 's mods have an option to update savegames as well and I would thin that was meant to deal with this type of scenario.
I can't speak to the specifics, but I remember this being an issue back in the old pre-EE engine. I think that several of @LavaDelVortel 's mods have an option to update savegames as well and I would thin that was meant to deal with this type of scenario.
@Caedwyr
The savegame update is for the worldmap, I think.
@BCaesar
If the NPC has the script assigned the script block should run. Do you change the assigned scripts of the NPC with your mod? That would be an explanation why it only works if the NPC was not in party yet. For a more detailed reply I'd need to see the code.
@jastey Nothing in our mod should change the assigned scripts of the NPCs. All we do is extend bottom on all the existing script files.
Here's an example of one of the scripts @BCaesar was talking about.
//Trigger for Edwin/Aerie Wing Cutscene
IF
InParty("Edwin")
InParty("Aerie")
HaveKnownSpell(WIZARD_POLYMORPH_SELF)
Global("_bEdwinAerieWings","GLOBAL",0)
THEN
RESPONSE #100
SetGlobal("_bEdwinAerieWings","GLOBAL",1)
SetGlobalTimer("_bAWingTimer","GLOBAL",TEN_DAYS)
END
IF
InParty("Edwin")
InParty("Aerie")
Global("_bEdwinAerieWings","GLOBAL",1)
GlobalTimerExpired("_bAWingTimer","GLOBAL")
THEN
RESPONSE #100
SetGlobal("_bEdwinAerieWings","GLOBAL",2)
END
....It goes on from here, from you get the gist. The initial part just never triggered for some of his saves.
@Ratatoskr@BCaesar I would start debugging by commenting out triggers, e.g. the "HaveKnownSpell(WIZARD_POLYMORPH_SELF)" and see whether it triggers then, in case you haven't done already.
@Ratatoskr@BCaesar I would start debugging by commenting out triggers, e.g. the "HaveKnownSpell(WIZARD_POLYMORPH_SELF)" and see whether it triggers then, in case you haven't done already.
I've had cases where I've removed every trigger down to InParty and it still didn't trigger with the old save. But in a new game the same global triggers fine. So it's something about certain older saves rather than anything in the script itself. I was wondering if there was some way to force the game to read a script file.
@BCaesar I never experienced this. If the script is attached to the NPC and the triggers are met the script block is executed. I know you checked this but my first guess would be that in your old saves the script in question is not set for the NPC for some reason.
@BCaesar I never experienced this. If the script is attached to the NPC and the triggers are met the script block is executed. I know you checked this but my first guess would be that in your old saves the script in question is not set for the NPC for some reason.
It's been a recent thing for me; I only ever had one other time where this happened (it was a rest scene in the Viconia friendship mod years ago). It might just be because I uninstall and install mods too much. I've found I can end up breaking old saves if I uninstall and install mods a lot. I've got a several-years-old playthrough where our Clara NPC periodically and randomly leaves the party (luckily she asks each time), and no amount of searching has ever uncovered why. There doesn't seem to be any reason for it (her name in that save is also no longer Clara it's "Running block 20 of TTweapon.bcs) .
So I guess the lesson is if I stop randomly futzing with the fabric of creation and I'll stop breaking things.
Does anybody know (notably @Bubb ) if these triggers return the same value per script pass or each time they get evaluated?
For instance, if two or more consecutive script blocks contain "RandomNum(2,1)" and the RNG selects 1, then both "RandomNum()" triggers will return true, right?
@Luke93: Yes, the random number generation is seeded against a variable that is constant through a script pass. That means, if you use the same range value for the triggers, they will generate the same roll.
The random number gen is standard fare for these triggers. RandomNum() can be summarized as:
Hi all, I've got a question.
Is there any way to add a spell to someone's spell book mid-game?
For example as a quest reward I want to give Dorn Call Lightning as a level 3 spell.
I know how to add it as a special ability, but I'd rather put it in his spell book.
@BCaesar I never experienced this. If the script is attached to the NPC and the triggers are met the script block is executed. I know you checked this but my first guess would be that in your old saves the script in question is not set for the NPC for some reason.
I figured out how to fix this. If something is not triggered I just save and load and then everything functions normally again. It only ever happens the first time I load a game after starting BG2.
Comments
Alternately, destroy/create would work if I could sure of creating the exact same version of the NPC that left.
If this isn't possible, I have managed a workaround but this would be less clunky.
Ah, I didn't get that it is a joinable NPC. I think the problem is that both actions need to be performed by the area the NPC is in.
Do not create joinable characters anew, as it would spawn them as the raw cre file without any canges/items the player left him with.
For joinable NPCs you can use MoveGlobal().
Anomen should be in the GAM file from the start. The way to go is to MoveGlobal() him to the area of destiny. The game uses this for e.g. Minsc inside baldur.bcs. If he wasn't in party before it would be safe to MakeGlobal() him first but it shouldn't be necessary for the original NPCs (as they are in the GAM, but for a mod NPC it would be needed). Then you can use what is also used e.g. for Minsc in baldur.bcs:
IF
Global("MinscByeBye","GLOBAL",2)
THEN
RESPONSE #100
MoveGlobal("AR0400","Minsc",[519.529]) // Minsc
END
(This script block is not a good example, though - no check variable... I'm surprised it doesn't block the rest of the script.)
Jahira is being moved to the PC after her absence with MoveGlobalObject:
IF
PartyRested()
GlobalTimerExpired("JaheiraReturn","GLOBAL")
Global("JaheiraReturns","GLOBAL",0)
THEN
RESPONSE #100
SetGlobal("JaheiraReturns","GLOBAL",1)
MoveGlobalObject("Jaheira",Player1) // Jaheira
END
SoD uses this a lot to move NPCs to the new camps etc., too.
And then I would just need to put move global object Anomen etc. in bbaldur or in the area script where he is to send him back?
Edit: nevermind, I got it. That solved all my problems, thank you again.
Does anyone know what causes this and most importantly, how I can fix it? My mod shouldn't be making it happen, but it's breaking my code and possibly my game. If I can just code something into my mod to stop this in the future, that would be ideal.
Could it be an "always true" looping script block blocking yours? To detect that I'd suggest installing the DebugStutter Tool (link) to see whether you have a looping baldur.bcs script block in your game after the mentioned cutscenes.
As far as I can tell everything else is still working perfectly. I didn't even realize this had happened at first since I don't use baldur.bcs very often.
EDIT: looks like that is definitely the problem. I have a block 574 and 374/372 running continually depending on which problem save I load. I'll message whichever mods those belong to if I can. Thank you as always.
One way to prevent this from blocking your mod is to add Continue() at the end of your script blocks and do EXTEND_TOP instead of patching to the end of the file.
(But do not forget the Continue() just to be sure.)
I've got a question. I've added an item that does protection from spell school, but it also adds an animation (the swirly white lights that circle in 3d around the person). I want to make the animation go away (I want to have the protection without the animation).
Is there any way to do that? I assume immunity to specific animation might do that, but I don't know which animation file it would be.
Thanks.
It's the animation effect that the Cloak of Mirroring gives you. I want to have an item do that, but turn the effect off, and unfortunately the animation seems to be attached to the Protection-from-spell effect.
As for the graphics files, these protection opcodes are hardcoded to use "spturni2" and "spmagglo", though I think nothing short of the above opcode or deleting them from the game will do anything.
Thanks! It will just disable the animations for that one creature though, not every creature? That's not so bad, in fact I think that'll do exactly what I'm looking for. Conveniently the creature involved is Bodhi as an NPC and she can't use most items anyways.
P.S. It works! Thanks.
My preferred solution is just to eliminate the bonus spell slots entirely and then add an effect to the specialist mage kits to re-add them. I know that an effect won't be properly multiplied by a ring of wizardry, but that's good enough for me. I just need to know how to eliminate the original bonus spell slots.
I have this code in my setup file:
ACTION_IF NOT VARIABLE_IS_SET bg2_chapter BEGIN
ACTION_IF GAME_IS ~eet~ BEGIN
OUTER_SET bg2_chapter = 12
END ELSE BEGIN
OUTER_SET bg2_chapter = 0
END
OUTER_FOR (i=1; i<=10; i=i+1) BEGIN
OUTER_SET bg2_chapter = bg2_chapter + 1
OUTER_SPRINT name_source ~bg2_chapter_%i%~
OUTER_SET EVAL ~%name_source%~ = bg2_chapter
END
END
END
And I put my chapter globals in scripts with this style: Global("Chapter","GLOBAL",%bg2_chapter_6%). That should theoretically read as Global("Chapter","GLOBAL",6). But when I check my install, I get stuff like Global("Chapter","GLOBAL",158701) instead.
Is there a step I'm missing? I've compared my code to my other installed mods that register properly and it all looks the same.
Edit: Nevermind, I figured it out. I just needed EVALUATE BUFFER on the script files and the dialogue files. I was missing the scripts b/c the mod I was using for reference didn't have any with chapter triggers.
There doesn't seem to be any rhyme or reason to it. Most of the time I can code a new talk and update the mod and it plays fine, but every so often one just refuses to play (and yes I'm absolutely sure that all the requirements to trigger the talk are met, but it still doesn't trigger).
However, if I load an older save from before I first got that NPC in my party and then do it the talk triggers fine. So it always works in a new game, but sometimes breaks in an old save.
Is there a way to fix that? Other than just add a disclaimer, "This mod works best if you start a new game."
@Caedwyr
The savegame update is for the worldmap, I think.
@BCaesar
If the NPC has the script assigned the script block should run. Do you change the assigned scripts of the NPC with your mod? That would be an explanation why it only works if the NPC was not in party yet. For a more detailed reply I'd need to see the code.
Here's an example of one of the scripts @BCaesar was talking about.
IF
InParty("Edwin")
InParty("Aerie")
HaveKnownSpell(WIZARD_POLYMORPH_SELF)
Global("_bEdwinAerieWings","GLOBAL",0)
THEN
RESPONSE #100
SetGlobal("_bEdwinAerieWings","GLOBAL",1)
SetGlobalTimer("_bAWingTimer","GLOBAL",TEN_DAYS)
END
IF
InParty("Edwin")
InParty("Aerie")
Global("_bEdwinAerieWings","GLOBAL",1)
GlobalTimerExpired("_bAWingTimer","GLOBAL")
THEN
RESPONSE #100
SetGlobal("_bEdwinAerieWings","GLOBAL",2)
END
....It goes on from here, from you get the gist. The initial part just never triggered for some of his saves.
I've had cases where I've removed every trigger down to InParty and it still didn't trigger with the old save. But in a new game the same global triggers fine. So it's something about certain older saves rather than anything in the script itself. I was wondering if there was some way to force the game to read a script file.
It's been a recent thing for me; I only ever had one other time where this happened (it was a rest scene in the Viconia friendship mod years ago). It might just be because I uninstall and install mods too much. I've found I can end up breaking old saves if I uninstall and install mods a lot. I've got a several-years-old playthrough where our Clara NPC periodically and randomly leaves the party (luckily she asks each time), and no amount of searching has ever uncovered why. There doesn't seem to be any reason for it (her name in that save is also no longer Clara it's "Running block 20 of TTweapon.bcs) .
So I guess the lesson is if I stop randomly futzing with the fabric of creation and I'll stop breaking things.
For instance, if two or more consecutive script blocks contain "RandomNum(2,1)" and the RNG selects 1, then both "RandomNum()" triggers will return true, right?
The random number gen is standard fare for these triggers. RandomNum() can be summarized as:
Is there any way to add a spell to someone's spell book mid-game?
For example as a quest reward I want to give Dorn Call Lightning as a level 3 spell.
I know how to add it as a special ability, but I'd rather put it in his spell book.
Thanks.
I figured out how to fix this. If something is not triggered I just save and load and then everything functions normally again. It only ever happens the first time I load a game after starting BG2.