Skip to content

General mod Questions thread

1454648505170

Comments

  • kjeronkjeron Member Posts: 2,368
    Luke93 wrote: »
    I guess there are 2 problems:
    • row#B is 'Less than or equal specified value' (but param1 is unused, so this is probably fine...)
    • row#C is 'Not match entries -1 or -1'
    The first is a display issue in NI - only "-1" is "use specific value", not all negative numbers.
    The second I suspect is because you are passing value and relation as string variables, so they need to be evaluated:
    LAF ADD_SPLPROT_ENTRY
    INT_VAR
    	stat = 0x104	// negate 0x103 (where 0x103 - use two rows of splprot.2da)
    STR_VAR
    	value = EVAL ~%index1%~		// 
    	relation = EVAL ~%index2%~		// 
    RET
    	index
    END
    
  • RaduzielRaduziel Member Posts: 4,714
    How can I ensure that a creature under the effect of a spell will deliver maximum damage with one kind of weapon (e.g. only axes or only hammers or only bastard swords)?

    Thanks!
  • The user and all related content has been deleted.
  • GoidaGoida Member Posts: 118
    I have a question about the Critical Hit Effect, opcode 341. Have you noticed that the effect is applied instantly, before the projectile gets to the target? It's hard to spot for melee weapons, but possible for arrows or bolts. For example, if you hang a knockout effect on bows, enemies will drop as soon as the attack roll information appears, and the arrow is an afterthought. This has led me to use a simple 5% random chance effect on a custom missile, which I had wanted to happen on a critical hit. Do you know a way around this?
  • kjeronkjeron Member Posts: 2,368
    It was noticed: https://support.baldursgate.com/issues/31341.
    The only way to make them sync is to give the critical hit effect spell the same projectile as the ammo - and hope non-standard ammo isn't used (Gesen).
  • GoidaGoida Member Posts: 118
    Okay.

    Continuing with the store patching. Now I'd like to exclude one inn from the patch that puts apples in all inns' stores:

    COPY_EXISTING_REGEXP GLOB ~.*\.STO~ ~override~

    READ_BYTE 0x8 type
    READ_ASCII 0xC name

    PATCH_IF (%SOURCE_SIZE% > 0x9b) BEGIN

    PATCH_IF type == 2 & !(~%name%~ STRING_EQUAL_CASE ~Candlekeep Inn~)

    THEN BEGIN

    ADD_STORE_ITEM "APPLTH_#" FIRST #0 #0 #0 ~IDENTIFIED~ #0 UNLIMITED

    END
    END
    BUT_ONLY

    And still it gets apples.
  • [Deleted User][Deleted User] Posts: 0
    edited March 2019
    The user and all related content has been deleted.
  • GwendolyneGwendolyne Member Posts: 461
    0xc stores a strref value (integer), like item names, so you have to compare it with stringref in dialog.tlk:
    IF (name = nnnn) BEGIN
    
  • GoidaGoida Member Posts: 118
    If you know which stores you want to exclude, why not just use the filename?
    PATCH_IF !(~%SOURCE_RES%~ STRING_EQUAL_CASE ~[.sto file]~) BEGIN
    

    That's what I wanted. Thank you.

  • GoidaGoida Member Posts: 118
    edited March 2019
    I'm having a problem with a projectile. The missile itself is Random Path, and when it lands the AOE is supposed to fire a custom explosion 10 times for a 10-round duration. I could probably time the animation to look smooth, however, I only get one explosion, though the effects do last the entire 10 rounds. What's more, the missile's tail animation, for some reason, continues to be drawn every round of the duration after the hit, wagging all over the place, with Random Path. This goes away if I make it fly straight, but the randomness is essential for this one. Is there any way to fix both of these within the file or do I have to revert to something exotic, like spawning an invisible minion at the impact point who will produce the rest of the show?

    (Deleted the second issue - fixed)
    Post edited by Goida on
  • RaduzielRaduziel Member Posts: 4,714
    Hello.

    So, I'm trying to build a fix for the Flail of Ages issue to incorporate it to DoF's next release. Here's the code I built, quite simple:
    //Fix for an issue with the Flail of Ages
    
    ACTION_IF GAME_IS ~bg2ee eet~ BEGIN
    
    COPY_EXISTING ~BLUN30.itm~  override
    LPF DELETE_EFFECT   INT_VAR match_opcode = 324                      match_parameter2 = 55                                                      END
    LPF DELETE_EFFECT   INT_VAR match_opcode = 324                      match_parameter2 = 77                                                      END
    LPF DELETE_EFFECT   INT_VAR match_opcode =  12                      match_parameter2 = 32                                                      END
    LPF ADD_ITEM_EFFECT INT_VAR       opcode = 324 target = 2                 parameter2 = 55                         STR_VAR resource = ~BLUN30~  END
    LPF ADD_ITEM_EFFECT INT_VAR       opcode = 324 target = 2                 parameter2 = 77                         STR_VAR resource = ~BLUN30~  END
    LPF ADD_ITEM_EFFECT INT_VAR       opcode =  12 target = 2 parameter1 = 2  parameter2 = 32 timing = 1 dicesize = 6                              END
    BUT_ONLY IF_EXISTS
    
    COPY_EXISTING ~BLUN30C.itm~ override
    LPF DELETE_EFFECT   INT_VAR match_opcode = 324                      match_parameter2 = 55                                                      END
    LPF DELETE_EFFECT   INT_VAR match_opcode = 324                      match_parameter2 = 77                                                      END
    LPF DELETE_EFFECT   INT_VAR match_opcode =  12                      match_parameter2 = 32                                                      END
    LPF ADD_ITEM_EFFECT INT_VAR       opcode = 324 target = 2                 parameter2 = 55                         STR_VAR resource = ~BLUN30C~ END
    LPF ADD_ITEM_EFFECT INT_VAR       opcode = 324 target = 2                 parameter2 = 77                         STR_VAR resource = ~BLUN30C~ END
    LPF ADD_ITEM_EFFECT INT_VAR       opcode =  12 target = 2 parameter1 = 1  parameter2 = 32 timing = 1 dicesize = 6 STR_VAR                      END
    BUT_ONLY IF_EXISTS
    
    END
    

    The problem is: when I open the file after running this code, Opcode 324 is not reappearing, only Opcode 12 (Poison damage). Honestly, IDK if nothing is being added and Opcode 12 is not being removed.

    Some insight, please?

    Thanks.
  • _Luke__Luke_ Member, Mobile Tester Posts: 1,535
    edited March 2019
    @Raduziel

    You need to add "type = 1" (Melee header) to all those ADD_ITEM_EFFECT....

    From the ReadMe:
    "SET 'type' to the type of header to which the effect should be added or 99 for all types. Defaults to 3 (magic)."
  • RaduzielRaduziel Member Posts: 4,714
    @Luke93 Thanks, it is working now :)
  • GoidaGoida Member Posts: 118
    edited March 2019
    @subtledoctor , I tried your suggestion and the item is still being added to the excluded store:

    PATCH_IF type == 2 & !(~%SOURCE_RES%~ STRING_EQUAL_CASE ~[INN2616]~)

    ...

    It still appears there.

    Another problem: does anyone know if it's possible to summon a creature at the target point of a custom projectile? For example, if I want a lightning bolt to hit a point on the ground and Noober to jump out of there. Usually summoning effects are all Self-targeted and any projectiles are ignored.
    Post edited by Goida on
  • The user and all related content has been deleted.
  • switswit Member, Translator (NDA) Posts: 495
    edited March 2019
    Does anyone know about a way to make being "turned" detectable in scripts? TurnedBy([ANYONE]) trigger seems useless since the turned creature is not performing any scripts when being turned (the trigger will work at the first script run when the effect ends, but that's not what I need). Detecting turning externally via TriggerOverride("someDV",TurnedBy([ANYONE])) also doesn't work (always false based on my tests).

    I've checked turned creature in save file and the CRE structure seems to be unaffected by cleric turn (no flags set, not states). Maybe there is some dummy spell applied by the engine upon successful turning, which I could patch with spell state?

    edit: it can be detected via opcode #232, Target turned by condition.
  • kjeronkjeron Member Posts: 2,368
    Against non-party members, being turned imposes action RunAwayFrom(object,timer) (or similar).
    Scripts will not interrupt this action until it's timer expires, but it can be interrupted by "ActionOverride()" from other scripts, though other scripts cannot detect "TurnedBy()" through TriggerOverride(), and by players with manually issued commands.
    Against party members (Paladins), being turned applies op24, bypassing immunity to it, for (40 seconds - Paladin level).
    Being controlled by a cleric applies op241, charm type 4, for 1 turn.
  • RaduzielRaduziel Member Posts: 4,714
    I want to make a kit that is immune to the cursed scrolls.

    Can I use Opcode 206 having an itm as a resource?
  • The user and all related content has been deleted.
  • RaduzielRaduziel Member Posts: 4,714
    @subtledoctor Thanks and go for it, tiger.
  • RaduzielRaduziel Member Posts: 4,714
    edited March 2019
    I'm still vulnerable to the scroll:
    LPF ADD_SPELL_EFFECT INT_VAR opcode = 324 target = 2 timing = 9 STR_VAR resource = ~SCRL10~ END
    

    Header target is 5 (self).

    Any other ideas?


    Nevermind, I had to start a new game to the effect kick in.

    Thanks.
  • RaduzielRaduziel Member Posts: 4,714
    edited March 2019
    About Opcode 324:

    Why is no message being displayed?
    LPF ADD_SPELL_EFFECT INT_VAR opcode = 324 target = 2 timing = 9 STR_VAR resource = ~SCRL10~ END
    

    IESDP:
    The creature type specified by the 'Type' field becomes immune to the spell or item specified in the 'Resource' field. It also gives a message on a successful resist.

    Thanks.
  • kjeronkjeron Member Posts: 2,368
    edited March 2019
    Raduziel wrote: »
    About Opcode 324:
    Why is no message being displayed?
    The message is only displayed when this effect is applied, not when the immunized resource is blocked.
  • RaduzielRaduziel Member Posts: 4,714
    kjeron wrote: »
    Raduziel wrote: »
    About Opcode 324:
    Why is no message being displayed?
    The message is only displayed when this effect is applied, not when the immunized resource is blocked.

    Why a golem struck by FoA +4 displays "Immune to the effects of FoA+4"?

    Can I code what I did in another way to make the message display?

    Thanks!
  • kjeronkjeron Member Posts: 2,368
    Raduziel wrote: »
    Why a golem struck by FoA +4 displays "Immune to the effects of FoA+4"?

    Can I code what I did in another way to make the message display?

    Thanks!
    You would have to add the op324 effect to the item's ability, as the leading effect, specifying (I'm assuming) your kit in parameter1/2.
  • RaduzielRaduziel Member Posts: 4,714
    edited March 2019
    @kjeron Thanks!

    And yes, for absolutely zero people surprise it is a kit.

    Edit: Worked like a charm (as expected). And now I know how to make Opcode 324 aim kits (IESDP don't list it as possible, but Near Infinity gave me every direction I needed).

    If you, fellow modder from the future, want to know how I did it here's the magic:
    ACTION_IF !GAME_IS ~iwdee~ BEGIN
    
    ACTION_FOR_EACH scroll IN ~SCRL10~ ~SCRL11~ ~SCRL12~ ~SCRL13~ ~SCRL14~ ~SCRL16~ ~SCRL17~ ~SCRL18~ BEGIN
    
    ACTION_IF FILE_EXISTS_IN_GAME ~%scroll%.itm~ THEN BEGIN
    
    COPY_EXISTING ~%scroll%.itm~ override
    LPF ADD_ITEM_EFFECT INT_VAR type = 3 opcode = 324 parameter1 = IDS_OF_SYMBOL (~Kit~ ~RADene~)   parameter2 = 109 target = 1 timing = 2 STR_VAR resource = EVAL ~%scroll%~ insert_point = 0 END
    LPF ADD_ITEM_EFFECT INT_VAR type = 3 opcode = 324 parameter1 = IDS_OF_SYMBOL (~Kit~ ~RADeneCM~) parameter2 = 109 target = 1 timing = 2 STR_VAR resource = EVAL ~%scroll%~ insert_point = 1 END
    END
    
    END
    
    END
    
    Post edited by Raduziel on
  • GoidaGoida Member Posts: 118
    I'm still trying to figure out why this code for excluding a store doesn't work:
    COPY_EXISTING_REGEXP GLOB ~.*\.STO~ ~override~
    
    READ_BYTE  0x8 type
    READ_ASCII 0xC name
    
    PATCH_IF (%SOURCE_SIZE% > 0x9b)	BEGIN
    
    PATCH_IF type == 2 & !(~%SOURCE_RES%~ STRING_EQUAL ~[INN2616]~)
    
    THEN BEGIN
    
    ADD_STORE_ITEM "APPLTH_#" LAST #0 #0 #0 ~IDENTIFIED~ #0 UNLIMITED
    
    END
    END
    BUT_ONLY
    

    Any suggestions?
  • RaduzielRaduziel Member Posts: 4,714
    edited March 2019
    Well, @subtledoctor said earlier to try to remove the brackets from INN2616.

    Have you tried it already?
  • GoidaGoida Member Posts: 118
    edited March 2019
    Goida wrote: »
    @subtledoctor , I tried your suggestion and the item is still being added to the excluded store:

    PATCH_IF type == 2 & !(~%SOURCE_RES%~ STRING_EQUAL_CASE ~[INN2616]~)

    Is that pseudocode, or are you actually including those square brackets? STRING_EQUAL_CASE looks for a case-insensitive but otherwise exact textual match. So what's between the tildes ~~ has to be the filenames, no more and no less.

    I didn't see this. Too many new messages between then and now. I will change this. And thanks, @Raduziel .

    And another thing. I have an item with a weapon ability - it's a dart, actually - and another ability activated from the Items bar, Caster-targeted. Throwing the darts obviously expends them, but the other one isn't spent when it's used. What combination of "number of charges" and "when drained" do I need to prevent the number of charges from showing on the icon?

    Something else. How can I limit the duration of a looping special effect when it's put At target point or Over creature (unattached)? It goes on forever, no matter what the duration. Or perhaps I can put in a delayed removal somehow?
    Post edited by Goida on
  • GoidaGoida Member Posts: 118
    Here is a little challenge. I'm making a spell that will shoot through a number of targets, in a line, as the projectile flies, and put all of them either under effect A or effect B, 50% of the time. One shot it will be A for everyone, the next shot it may be B. Let's say A is making them glow and B is darkening them. I'm thinking of a way to go about this randomness. If I simply put a 50-50 Cast spell subeffect in the spell, the roll is going to be different for every hit creature, some will glow and others will darken. I need instead the same result for everyone within a shot.

    At the moment my best idea is to apply both of the subspells, each combined with an Everyone-targeted immunity to the other. When the roll is made for the first hit creature and, say, A is rolled, everyone will become immune to B. This is not going to change the rolls for the next targets, however, so if I keep the chances at 50-50 and the other creatures roll in the B range, they will just end up unaffected by either. If I make both rolls at 100-0, however, the first spell to apply on the list will block the second for everyone, so effectively only A will ever be observed.

    Perhaps I can instead begin with a Self-targeted random, 50-50, immunity to A or B for Everyone, at the firing, and keep the rolls at 100-0. This way only one of the subspells will go through. But if there is a more beautiful solution, I'm open to suggestions.
Sign In or Register to comment.