Skip to content

General mod Questions thread

1626365676870

Comments

  • kjeronkjeron Member Posts: 2,367
    @Luke93 Correct on both.
  • _Luke__Luke_ Member, Mobile Tester Posts: 1,535
    edited October 2019
    kjeron wrote: »
    Aquadrizzt wrote: »
    @kjeron, this is great information. I was going to use it for a weapon that always dealt 4d8 "true" (ish) damage, but was not affected by damage modifiers, special AC, or resistance. I know I can turn Strength off directly. Currently I just have type = 0 [None]; diceNum = 4; diceSize = 8 and disabled the Strength damage bonus. Will that produce the desired effect?
    You could just set all the damage fields to zero, and deal the damage through an added op12 effect. (If all the damage fields are zero, the inventory will also display the damage range of the first op12 effect on the header in the inventory.)

    Are you saying that, for instance, an unmodded quarterstaff (i.e., STAF01.itm) is functionally equivalent to the following edited quarterstaff?
    COPY_EXISTING	~STAF01.itm~	~override/STAF01B.itm~
    	LPF ALTER_ITEM_HEADER
    	INT_VAR
    		dicenumber = 0
    		dicesize = 0
    		damage_type = 0	// NONE
    	END
    
    	LPF ADD_ITEM_EFFECT
    	INT_VAR
    		type = 1	// Melee header
    		opcode = 12	// Damage
    		timing = 1
    		dicenumber = 1
    		dicesize = 6
    	END
    BUT_ONLY
    
  • kjeronkjeron Member Posts: 2,367
    Equivalent no. That modified quarterstaff would not receive any damage bonuses (Strength, Bless, Bracers, etc...), nor be subject to the critical hit or backstab multipliers, though critical hit damage could be added through op341. It also would not be influenced by the attackers luck, but instead negatively by the defenders luck.
  • The user and all related content has been deleted.
  • polymorphedsquirrelpolymorphedsquirrel Member Posts: 114
    Is there a way to access a tra entry under a non-literal key, something like @%var% (this does not work)?
  • kjeronkjeron Member Posts: 2,367
    Is there a way to access a tra entry under a non-literal key, something like @%var% (this does not work)?
    (AT var)
     // the parenthesis are a part of it
    
    OUTER_SPRINT var1 (AT var2)
    SPRINT var1 (AT var2)
    SAY NAME1 (AT var)
    ... RESOLVE_STR_REF ( (AT var) )
    etc...
    
  • polymorphedsquirrelpolymorphedsquirrel Member Posts: 114
    Great thanks, I don't know how I missed it!
  • BubbBubb Member Posts: 1,001
    I have a very simple png - it is a modification of STONSLOT.BAM that adds a 1-pixel green border around the inside:
    2306we38wc43.png

    When I attempt to view it as a standard BAM element in-game I get horrid artifacts:
    mz8wgliqpt2e.png

    Seems to have something to do with transparency. I've run into this sort of situation before, but I've always been able to stumble my way out of it by switching the png to indexed mode, or using ffmpeg to do a palette gen before using Near Infinity to go back to BAM.

    I can't get it to render correctly this time around. @argent77 might have an idea, mayhaps?
  • argent77argent77 Member Posts: 3,439
    Bubb wrote: »
    I have a very simple png - it is a modification of STONSLOT.BAM that adds a 1-pixel green border around the inside:

    When I attempt to view it as a standard BAM element in-game I get horrid artifacts:

    Seems to have something to do with transparency. I've run into this sort of situation before, but I've always been able to stumble my way out of it by switching the png to indexed mode, or using ffmpeg to do a palette gen before using Near Infinity to go back to BAM.

    I can't get it to render correctly this time around. @argent77 might have an idea, mayhaps?

    I can't really say. Maybe the green color is playing tricks with the game, since it's normally used as transparent color for paletted graphics. Did you try with different shades of green?

    I've done a quick test myself, which looks fine so far (using BAM V2):
    8r3idcpfk2dv.jpg
  • BubbBubb Member Posts: 1,001
    @argent77: I completely overlooked that (0, 255, 0) is transparency in BAM V1. I did a color replace to bump it down to 254 and it now renders correctly:
    umo8ku7sr76t.png

    Thanks! :)
  • _Luke__Luke_ Member, Mobile Tester Posts: 1,535
    edited October 2019
    Bubb wrote: »
    Now, with that change made:
    r99byl98wz6h.gif

    OK, Here we go again.

    Why does the kobold not attack after switching to its melee weapon? You can notice this issue in your gif – Feedback messages pop up in the combat log but the creature isn't really attacking (e.g., it doesn't swing its weapon).

    EDIT: it seems to be related to that particular script, I didn't manage to replicate it with another one...
    Post edited by _Luke_ on
  • _Luke__Luke_ Member, Mobile Tester Posts: 1,535
    edited October 2019
    kjeron wrote: »
    Luke93 wrote: »
    Separately, speaking of opcode #331: how is 'caster level' (special = 2) related to the entries in the 2DA file? Suppose I'm a level 17 sorcerer and my 2DA file has 9 entries: will I summon 17 creatures randomly chosen from the 9 listed in my 2DA (provided the summoning cap allows me to summon 17 creatures of course...)?
    It will summon creatures until their combined power level exceeds caster level.
    For op331 (in Spell/Item):
    Special=0: Summon amount equal to (Param1 + DiceNum(d)DiceSize))
    Special=1: Summon amount equal to (Param1 + DiceNum(d)DiceSize))
    Special=2: Summon until power level equals/exceeds "Caster Level"

    For op331(in EFF):
    Special=0: Summon until power level equals/exceeds Param1
    Special=1: Summon amount equal to (Param1 + DiceNum(d)DiceSize))
    Special=2: Summon until power level equals/exceeds "Caster Level" field of EFF

    For op127 (in Spell/Item):
    Special=0: Summon until power level equals/exceeds Param1
    Special=1: Summon amount equal to Param1
    Special=2: Summon until power level equals/exceeds "Caster Level"

    For op127 (in EFF):
    Special=0: Summon until power level equals/exceeds Param1
    Special=1: Summon amount equal to (Param1 + DiceNum(d)DiceSize))
    Special=2: Summon until power level equals/exceeds "Caster Level" field of EFF

    OK, I've got another question about this opcode:

    Is the resource field functional? If I leave param#2 at 0 and set the resource field to a custom 2DA file, the game crashes to desktop....
  • kjeronkjeron Member Posts: 2,367
    Both accept custom 2da files in the resource field, if they are crashing it means that 2da file is not setup correctly (or doesn't exist). Both opcodes also have different setups for their 2da files - one file will not work for both.
    op127 format can be seen in BG1/2EE referenced 2da files, op331 format can be seen in IWDEE referenced 2da files.
  • _Luke__Luke_ Member, Mobile Tester Posts: 1,535
    edited October 2019
    kjeron wrote: »
    Both accept custom 2da files in the resource field, if they are crashing it means that 2da file is not setup correctly (or doesn't exist). Both opcodes also have different setups for their 2da files - one file will not work for both.
    op127 format can be seen in BG1/2EE referenced 2da files, op331 format can be seen in IWDEE referenced 2da files.

    It seems the last row must be a blank row... However, that's not necessary if you APPEND it to SMTABLES.2da.....
  • RaduzielRaduziel Member Posts: 4,714
    Hey

    I want to make a creature immune to a spell if its Strenght is equal or greater than 18/75

    How do I do it? Should I apply 318 twice (one 18 and another one for 75, in that order) or just need it once (for the 75).

    My goal is to prevent Strength of One of reducing a target's Str.

    Thanks.
  • switswit Member, Translator (NDA) Posts: 495
    edited October 2019
    @Raduziel, I would add it as 2 318 effects:
    - str >= 19
    - exceptional >= 75 (just to be sure you could add additional str == 18 check here and take 2 rows into account at the same time via 0x103 relation, although I don't think it's necessary in this case)
    https://gibberlings3.github.io/iesdp/files/2da/2da_bgee/splprot.htm

    edit: can't read, fixed
  • RaduzielRaduziel Member Posts: 4,714
    @swit Thanks. But why check against 19 in the first row instead of 18?
  • switswit Member, Translator (NDA) Posts: 495
    edited October 2019
    edit: because >= 18 as a separate effect means you're blocking against >= 18, regardless of the exceptional bonus (that second effect won't be checked at all if first effect is matched)
    Post edited by swit on
  • RaduzielRaduziel Member Posts: 4,714
    swit wrote: »
    edit: because >= 18 as a separate effect means you're blocking against >= 18, regardless of the exceptional bonus (that second effect won't be checked at all if first effect is matched)

    Makes sense. Thanks!
  • RaduzielRaduziel Member Posts: 4,714
    Can someone enlight me on how do I make the check for Exceptional Strength?

    For STR >= 19 I can use parameter 1 = 19, parameter 2 = 124

    But NI doesn't have an entry for exceptional strength and I'm kind of lost with splprot.2da

    Thanks in advance.
  • _Luke__Luke_ Member, Mobile Tester Posts: 1,535
    edited October 2019
    Raduziel wrote: »
    But NI doesn't have an entry for exceptional strength and I'm kind of lost with splprot.2da

    Add it using this function (courtesy of @argent77 )
    /**
     * Adds a new entry to SPLPROT.2DA and returns its index. If an identical entry already exists it will return 
     * the index of that entry instead.
     * INT_VAR stat     A code from STATS.IDS or an extended stat code starting at 0x100 (256).
     * STR_VAR value    Either a numeric value that is evaluated by "stat", or a default value "*" for specific stats.
     *                  (Note: "-1" indicates a user-defined value.)
     * STR_VAR relation Specifies how to evaluate the value.
     *                  (Note: Not all extended stats require a relation code. Use "*" in this case.)
     * RET index        Entry number that can be used to refer to this operation in various effect opcodes.
     *                  Returns -1 on error.
     */
    DEFINE_ACTION_FUNCTION ADD_SPLPROT_ENTRY
    INT_VAR
      stat      = "-1"
    STR_VAR
      value     = "*"
      relation  = "*"
    RET
      index
    BEGIN
      OUTER_SET index = "-1"
    
      ACTION_IF (stat >= 0) BEGIN
        LAF TO_HEX_NUMBER INT_VAR value = stat RET hexNumber END
        OUTER_TEXT_SPRINT valueHex ~0x%hexNumber%~
        ACTION_IF (~%value%~ STRING_EQUAL ~~) BEGIN
          OUTER_TEXT_SPRINT value ~*~
        END
        ACTION_IF (~%relation%~ STRING_EQUAL ~~) BEGIN
          OUTER_TEXT_SPRINT relation ~*~
        END
    
        ACTION_IF (FILE_EXISTS_IN_GAME ~splprot.2da~) BEGIN
          COPY_EXISTING ~splprot.2da~ ~override~
            READ_2DA_ENTRIES_NOW table 4
            // Search for identical entries
            FOR (idx = 0; idx < table; idx += 1) BEGIN
              READ_2DA_ENTRY_FORMER table idx 1 curStat
              PATCH_IF (~%stat%~ STRING_EQUAL ~%curStat%~ OR ~%valueHex%~ STRING_EQUAL_CASE ~%curStat%~) BEGIN
                READ_2DA_ENTRY_FORMER table idx 2 curValue
                PATCH_IF (~%value%~ STRING_EQUAL ~%curValue%~) BEGIN
                  READ_2DA_ENTRY_FORMER table idx 3 curRelation
                  PATCH_IF (~%relation%~ STRING_EQUAL ~%curRelation%~) BEGIN
                    SET index = idx
                    SET idx = table
                  END
                END
              END
            END
    
            PATCH_IF (index < 0) BEGIN
              // Add new entry
              PATCH_IF (stat >= 0x100) BEGIN
                TEXT_SPRINT line ~%table%        %valueHex%        %value%         %relation%~
              END ELSE BEGIN
                TEXT_SPRINT line ~%table%        %stat%          %value%         %relation%~
              END
              INSERT_2DA_ROW table 4 ~%line%~
              SET index = table
            END
          BUT_ONLY IF_EXISTS
        END
      END
    END
    

    Example usage:
    LAF ADD_SPLPROT_ENTRY
    INT_VAR
    	stat = IDS_OF_SYMBOL (~STATS~ ~STREXTRA~)
    STR_VAR
    	value = "-1"	// User-defined value
    	relation = "4"	// Greater or equal
    RET
    	index	// The entry you're looking for
    END
    
    COPY_EXISTING "DAGG01.itm" "override"
    	LPF ADD_ITEM_EFFECT
    	INT_VAR
    		type = 1
    		opcode = 318
    		target = 2
    		parameter1 = 75
    		parameter2 = index
    		duration = 1
    	END
    BUT_ONLY
    
  • RaduzielRaduziel Member Posts: 4,714
    Thanks @Luke93 :)
  • lefreutlefreut Member Posts: 1,462
    Hello fellow modders, noob request here.

    There is a great tutorial on how to make kit mods in this forum. But is there a tutorial on how to create a simple quest mod? How to create a NPC, add some dialogue, and basic stuff like this.
  • RaduzielRaduziel Member Posts: 4,714
    lefreut wrote: »
    Hello fellow modders, noob request here.

    There is a great tutorial on how to make kit mods in this forum. But is there a tutorial on how to create a simple quest mod? How to create a NPC, add some dialogue, and basic stuff like this.

    Not that I'm aware off - there's a nice tutorial about making a NPC work fine in SoD made by @jastey - but reverse engineering can help you through.
  • lefreutlefreut Member Posts: 1,462
    First question to see if I properly understand dialog state.

    If you have something like this:
    State0: IF ~NumberOfTimesTalkedTo(0)~ ...
    State1: IF ~True()~ ...
    State2: IF ~StateCheck(Myself,STATE_CHARMED)~ ...

    State2 can never happen.

    This is basically what is in NOBL5.DLG and NOBL6.DLG. And indeed in game I can't seem to be able to trigger the charmed dialog. If I switch State1 and State2, I can trigger it.

    Did I miss something or am I really unlucky in that the first two dialog files I opened are bugged ? :o
  • BubbBubb Member Posts: 1,001
    @lefreut: The engine picks the first state that satisfies its trigger block as the dialog starting point. You are correct, State1's True() block is always going to be checked first, and thus State2 will never be reached. Seems it is indeed bugged!
  • jasteyjastey Member Posts: 2,681
    To circumvent that you need to use WEIGHT #
  • RaduzielRaduziel Member Posts: 4,714
    jastey wrote: »
    To circumvent that you need to use WEIGHT #

    Weight: one of the few things that can be used both for modding and jiu-jitsu.

    Seriously now: what WEIGHT does and how could it help?
  • kjeronkjeron Member Posts: 2,367
    edited October 2019
    Raduziel wrote: »
    Seriously now: what WEIGHT does and how could it help?
    It is weidu's term for State Trigger Index.

    Dialog states are given priority based on the index of their trigger condition (starting from zero, counting up). A state with an index of "-1" (no trigger) will never be chosen, it can only be directed to through responses.

    The "Tree Tab" in Near Infinity automatically sorts this out displaying only those with valid trigger indexes in order.
  • lefreutlefreut Member Posts: 1,462
    jastey wrote: »
    To circumvent that you need to use WEIGHT #

    Tell that to Beamdog, it's their dialogs that are bugged not mine :p
Sign In or Register to comment.