Skip to content

General mod Questions thread

1101113151670

Comments

  • ArunsunArunsun Member Posts: 1,592
    edited November 2017
    I had a simple question concerning scripting actions. In a mod I'm making I want to delete some wizard spells from spellbook during a dialogue, so I guess I have to use the RemoveSpellRES(S:RES*), but does that erase the spell from the spellbook? Or does it just remove a memorised instance of it, but if you rest you get it back?

    The IESDP says that: "This action removes one memorised indtance of the specified spell from the spellbook of the active creature. The spell can be an innate ability, a priest spell or a wizard spell, but must be listed in spell.ids. " then gives the example of the Fallen Paladin process:

    "IF
    Global("KR_ANTI_PALADIN_CHANGE","LOCALS",1)
    THEN
    RESPONSE #100
    RemoveSpell(PALADIN_LAY_ON_HANDS)
    RemoveSpell(PALADIN_DETECT_EVIL)
    RemoveSpell(PALADIN_PROTECTION_FROM_EVIL)
    SetGlobal("KR_ANTI_PALADIN_CHANGE","LOCALS",2)
    END"

    This obviously removes every memorised instance of it since Paladin may have more than one Detect Evil for example, but I am not sure the behaviour is the same for spells in the priest/wizard book.

    I could make a workaround casting a spell that cleanse the spellbook after the dialogue (using OPcode 172 which does erase the spell from the spellbook) if it doesn't behave like I'd want it to but it would not be quite as elegant.
  • kjeronkjeron Member Posts: 2,368
    chimeric said:

    Asked another question first, replacing: do local variables get stored in saves in EE games?

    Yes, they are attached to the Creature or Area they belong to.
    Arunsun said:

    I had a simple question concerning scripting actions. In a mod I'm making I want to delete some wizard spells from spellbook during a dialogue, so I guess I have to use the RemoveSpellRES(S:RES*), but does that erase the spell from the spellbook? Or does it just remove a memorised instance of it, but if you rest you get it back?

    Innates and priest/wizard spells are indeed handled differently.
    It cannot erase priest/wizard spells, only drain them.
    * For Sorcerers/Shamans, if they know the specified spell, it drains one use from all spells of that level, not just the specified spell.

    You are stuck using opcode 172 to remove them.
    * If these are custom spells you are removing, you also need to keep their filename to 7 characters or less.
    * If their filename is 8 characters long, it will erase the spell but leave any unspent memorizations intact. Since the v2.0 update, memorized but unknown spells permanently take up spell slots, as they cannot be removed through any means. This issue doesn't really affect Sorcerers/Shamans.
  • TranscendedOneTranscendedOne Member Posts: 25
    Is there anyone who can PM me to help fix this force spell for baldurs gate?
  • chimericchimeric Member Posts: 1,163

    Is there anyone who can PM me to help fix this force spell for baldurs gate?

    Force spell?
  • ArunsunArunsun Member Posts: 1,592
    edited November 2017
    Hey, I have been using this code to patch all spells/items/cre so that those that have an effect related to my the vanilla spells will have that effect copied, using my resource instead:

    [spoiler]

    ACTION_DEFINE_ASSOCIATIVE_ARRAY zkwsspells BEGIN
    zkwi228=> spwi228
    zkwi323=> spwi323
    zkwi327=> spwi327
    zkwi422=> spwi422
    zkwi524=> spwi524
    zkwi626=> spwi626
    zkwi628=> spwi628
    zkwi103=> spwi103
    zkwi112=> spwi112
    zkwi115=> spwi115
    zkwi117=> spwi117
    zkwi118=> spwi118
    zkwi119=> spwi119
    zkwi211=> spwi211
    zkwi217=> spwi217
    zkwi218=> spwi218
    zkwi303=> spwi303
    zkwi304=> spwi304
    zkwi308=> spwi308
    zkwi313=> spwi313
    zkwi314=> spwi314
    zkwi325=> spwi325
    zkwi404=> spwi404
    zkwi503=> spwi503
    zkwi523=> spwi523
    zkwi614=> spwi614
    zkwi615=> spwi615
    zkwi712=> spwi712
    zkwi713=> spwi713
    zkwi810=> spwi810
    zkwi812=> spwi812
    zkwi818=> spwi818
    zkwi910=> spwi910
    zkwi911=> spwi911
    zkwi922=> spwi922
    zkwi920=> spwi920
    zkwi318=> spwi318
    zkwi406=> spwi406
    zkwi522=> spwi522
    zkwi701=> spwi701
    zkwi902=> spwi902
    zkwi519=> spwi519



    END
    COPY_EXISTING_REGEXP GLOB ~.*\.spl~ ~override~
    ~.*\.itm~ ~override~
    ~.*\.cre~ ~override~
    PHP_EACH zkwsspells AS new => old BEGIN
    PATCH_FOR_EACH op IN 206 318 321 324 BEGIN
    LPF CLONE_EFFECT INT_VAR match_opcode = op STR_VAR resource = EVAL ~%new%~ match_resource = EVAL ~%old%~ END
    END
    END
    [/spoiler]

    But now when I install it, it displays "WARNING: no effect added to ..." on every spell, item and creature that do not have the OPcode I included, which drastically slows the installation down on top of displaying 10k warnings.

    Is there any way to prevent that? Or maybe I coded something wrong

    EDIT: Nevermind I figured that out myself :smiley:
  • chimericchimeric Member Posts: 1,163
    A question about Activate() and Deactivate(). In what condition are deactivated creatures? Are they simply undetectable and doing nothing, or are there some other changes? Do they process scripts? If so, how can I prevent it? I've deactivated some neutrals while I go hostile on others in the area, but these blues reappear already red, despite Stun, Deafness and Feeblemind put on them in advance, which last a couple of seconds after the activation, too. Nonetheless, they somehow learn about the shenanigans in this dimension while they are away. I haven't tried adding Blindness, but innocents scream with SHOUT.BCS.
  • The user and all related content has been deleted.
  • chimericchimeric Member Posts: 1,163
    Maze. Is there any way to bring a creature out of it? Putting a Remove Effects by Resources for the source spell above Maze on the effects list, delayed, doesn't do it.
  • semiticgoddesssemiticgoddess Member Posts: 14,903
    Only Freedom can do it.
  • kjeronkjeron Member Posts: 2,368
    edited November 2017
    Maze and Imprisonment suspend and suppress all effects on a creature - they will not trigger, expire, or function, except for Opcode 212 (Freedom). You would need a delayed Freedom effect. Maze also allows specifying a fixed duration instead of the random INT-based duration.

    The only way to target a creature with Freedom that is already mazed/imprisoned is through through the indirect effect targets (everyone, everyone except self, party, everyone except party, caster group, target group). I don't think there is any way to selectively pick a target.
  • ArdanisArdanis Member Posts: 1,736
    kjeron said:

    Maze and Imprisonment suspend and suppress all effects on a creature - they will not trigger, expire, or function, except for Opcode 212 (Freedom). You would need a delayed Freedom effect.

    This is actually how maze itself works - it applies imprisonment opcode (without removing target from party) and a freedom one, timing delayed and duration equal to INT mod from 2da.
  • kjeronkjeron Member Posts: 2,368
    edited November 2017
    Ardanis said:

    This is actually how maze itself works - it applies imprisonment opcode (without removing target from party) and a freedom one, timing delayed and duration equal to INT mod from 2da.

    I don't think it actually applies the Imprisonment opcode, at least not anymore.
    * Only Maze and the Delayed Freedom effect are attached to the creature in a save file when maze opcode is used. Even with an instant/zero-duration, Imprisonment's effect remains attached to a creature until freedom is used.
    * No immunity effects trigger for Imprisonment when Maze is used, while they do for Freedom.
  • chimericchimeric Member Posts: 1,163
    Imprisonment "kills" the target as well - you get the XP for it... But about that "suspend effects" thing. I don't think it halts running durations. I've tested with poison and other effects, there seem to be some differences between imprisoning/mazing, but the time the target is gone gets deducted from the total duration of effects. I've sent underground someone under a two-round-long effect, he returned without. I would actually very much want to know whether anything really freezes durations.
  • chimericchimeric Member Posts: 1,163
    Let me ask this now: can anything be created in-game, that is without area editing but by spawning a creature, with scripts or effects, that will interpose and block sight as a wall does? Movement - yes, I know, an invisible minion with a translucent avatar. But sight?
  • ArunsunArunsun Member Posts: 1,592
    edited November 2017
    As far as I am aware, not as such. I am not sure what's your application exactly, but you could consider implementing an invisible door that has no visual effect, on which you cannot click and triggers based on a script or something to close and open as you want it. It does involve area editing but it'll litterally behave as you described it.

    Alternatively you could imagine playing with the Farsight OPcode with type parameter to 0 so that it doesn't reveal unexplored area, combined with reduced sight range when you get close to that creature. Or if you really want something that reproduces the normal sight range, you could consider a creature that radiates a reduced sight range aura on your characters and invisible+no tooltip wizard eyes with reduced sight range regularly spawned around the nearby party members by the aforementioned creature in that area and get destroyed when you walk away.
  • chimericchimeric Member Posts: 1,163
    I've thought more or less what you write in the second paragraph. :) If it's the only way to have a wall... What the Visual Range reduction aura might be able to do, though, is to apply a cumulative-penalties effect, with Increment, not Set, and short-lasting, just 1 second. When approaching the wall, creatures would find their sight reduced gradually, when retreating, the penalties would fall off. It's supposed to be a wall of fog, too, so that's not so outrageous. Running into enemies equally blind...
  • ArunsunArunsun Member Posts: 1,592
    Well, despite chimeric being banned this thread could still prove useful for common question.

    I would like to make add an extra, custom Yuan-Ti animation (changing just the colors of the BAM files). Is it possible?
    Right now there are three yuan-ti animations (green, redish, and mage), respectively named MYU1, MYU2
    and MYU3. So if I wanted to create an extra animation, the first thing I should do is create a MYU4 (I assume these 4 letters don't really matter so long as it is 4 letters and that I should use my prefix in the final version) copy of the BAMs and alter them to make them look like I want them to.
    The other useful files in this case are:
    A MYU4.2da that references the Yuan-Ti sound palette. Then again, the name doesn't matter as long as it's 4-letter long and it's the same as the 4-letter prefix on the BAM file
    Then there's the ANIMATE.IDS which references the animations names and their offsets as well as the ANISND.IDS which references the sound table. I assume I will have to add a MYU4 line in one of the many "holes" there are in the hexadecimal offset (ED30 seems alright for example since the other Yuan-Tis are EDx0 with x being 0 1 or 2) in both these files. From what I get, the second column in the ANISND.IDS references both the BAM files, which, I assume, should contain, after the first four letters that indexes them, the same letters as the original BAM files. Then again, my understanding is that it uses the letters at indexes at to what the BAM is. For instance A1 means Overhand Swing, A2 is Backhand Swing and A3 is thrust, SC is standing still, WK is walking etc... and each weapon type has a letter of its own if the animation has a special animation for a certain weapon type (so, scimitars axes and swords in a yuan-ti's case, from what I have seen)

    Once that's done, is my animation available and functional or is there something else to do? I was wondering because some animations actually used by creatures in game are not referenced here. The one that comes to mind is the Neothelid animation, used by... the Neothelid in SoD. It's not referenced in these tables, yet it has an offset, and you set the same offset to another creature's animation field it will have the animation just as it should, though it's somewhat buggy as some files appear to be missing.
  • kjeronkjeron Member Posts: 2,368
    You will need an INI file. It will be named the same as the entry in ANIMATE.IDS, without the "0x" prefix.
    The Yuan-ti INI's are "ED00.INI", "ED10.INI", and "ED20.INI". They should be sufficiently self-explanatory once you see them.
    The line:
    resref=MYU1 is what specifies the 4-character prefix for the BAM files.
    All sounds can be specified in this file as well, no need for a separate 2da or ANISND.IDS entry. They have no prefix.
    An entry in ANIMATE.IDS is not mandatory, but good for compatibility.
  • ArunsunArunsun Member Posts: 1,592
    What would I do if you weren't there @kjeron?
    I really appreciate your help on just about everything I ask :smiley: Thank you a lot.

    Well now that I have seen what those INI files look like I have a few more questions.
    Under the general part is that type of text
    animation_type=e000
    move_scale=7
    ellipse=16
    color_blood=47
    color_chunks=0
    sound_freq=8
    personal_space=3
    cast_frame=4
    walk_sound=-
    height_offset=90


    Concerning the blood/chunks color, is there a table that relates the numbers with a color? Would've thought the 256color system but it's obviously not that since 47 is red...

    Oh and something totally unrelated (except it's the same mod), but I'm working on a sorcerer kit mod that allows the caster to choose which element his damaging spells will be. The implementation I went for was using the cast spell from list OPcode, and each spell has various copies of the original with altered damage that are cast through the a cast spell from list, very much like Spell Immunity. The issue I have is that I obviously can't put the spells into contingencies as such. Is there a workaround to that? I remember some mod allowed casting the Spell Immunity spells from contingencies if you knew Spell Immunity but have no idea how to do that.
  • kjeronkjeron Member Posts: 2,368
    Arunsun said:

    Concerning the blood/chunks color, is there a table that relates the numbers with a color? Would've thought the 256color system but it's obviously not that since 47 is red...

    For blood, it's the same colors as are available for the character (major, minor, skin, hair etc...), just open up a CRE file and browse through one of them. However, blood always uses the left-most color of each index, so most of them end up being an indistinguishable in-game. Most of the good ones for blood are in the 45-60 and 115-150 ranges.

    Chunk_color is misleading.
    0 = animation can chunk (most everyone)
    255 = animation cannot chunk (such as trolls)
    Arunsun said:

    The issue I have is that I obviously can't put the spells into contingencies as such. Is there a workaround to that? I remember some mod allowed casting the Spell Immunity spells from contingencies if you knew Spell Immunity but have no idea how to do that.

    This was a feature of the game, that was lost in the v2.0 update (https://support.baldursgate.com/issues/22370).
    The only way to fully reproduce that behavior right now would be through UI modifications. Hopefully it will be re-introduced in the v2.5 update.
  • TranscendedOneTranscendedOne Member Posts: 25
    chimeric said:

    Is there anyone who can PM me to help fix this force spell for baldurs gate?

    Force spell?
    Yeah, It's Mordenkainen's force missiles. It seems to just do single damage only when it should also being doing some AOE equal to the CL of the caster to all around 3m.
  • mummemumme Member Posts: 4
    I have a simple question (and hope for a simple answer): How can I make an innate ability to be used infinitely often (no casts per day restriction). I want to add an innate that can be cast every 10 turns or so.

    I experimented with adding the "Give Ability" effect (171) to the innate spl, but if the innate spell is disrupted, the innate disappears. I don't want to set the casting speed to zero, and the spell should be disrupt-able.

    Any ideas?
  • The user and all related content has been deleted.
  • CamDawgCamDawg Member, Developer Posts: 3,438
    Global effects on spells being instant is a useful hack. It's how the game prevents you from casting Find Familiar in the tutorial, for example.
  • mummemumme Member Posts: 4
    edited November 2017
    Thank you! I will try this. I'm aware of the shifting problem ... it's a bit annoying for the player.


    Other question: Is there a patch macro available to change entries in 2da files, if match_column has a specified entry. Something like
    ALTER_2DA:
    INT_VAR match_column
    STR_VAR match_value
    INT_VAR column
    STR_VAR new_entry
  • kjeronkjeron Member Posts: 2,368
    
    	DEFINE_PATCH_FUNCTION ALTER_2DA_ENTRY
    		INT_VAR
    			column = ~-1~
    			row = ~-1~
    			entry_case = 0
    			header_case = 0
    		STR_VAR
    			match_header = ~~
    			new_header = ~*~
    			match_entry = ~~
    			new_entry = ~*~
    	BEGIN
    		COUNT_2DA_COLS	cols
    		READ_2DA_ENTRIES_NOW ~READ~ 1
    		PATCH_IF	VARIABLE_IS_SET READ_1_0	BEGIN
    			PATCH_IF header_case = 0	BEGIN
    				PATCH_IF ~%READ_1_0%~ STRING_EQUAL ~%match_header%~	BEGIN
    					SET_2DA_ENTRY_LATER	~SET~ 1 0 ~%new_header%~
    				END
    			END	ELSE	BEGIN
    				PATCH_IF ~%READ_1_0%~ STRING_EQUAL_CASE ~%match_header%~	BEGIN
    					SET_2DA_ENTRY_LATER	~SET~ 1 0 ~%new_header%~
    				END
    			END
    		END
    		FOR (i = 3; i < READ; ++i)	BEGIN
    			PATCH_IF row = i OR row = ~-1~ BEGIN
    				FOR (j = 1; j < cols; ++j)	BEGIN
    					PATCH_IF	VARIABLE_IS_SET EVAL ~READ_%i%_%j%~	BEGIN
    						PATCH_IF column = j OR column = ~-1~	BEGIN
    							PATCH_IF entry_case = 0 BEGIN
    								PATCH_IF	EVAL ~%READ_%i%_%j%%~ STRING_EQUAL ~%match_entry%~	BEGIN
    									SET_2DA_ENTRY_LATER	~SET~ i j ~%new_entry%~
    								END
    							END	ELSE	BEGIN
    								PATCH_IF EVAL ~%READ_%i%_%j%%~ STRING_EQUAL_CASE ~%match_entry%~	BEGIN
    									SET_2DA_ENTRY_LATER	~SET~ i j ~%new_entry%~
    								END
    							END
    						END
    					END
    				END
    			END
    		END
    		SET_2DA_ENTRIES_NOW	~SET~ 1
    		PRETTY_PRINT_2DA
    	END
    								

    You can try this, but I've only done light testing with it. It can only replace existing entries, it cannot add entries where none currently exist. It will not alter the header row(2) or index column(0), as altering them often has no effect.

    column = only check specific column, -1 = all data columns
    row = only check specific row, -1 = all data rows
    entry_case: 0 = ignore case, 1 = match case
    header_case: 0 = ignore case, 1 = match case

    match_header = check for the 2da's default value (row 1, column 0)
    match_entry = check for data fields, excludes header row(2) and index column(0)
    new_header = replacement value
    new_entry = replacement value
  • [Deleted User][Deleted User] Posts: 0
    edited November 2017
    The user and all related content has been deleted.
  • mummemumme Member Posts: 4
    @kjeron , @subtledoctor: Thanks for the code! Maybe, i will do it inline similar to subtledoctor. But it's a bit more complicated. I want to change the weapprof for all kits of a given class. So I have to lookup the kits in kitlist.2da followed by a change of weapprof.2da if the column header matches ...

    btw. the global effects work great! :-)
  • [Deleted User][Deleted User] Posts: 0
    edited November 2017
    The user and all related content has been deleted.
    Post edited by [Deleted User] on
  • kjeronkjeron Member Posts: 2,368
    @subtledoctor Just want to point out that the class/kit label is actually irrelevant.
    The 6th row(PROFICIENCY) of KITLIST.2da determines which column of WEAPPROF it uses, not the label. It's possible for multiple kits to share the same column, as some classes already do.
    The column number for classes are subsequently hardcoded.
Sign In or Register to comment.