Skip to content

Is there a mod that assigns player’s AI scripts to simulacrum upon summon?

MyragMyrag Member Posts: 328
As in the topic, I’m playing with scs and I’d like my simulacrums to get SCS AI scripts assigned to them so that they follow melee/ranged auto attack settings.

Is there anything like that?

Comments

  • jmerryjmerry Member Posts: 3,881
    edited December 2022
    Testing ... all clone spells set the following for the clone: script name set to "COPY", all AI scripts and dialogue set to empty strings, gender set to "Illusionary". The local variables used in script customization are copied over to the clone, but the scripts that use that information are gone. And this is baked into the cloning opcode; it's not an explicit effect of the spell that can be changed.

    Guessing what you want here ... copy over the caster's combat script (the one in the second "class" slot), but leave out all of the other scripts which could otherwise do nonsensical things with character quests and the like? That might be possible, but it's definitely tricky and I don't see how to do it in the engine.

    Edit: check for "who is this a clone of" - stat 138. Check for "what script does player N have" ... not directly. I'm pretty sure I'd have to edit the combat scripts themselves to set a local variable, because that's not a detectable stat otherwise. Then it's a matter of setting up a script to change the clone's script. Doable, but only to AI scripts on a specified whitelist.
    Post edited by jmerry on
  • MyragMyrag Member Posts: 328
    JohnBob wrote: »

    I did, initially I thought it's perfect for what I need, but it throws error when installing on my GOG BG2EE version of the game. Tried on the clean install too. Will report to @morpheus562 with the error in his dedicated thread.

    @jmerry I'm not a modder, but I did understand most of what you've said, I'm not sure what would be easier, a small mod that allows auto-attacking with equipped weapon to a simulacrum that is smart enough to target enemies that actually can be hit, or a mod that copies assigned AI script to your character. But I thought that I'd ask here, maybe there is something like that.
  • jmerryjmerry Member Posts: 3,881
    I'm not aware of anything like that out there, but it has piqued my interest - I might make it now. And having thought about it a bit more, I don't even need to know which player the clone belongs to. Have all party member combat scripts set a local variable, encoding which script that is in its value. Add an effect to the PROJIMAG and SIMULACR spells, filtered by allegiance, that assigns a script to the clone (at a slight delay, because SCS has some encounters taht clone the party and then make the clones hostile). That script then uses the local variable to replace it with the caster's combat script. Okay. This one's slated for the next version of my tweak mod.
  • morpheus562morpheus562 Member Posts: 304
    Myrag wrote: »
    JohnBob wrote: »

    I did, initially I thought it's perfect for what I need, but it throws error when installing on my GOG BG2EE version of the game. Tried on the clean install too. Will report to @morpheus562 with the error in his dedicated thread.

    @jmerry I'm not a modder, but I did understand most of what you've said, I'm not sure what would be easier, a small mod that allows auto-attacking with equipped weapon to a simulacrum that is smart enough to target enemies that actually can be hit, or a mod that copies assigned AI script to your character. But I thought that I'd ask here, maybe there is something like that.

    I responded on my main thread, but you need to install my main ai scripts first. Errors will not be thrown when then.
  • jmerryjmerry Member Posts: 3,881
    Well, crud. You know when I said that clones inherit local variables of their original? I was wrong. All of those get blanked. That makes copying those over a lot harder. Also, assigning .BS scripts (such as "Cleric Controlled" or "Thief Aggressive") is flat-out impossible with script actions; it's BCS or nothing, and that might as well be BDDEFAI.

    Well, all right. I can still build that. Assign an intermediate script to set the control variables and then set the default AI. One block to start with, and then I run a double-layered loop:
    IF
    	Name("COPY",Myself) // I think I'm a clone now
    	CheckStat(Myself,%n%,138) // Who am I a clone of? 0-5 matches player 1-6
    	TriggerOverride(Player%pnum%,Global("%var%","LOCALS",%val%)) // pnum = n + 1
    THEN
    	RESPONSE #100
    		SetGlobal("%var%","LOCALS",%val%)
    		Continue()
    END
    
    // Add this block to the beginning of the script for each player/variable/value combination
    
    66 iterations for standard BDDEFAI. And yes, I have those comments in the official version of this BAF file.

    So my original intent failed, but I can still give the clone BDDEFAI with the same control options as the original. And in theory, extend it to a mod that alters those options.
    SCS actually uses the same control variables as standard BDDEFAI for its "ease-of-use AI", but changes their meanings and interface labels. The clone should thus inherit settings from the original without any extra work on my part.

    ... Oh. Huh. If I apply BDDEFAI without any modifications, the clone takes no action. I actually need to edit the script to replace all of those InParty(Myself) checks with broader allegiance checks.

    Anyway, nearly there with the next version of my tweak mod. It shouldn't be much longer before I'm ready to release.
  • morpheus562morpheus562 Member Posts: 304
    jmerry wrote: »
    Well, crud. You know when I said that clones inherit local variables of their original? I was wrong. All of those get blanked. That makes copying those over a lot harder. Also, assigning .BS scripts (such as "Cleric Controlled" or "Thief Aggressive") is flat-out impossible with script actions; it's BCS or nothing, and that might as well be BDDEFAI.

    Well, all right. I can still build that. Assign an intermediate script to set the control variables and then set the default AI. One block to start with, and then I run a double-layered loop:
    IF
    	Name("COPY",Myself) // I think I'm a clone now
    	CheckStat(Myself,%n%,138) // Who am I a clone of? 0-5 matches player 1-6
    	TriggerOverride(Player%pnum%,Global("%var%","LOCALS",%val%)) // pnum = n + 1
    THEN
    	RESPONSE #100
    		SetGlobal("%var%","LOCALS",%val%)
    		Continue()
    END
    
    // Add this block to the beginning of the script for each player/variable/value combination
    
    66 iterations for standard BDDEFAI. And yes, I have those comments in the official version of this BAF file.

    So my original intent failed, but I can still give the clone BDDEFAI with the same control options as the original. And in theory, extend it to a mod that alters those options.
    SCS actually uses the same control variables as standard BDDEFAI for its "ease-of-use AI", but changes their meanings and interface labels. The clone should thus inherit settings from the original without any extra work on my part.

    ... Oh. Huh. If I apply BDDEFAI without any modifications, the clone takes no action. I actually need to edit the script to replace all of those InParty(Myself) checks with broader allegiance checks.

    Anyway, nearly there with the next version of my tweak mod. It shouldn't be much longer before I'm ready to release.
    No need to continue on as my Enhanced Powergaming Scripts already does this. My scripts replaces BDDEFAI with new scripts and assigns similar ones to simulacrums. This will allow simulacrums to toggle multiple settings via hotkeys available to the player as well as the ability to pre-buff along with the rest of the characters. The error noted above was the user tried to do the simulacrums without having my scripts present first.
  • jmerryjmerry Member Posts: 3,881
    No need to continue on as my Enhanced Powergaming Scripts already does this. My scripts replaces BDDEFAI with new scripts and assigns similar ones to simulacrums...

    I've already written mine, and tested to ensure it's functional. It's in. Even if all the work I put into fixing the version that didn't end up working out was wasted. Now your clones can be exactly as dumb as the original. Why, yes, projected image, you should switch to your sling because the caster had "prefer ranged weapons" selected. And you should cast a stoneskin because I didn't turn off "Use defensive spells" for testing purposes.

    Your version of things requires the use of your altered scripts, which as your mod title says are aimed at a "powergaming" mindset. My version takes whatever's already there and copies it over with the bare minimum changes required to make it functional. Which means it's compatible with the vanilla game scripts, my own slight improvements, the SCS "ease of use AI", and anything else that uses the same AI control variables set in the customization menu. Even supporting something that used a UI mod to set up different AI control variables would be as simple as putting together an alternate 2DA to draw the list from.

    Different philosophy, different appeal.
Sign In or Register to comment.