Skip to content

General mod Questions thread

1679111270

Comments

  • chimericchimeric Member Posts: 1,163
    Okay, how about this script, checking for items with a combination of a proficiency (SCIMITARWAKIZASHININJATO), category (Large swords) and appearance (S1)? That should single out ninjatos. I guess I'm not reading/writing something correctly? The first two fields are 1 byte long and the third is a text field.

    COPY_EXISTING_REGEXP ~.*\.itm~ override
    PATCH_IF (SOURCE_SIZE > 0x71) THEN BEGIN
    READ_BYTE 0x31 prof
    READ_BYTE 0x1c cat
    READ_ASCII 0x22 app

    PATCH_IF (prof = 95 & cat = 20 & app = ~S1 - Long sword~) BEGIN
    LPF ADD_ITEM_EQEFFECT
    INT_VAR
    opcode = 328
    target = 1
    timing = 2
    parameter2 = 359
    special = 1
    END
    END
    END

    I guess I'm putting the reading operation for the ASCII in a wrong place, but where else? And how?
  • ArdanisArdanis Member Posts: 1,736
    edited September 2017
    READ_ASCII 0x22 app (2) // you only need two bytes

    PATCH_IF (prof = 95 & cat = 20 & (~%app%~ STRING_EQUAL_CASE ~S1~)) BEGIN
  • The user and all related content has been deleted.
  • ArdanisArdanis Member Posts: 1,736
    By reading it long you also pick the "minimal level" value, which iirc has never been used, so it generally makes no difference whether you read 2-byte string or 4-byte value. 2-byte is still the proper range, though.
  • chimericchimeric Member Posts: 1,163
    edited September 2017
    Ardanis said:

    READ_ASCII 0x22 app (2) // you only need two bytes

    PATCH_IF (prof = 95 & cat = 20 & (~%app%~ STRING_EQUAL_CASE ~S1~)) BEGIN

    Aha. Well, I can say honestly I would never have figured this out myself. But I'm getting a parsing error at that line. The code currently looks like this:

    COPY_EXISTING_REGEXP ~.*\.itm~ override
    PATCH_IF (SOURCE_SIZE > 0x71) THEN BEGIN
    READ_BYTE 0x31 prof
    READ_BYTE 0x1c cat
    READ_ASCII 0x22 app (2)

    PATCH_IF (prof = 95 & cat = 20 & (~%app%~ = STRING_EQUAL_CASE ~S1~)) THEN BEGIN
    LPF ADD_ITEM_EQEFFECT
    INT_VAR
    opcode = 328
    target = 1
    timing = 2
    parameter2 = 359
    special = 1
    END
    END
    END
  • BrutaleBentBrutaleBent Member Posts: 36
    Have a question - is it possible to make a pair of boots, or any item, that gives a movespeed boost out of combat, and disables the boost during combat?

    It's about my only gripe with the game, that standard movespeed is too slow, but boots of speed effect on all chars make combat stupidly easy.

    I know you can up game speed, but that borks cutscenes, which are still an enjoyable part for me. ;)
  • The user and all related content has been deleted.
    BrutaleBent
  • The user and all related content has been deleted.
    BrutaleBent
  • chimericchimeric Member Posts: 1,163
    edited September 2017
    Why only Charname? He's asking for a general speed boost. Here's how I would do it. Put this code on top of BALDUR.BCS:
    IF
    
    ActuallyInCombat()
    !GlobalTimerNotExpired("STEP_IT_UP","GLOBAL")
    
    THEN
    
    RESPONSE #1
    
    SetGlobalTimer("STEP_IT_UP","GLOBAL",ONE_ROUND)
    ApplySpellRES("STEPUP",Player1)
    Continue()
    
    END
    Then you make the STEPUP spell, target Living actor, Effect "Movement speed bonus," target Everyone, duration 6 seconds.

    P.S. @Ardanis, going to have to call on you. Your code above for STRING_EQUAL_CASE, it won't compile. Also does anybody know why I get numbers instead of letters when I try, for example, this code:

    COPY_EXISTING ~RETMO2_#.SPL~ ~override~
    LPF ~ADD_SPELL_EFFECT~ INT_VAR opcode = 177 target = 2 parameter1 = 0 parameter2 = 2 timing = 0 probability1 = 100 probability2 = 0 duration = 60 resource = RESOLVE_STR_REF (~RETMO2_#~) resist_dispel = 0 savingthrow = 0 savebonus = 0 END
    BUT_ONLY

    It's supposed to be an immunity to that spell. Something about strings, though.
    BrutaleBent
  • [Deleted User][Deleted User] Posts: 0
    edited September 2017
    The user and all related content has been deleted.
    BrutaleBent
  • chimericchimeric Member Posts: 1,163
    There is no need to avoid something that is completely not a problem. But you seem to be under the illusion that baldur.bcs starts running when there are some checks in it, and otherwise it's dormant and no "resources" are being consumed. Any performance problems, tiny too, that I've ever seen in this game have always been on the spell side, as when a spell removes multiple effects. But baldur.bcs is always and always running, whether there is anything in it or not. The only problem with it is when script commands are written without a Continue() or so many frequent checks are added on top that the script never gets to the bottom. But that's something to address to sloppy codders who plunk everything in that file, and even then it's a mod conflict issue, not a performance issue. If B.B. wants a straight and proper solution, he has it. He can sort out for himself whether his setup is to clogged up or not.
  • The user and all related content has been deleted.
  • BrutaleBentBrutaleBent Member Posts: 36
    edited September 2017
    Thanks for the insight, mates - I'll play around chimerics version once I get home from work (and subtledoctors if it's done by then). But even though I got one possible solution, I'd also still like subtledoctors version, if possible - so if anyone can give him that script baf, I'll gift you with a like! :P
  • BrutaleBentBrutaleBent Member Posts: 36
    edited September 2017
    An update: I used haste spell as basis - and that netted me the haste effect when in combat instead of out of combat, did I do it wrong? :open_mouth:

    Attached BALDUR.BCS and STEPUP.SPL if you wanna see it for yourself. ;)
  • The user and all related content has been deleted.
    BrutaleBent
  • BrutaleBentBrutaleBent Member Posts: 36
    Yeah, I get that - just now changed it to 126, but the problem is that it's happening IN combat, instead of OUTSIDE of combat, which is the exact opposite of what I want. :D

    And your version sounds easy enough, I'm sure... if I knew how to do that. :P

    Let's hope G3 is up again soon! ;)
  • kjeronkjeron Member Posts: 2,367
    chimeric said:


    COPY_EXISTING ~RETMO2_#.SPL~ ~override~
    LPF ~ADD_SPELL_EFFECT~
    	INT_VAR
    		opcode = 177
    		target = 2
    		parameter2 = 2
    		duration = 60
    	STR_VAR 
    		resource = ~RETMO2_#~	// direct string
    	//	resource = EVAL ~%variable%~ // variable string
    END
    BUT_ONLY
    String values must be listed after "STR_VAR", just as Integer values are listed after "INT_VAR".
    RESOVE_STR_REF is only for in-game strings, where you need the reference number, not resource filenames
  • [Deleted User][Deleted User] Posts: 0
    edited September 2017
    The user and all related content has been deleted.
  • semiticgoddesssemiticgoddess Member Posts: 14,903
    @BrutaleBent: Personally, I use the console to speed things up. CTRL-J can teleport you all the way across the map instantly, and CTRL-4 can highlight ground triggers to ensure that you don't accidentally skip over important plot triggers and spawn points (which can also happen when you have high movement rates). It requires no modding and is much faster than increasing movement rates.
    BrutaleBent
  • BrutaleBentBrutaleBent Member Posts: 36
    @semiticgod It's not quite how I want to play the game, but thanks nonetheless for that info, mate - didn't know this. ;) Does this work for people that spawn and walk to you and the like?

    @subtledoctor @chimeric Don't know if you have any interest in this, but I changed "ActuallyInCombat()" to "CombatCounter(0)" - and it works, somewhat... It's far from perfect, as chars will run around for some time before the effect cancels, and I'm guessing anything that can cancel the effect on enemy sighted (like that lovely autopause), would work the best.
  • chimericchimeric Member Posts: 1,163
    I thought you wanted it during combat... Misread it, I guess. Well then, you've got the right thing, except that you should negate ActuallyInCombat instead, !ActuallyInCombat. The combat counter is bugged, it also runs after dialogues, whether they end in a fight or not.
    BrutaleBent
  • semiticgoddesssemiticgoddess Member Posts: 14,903
    @BrutaleBent: Of the critters who talk to you the moment they see you and initiate a quest-related dialog, some of them are already spawned when you enter the area. Others only spawn when you cross a trigger. Saemon Havarian, for example, only appears in Spellhold to offer you an alternate way to Irenicus if you step on a certain trigger on the way out. Nalia, however, has no trigger to appear in the Copper Coronet; she's already there when you arrive.

    CTRL-4 will show you where the spawn triggers are for folks like Saemon, but they won't tell you where people like Nalia might be. This means it's still possible to skip over plot-related characters using CTRL-J, even if you use CTRL-4 to find the triggers--unless you've played the game enough times that you already know where those people automatically spawn.
    BrutaleBent
  • chimericchimeric Member Posts: 1,163
    edited September 2017
    @BrutaleBent , another thing: you probably want to speed up just the party, not the whole world, right? Then choose Party only as the target of your spell effect instead of Everyone. I can only imagine what's happening to chickens right now. :smiley:

    And, for a cherry on that cake, you can stop the hasting with a positive ActuallyInCombat check and another spell doing the Remove effects by Resource opcode. To go to baldur.bcs, of course! Again!!!



    P.S. I have another idea for code here, simpler. Still for baldur.bcs, but to start the hasting as soon as any of the party characters are active (moving, using stealth, casting etc.), including when they do it automatically, e.g. when checking for traps and so on. While there is any action, they'll be moving faster, when everything is off completely and they stand still, the speed will drop back to normal. You just need to exclude combat. Try this:
    IF
    
    !GlobalTimerNotExpired("STEP_IT_UP","GLOBAL")
    OR(6)
    !TriggerOverride(Player1,ActionListEmpty())
    ...
    repeat for all of them...
    !ActuallyInCombat()
    
    THEN
    
    RESPONSE #1
    
    SetGlobalTimer("STEP_IT_UP","GLOBAL",2)
    Apply your spell here, but make it last just 2 seconds
    Continue()
    
    END
    You might not need the effect removal then, and this is flexible.
    Post edited by chimeric on
    BrutaleBent
  • BrutaleBentBrutaleBent Member Posts: 36
    Nice! I'll let you know how it goes when I get home from work tomorrow. ;)
  • chimericchimeric Member Posts: 1,163
    kjeron said:

    chimeric said:


    COPY_EXISTING ~RETMO2_#.SPL~ ~override~
    LPF ~ADD_SPELL_EFFECT~
    	INT_VAR
    		opcode = 177
    		target = 2
    		parameter2 = 2
    		duration = 60
    	STR_VAR 
    		resource = ~RETMO2_#~	// direct string
    	//	resource = EVAL ~%variable%~ // variable string
    END
    BUT_ONLY
    String values must be listed after "STR_VAR", just as Integer values are listed after "INT_VAR".
    RESOVE_STR_REF is only for in-game strings, where you need the reference number, not resource filenames
    Okay, I used your code with success in one instance, but there remains the problem of patching weapons with custom spell states. How do I adapt STR_VAR to a check for ASCII? The code with Ardanis' suggestion looks like this:
    COPY_EXISTING_REGEXP	~.*\.itm~ override
    	PATCH_IF (SOURCE_SIZE > 0x71) THEN BEGIN
    	READ_BYTE 0x31 prof
    	READ_BYTE 0x1c cat
    	READ_ASCII 0x22 app (2)
    PATCH_IF	(prof = 95 & cat = 20 & (~%app%~ = STRING_EQUAL_CASE ~S1~)) THEN BEGIN
    		LPF	ADD_ITEM_EQEFFECT
    			INT_VAR
    				opcode = 328
    				target = 1
    				timing = 2
    				parameter2 = 359
    				special = 1
    		END
    	END
    END
    But STRING_EQUAL and so on isn't right here. I need to insert STR_VAR somewhere.
  • kjeronkjeron Member Posts: 2,367
    @chimeric
    look back at Ardanis code:
    Ardanis said:

    PATCH_IF (prof = 95 & cat = 20 & (~%app%~ STRING_EQUAL_CASE ~S1~)) BEGIN

    remove the '=' you have between '~%app%~' and 'STRING_EQUAL_CASE'
    'STRING_EQUAL_CASE' is used in place of the '=', not with it

    there is no need for STR_VAR with opcode 328, it doesn't use its resource field, so there are no string variables.
  • chimericchimeric Member Posts: 1,163
    edited September 2017
    Yes, that was it! Thank you. I'm almost finished...

    Say, do you happen to know how to translate the weird labels of KIT.IDS to the actual kit names in the games? The "Feralan" is the Archer, what are BEASTFRIEND and TOTEMIC? That last one is Shapeshifter, yes? Also, more important: do group class labels, like RANGER_ALL, include dual classes and multiclasses and kits, or just some of those? For example, if I want to affect all sorcerers, do I need to put in provisos for every existing kit, including Red Dragon Disciples? I'd much prefer something to encompass all kits that might have been added or might be added later, but I know that pointing to a straight class, like CLASS -> FIGHTER, limits application to fighters without a kit (I do miss the days when we didn't have so many damn kits around). I assume it's the same for CLASS -> SORCERER, so RDDs would be excluded. Must I go through every kit there is separately?
    Post edited by chimeric on
  • kjeronkjeron Member Posts: 2,367
    There are only 2 misleading labels:
    FERALAN = Archer
    BEAST_FRIEND = Avenger

    I don't know much about the (class)_ALL labels. I think they only work in scripts, not the IDS fields of opcodes, but that's about it.
    semiticgoddess
  • chimericchimeric Member Posts: 1,163
    edited September 2017
    What about that Hivemaster guy? Never seen one of them, actually.

    The ALL labels work in effects alright. I just squashed my illusionist and Edwin with a killing MAGE_ALL. It killed a mage/thief too, so I guess it applies roundly.

    And another thing. Is there any way to apply a character's Strength bonus to a spell's damage, you know, factor it in? I know there are a couple of effects that change Strength itself, but I'd like a spell that does extra damage for strong characters. I think you've said this is possible in the thread about armor.
    Post edited by chimeric on
  • chimericchimeric Member Posts: 1,163
    edited September 2017
    Also, can you please tell me how to add a temporary spell state on hit to weapons? I want to imbue all melee weapons, going by proficiencies, all missiles and all things called "Attack" (monster weapons) in such a way that they put the target in a spell state for a second, marking it briefly as wounded. It's not elegant, but I found that TriggerOverride doesn't work for TookDamage() and HitBy(), bugged, clearly, so I'm going to have to make my minions react to a spell state as they observe the situation of their summoner... All of this is for a new and attractive fighting tactic, but it's like a minefield. All of the functions that should have let me do what I have in mind days ago, if they only worked correctly, are unreliable or downright broken. You've been very helpful. I'm still hoping to get it to work. So here is what I'm using to patch weapons, only I know it's not right:
    ...PATCH_IF	(prof = 111 || prof = 114 || prof = 92 || prof = 89 || prof = 108 || prof = 115 || prof = 96 || prof = 106 || prof = 111 || prof = 100 || prof = 99 || prof = 94 || prof = 111 || prof = 90 || prof = 101 || prof = 102 || prof = 95 || prof = 91 || prof = 113 || prof = 98 || prof = 112 || prof = 93 || prof = 97 || cat = 5 || cat = 14 || cat = 24 || cat = 31 || (~%att%~ STRING_EQUAL_CASE ~Attack~)) THEN BEGIN
    		LPF	ADD_ITEM_EFFECT
    			INT_VAR
    				opcode = 328
    				target = 2
    				timing = 0
    				duration = 1
    				parameter2 = 366
    				special = 1
    		END
    	END
Sign In or Register to comment.