Skip to content

General mod Questions thread

16465666769

Comments

  • RatatoskrRatatoskr Member Posts: 726
    @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.
  • jasteyjastey Member Posts: 2,781
    @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.
  • RatatoskrRatatoskr Member Posts: 726
    edited May 2020
    @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.
    Post edited by Ratatoskr on
  • jasteyjastey Member Posts: 2,781
    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.
  • RatatoskrRatatoskr Member Posts: 726
    edited May 2020
    Huh, DestroySelf() works too? That's good to know.
    Post edited by Ratatoskr on
  • RatatoskrRatatoskr Member Posts: 726
    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.
  • jasteyjastey Member Posts: 2,781
    edited June 2020
    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.
  • RatatoskrRatatoskr Member Posts: 726
    edited June 2020
    @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.
  • jasteyjastey Member Posts: 2,781
    edited June 2020
    @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.)
  • RatatoskrRatatoskr Member Posts: 726
    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?
  • jasteyjastey Member Posts: 2,781
    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).
  • BCaesarBCaesar Member Posts: 480
    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.
  • BCaesarBCaesar Member Posts: 480
    BCaesar wrote: »
    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.
  • BubbBubb Member Posts: 1,005
    @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.
  • BCaesarBCaesar Member Posts: 480
    edited June 2020
    Bubb wrote: »
    @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.

    P.S. It works! Thanks.
    Post edited by BCaesar on
  • kaijyuukaijyuu Member Posts: 1
    edited June 2020
    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.
  • RatatoskrRatatoskr Member Posts: 726
    edited July 2020
    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.
    Post edited by Ratatoskr on
  • southfla79southfla79 Member Posts: 214
    What's the default clab file for a baseline mage/thief?
  • BCaesarBCaesar Member Posts: 480
    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."
  • CaedwyrCaedwyr Member Posts: 176
    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.
  • jasteyjastey Member Posts: 2,781
    Caedwyr wrote: »
    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.
  • RatatoskrRatatoskr Member Posts: 726
    @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.
  • jasteyjastey Member Posts: 2,781
    @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.
  • BCaesarBCaesar Member Posts: 480
    jastey wrote: »
    @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.
  • jasteyjastey Member Posts: 2,781
    @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.
  • BCaesarBCaesar Member Posts: 480
    jastey wrote: »
    @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.
  • _Luke__Luke_ Member, Mobile Tester Posts: 1,535
    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?
  • BubbBubb Member Posts: 1,005
    @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:
    return (constRandVal % Range) + 1 == Value
    
  • BCaesarBCaesar Member Posts: 480
    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.

    Thanks.
  • BCaesarBCaesar Member Posts: 480
    jastey wrote: »
    @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.
Sign In or Register to comment.