Skip to content

New Opcodes, Triggers, and Actions, oh my!

GrammarsaladGrammarsalad Member Posts: 2,582
I'm no @bengoshi , but I figured that I would try to put together what is known about new opcodes/actions/triggers/etc that will be rolling with the 2.0 release, and speculate their use. Join the Beta Grammar, you say? Yes, I should do that, but I'll just be spending my time tinkering with different opcodes. I would be no use.

Anyway, most of my information will be coming from here:

https://forums.beamdog.com/discussion/47588/change-log-for-v2-0#latest

Also, checking the Tobex readme:

http://www.shsforums.net/topic/48114-tobex-modder-reference/

Opcodes:

- Opcode 232 (Cast Spell On Condition) now supports spell states as conditions

So, if you're confused, charmed, etc. Very cool.

- Opcode 144 can now disable access to the inventory screen when param2 is set to 15

- New Opcode: Make Unselectable (Opcode 365)

Interesting. This is the highest opcode number found in the log as far as I can see. DLTCEP (in BGEE) maxes out pretty much at 342 with 360 being something about "breaking point". Some of the slots in between will likely be unused, but we might see maybe 15 or so usable opcodes or so (pretty wild guess, but eh).

- New Opcode: Saving Throw vs. School (Opcode 346)

Maybe this has something to do with externalizing specialist bonuses? In any case, it's a welcome addition.

- New Opcode: Selective Enchantment Bonus (Opcode 344)

There was a blurb about the magic weapon affecting equipped weapons rather than creating new ones. Perhaps they use this opcode?

Actions

- New Action: MoveToObjectOffset()

- New Action: DisplayStringPointLog()

- New Action: DisplayStringHeadNoLog()

Maybe this displays text overhead?

- New Action: SetGlobalTimerRandom()

- ForceRandomEncounter("") now clears the queue of forced encounters


Triggers

- (TobEx) New Trigger: ImmuneToSpellLevel() (17273)
From Tobex Readme:

"Returns true if the target creature specified by Object is protected from spells of power Level. This returns true for both Protection from Spell Levels (102) and Decrementing Spell Immunity (201) effects."

- New Trigger: StoryModeOn()

- New Trigger: OriginalClass(O:Object*, I:Class*CLASS)

I know that @subtledoctor was interested in something like this...

- New Trigger: ClassLevel()

- New Trigger: IsForcedRandomEncounterActive()

Externalizations:

- (TobEx) NPC reactions to pick pocket attempts have been externalized to PPBEHAVE.2da

OKay, this has a lot of cool potential. Tobex appears to do this via trigger/action commands. In any case, I'd love to get a peek at that 2da!

- (TobEx) The effects of the default bard song have been externalized to BARDSONG.spl

Was already pretty moddable, but cool.

- Status icons have been externalized to STATDESC.2da and can support any spell icon

Okay, if this means what I think it means, I'll be pretty happy. I'm assuming, maybe wrongly, that this will allow us to easily create portrait status icons. I could be wildly mistaken.

- (TobEx) Spellcasting failure due to damage has been externalized to CONCENTR.2da

Very cool. Here is everything Tobex has to say about the matter:

"Option: TobEx gives the option of implementing a concentration check affecting spellcasters being hit. Instead of always being interrupted when hit, spellcasters have a chance of their spells being interrupted. In the current implementation, a spellcaster passes the concentration check if:

(1D20 + luck) > (spell level + damage taken)

Option: TobEx gives the option of not interrupting a creature's spellcasting if a creature takes zero damage (i.e. immune)"

I wonder if we can tweak this even further. Again, I'd love to get a peek at that 2da.

- Variables in-game can now be set from baldur.lua using SetPrivateProfileString('Global','VariableName','1')

I have no idea what this means!
«1

Comments

  • The user and all related content has been deleted.
  • GrammarsaladGrammarsalad Member Posts: 2,582
    edited March 2016

    Triggers
    - New Trigger: OriginalClass(O:Object*, I:Class*CLASS)

    I know that @subtledoctor was interested in something like this...

    Unfortunately, I was looking for an Action, not a Trigger. So probably my plan won't be possible.
    Well, as far as I know, this is only a partial list. Notice that there is a gap of about 20 or so opcodes, but only 3 new ones listed...
  • KamigoroshiKamigoroshi Member Posts: 5,870
    Not really part of the opcodes, triggers or actions. But I was positively surprised to see that I could select *all* Divine Remix clerical kits, plus the three base Cleric kits, plus newly unlocked Cleric of Tyr kit within the character creation at teh same time. All in all, 14 kits were displayed without problems and even worked in the public beta as far as I could tell.

    It's good to know that the limit of 9 kits per class is finally lifted. :)
  • GrammarsaladGrammarsalad Member Posts: 2,582

    Not really part of the opcodes, triggers or actions. But I was positively surprised to see that I could select *all* Divine Remix clerical kits, plus the three base Cleric kits, plus newly unlocked Cleric of Tyr kit within the character creation at teh same time. All in all, 14 kits were displayed without problems and even worked in the public beta as far as I could tell.

    It's good to know that the limit of 9 kits per class is finally lifted. :)

    That is huge!

    I wonder if they increased the kit limit
  • The user and all related content has been deleted.
  • GrammarsaladGrammarsalad Member Posts: 2,582
    @Kamigoroshi
    It looks like I'm not going to get a chance to try the beta. Could you do me a huge favor, and create a character in ToB and see if there are any changes to the HLA screen (especially a scroll bar like the one for kits?)
  • KamigoroshiKamigoroshi Member Posts: 5,870
    @Grammarsalad
    Sorry, I only have access to BG:EE's public beta at the moment. You'd have to ask someone else for testing BGII:EE and its HLA's. Maybe @bengoshi can help you.
  • PeccaPecca Member Posts: 2,178
    Yes, there is a scroll bar for HLAs.
  • AquadrizztAquadrizzt Member Posts: 1,065
    Although not officially listed, we also know that there is an opcode that extends bard song for a duration after singing ends. If that is the case, then it becomes possible to make a bladesinger with a "bladesong" ability that extends their song for 6 seconds each time they make a successful attack.
  • GrammarsaladGrammarsalad Member Posts: 2,582
    Pecca said:

    Yes, there is a scroll bar for HLAs.

    No worries @Kamigoroshi !
    Awesome
  • GrammarsaladGrammarsalad Member Posts: 2,582
    edited March 2016
    It looks like we are not getting iwd spells in the new patch. I'm not sure about spell specific animations and projectiles. I do understand that they do have a boring beetle animation, so that's one spell that'll be easy to port

    Edit: no druid spells, anyway
    https://forums.beamdog.com/discussion/48233/shaman-specifics#latest
  • GrammarsaladGrammarsalad Member Posts: 2,582
    Looks like we have water elemental animations, and without the actual creature.
    https://forums.beamdog.com/discussion/comment/716951#Comment_716951

    This makes me hopeful that those projectile s and animations will be present making it easier to add iwd spells
  • The user and all related content has been deleted.
  • RaduzielRaduziel Member Posts: 4,714
    I was checking opcode 346 (Saving Throw vs. School) and couldn't understand it.

    Looked at two items in the game that gives save vs school bonus (a morningstar with +2 vs Alteration and an amulet with +3 vs Necromancy).

    The problem is: how this opcode distinguish schools? No Resource was allocated, the parameter1 is their respective bonus and parameter2 is zero for both.

    I'm failing to reverse-engineer this one, can anyone explain to me how this works?
  • GrammarsaladGrammarsalad Member Posts: 2,582
    Raduziel said:

    I was checking opcode 346 (Saving Throw vs. School) and couldn't understand it.

    Looked at two items in the game that gives save vs school bonus (a morningstar with +2 vs Alteration and an amulet with +3 vs Necromancy).

    The problem is: how this opcode distinguish schools? No Resource was allocated, the parameter1 is their respective bonus and parameter2 is zero for both.

    I'm failing to reverse-engineer this one, can anyone explain to me how this works?

    Heh, i forgot about this thread.

    What were the names of the items?
  • RaduzielRaduziel Member Posts: 4,714
    edited July 2017

    Raduziel said:

    I was checking opcode 346 (Saving Throw vs. School) and couldn't understand it.

    Looked at two items in the game that gives save vs school bonus (a morningstar with +2 vs Alteration and an amulet with +3 vs Necromancy).

    The problem is: how this opcode distinguish schools? No Resource was allocated, the parameter1 is their respective bonus and parameter2 is zero for both.

    I'm failing to reverse-engineer this one, can anyone explain to me how this works?

    Heh, i forgot about this thread.

    What were the names of the items?
    BDAMUL06 (Clasp of Helm -> gives +3 bonus vs Necromancy)

    BDBLUN01 (Mosela's Cudgel -> gives +2 bonus vs Alteration)

    Is there a list more complete than this one anywhere? The last entry in this list is opcode #321.
  • The user and all related content has been deleted.
  • RaduzielRaduziel Member Posts: 4,714

    Raduziel said:

    Is there a list more complete than this one anywhere? The last entry in this list is opcode #321.

    http://iesdp.bgforge.net/opcodes/bgee.htm
    #346 (0x15A) Save vs. school bonus
    Parameter #1: Statistic Modifier
    Parameter #2: Type
    Special: Primary Type
    Description:
    Applies the modifier value specified by the 'Statistic Modifier' field in the style specified by the 'Type' field.
    Known values for 'Type' are:
    0 Cumulative Modifier -> Save = Save + 'Statistic Modifier' value
    1 Flat Value Modifier -> Save = 'Statistic Modifier' value
    2 Percentage Modifier -> Save = (Save * 'Statistic Modifier' value) / 100

    'Primary Type' defines the school of magic to save against (see mschool.2da).
    Thanks for the link.

    I was able to locate mschool.2da, but IDK where to input the Necromancy code. I can see no field labeled as Special or something like this.



    This image is from the amulet. I can see the P1 and P2, but the Necromancy code (25269) is nowhere to be found.

  • kjeronkjeron Member Posts: 2,367
    @Raduziel
    The value for Spell School is the same as it when assigning it to spells, Necromancy = 7. Mschool.2da just defines the strings for each school when dispelled, listed in order.
    The special field is labeled and includes a list of schools in Near Infinity.
    In DLTCEP its that field labeled "Variable?".
  • AndreaColomboAndreaColombo Member Posts: 5,525
    Think this might be relevant to the discussion:

    http://gibberlings3.net/forums/index.php?showtopic=25516&page=1
  • RaduzielRaduziel Member Posts: 4,714
    edited July 2017
    Does anyone know a way of preventing a specific spell from being available for a kited-priest spellbook?
  • GwendolyneGwendolyne Member Posts: 461
    edited July 2017
    Raduziel said:

    Does anyone know a way of preventing a specific spell from being available for a kited-priest spellbook?

    My two paladin kits use special spells and don't know vanilla clerical spells.

    That's the way I coded it:
    
    /* ---------------------------------------------------------------------- *
     *  Suppression des sorts divins connus : remove all known divine spells  *
     * ---------------------------------------------------------------------- */
    COPY ~%MOD_FOLDER%/Kits/GWCDSort.spl~	~override/GWCDSort.spl~
    	FOR (level = 4 ; level > 0 ; level = level - 1) BEGIN
    		SET bornesup = level*100 + 99
    		FOR (spellcode = bornesup ; spellcode > level*100 ; spellcode = spellcode - 1) BEGIN
    			PATCH_IF (FILE_EXISTS_IN_GAME "SPPR%spellcode%.spl") BEGIN
    				LPF NAME_NUM_OF_SPELL_RES STR_VAR spell_res = EVAL "SPPR%spellcode%" RET spell_num spell_name END
    				PATCH_MATCH ~%spell_name%~ WITH
    					"CLERIC_.*" BEGIN
    						LPF ~ADD_SPELL_CFEFFECT~ INT_VAR opcode = 172 target = 1 timing = 1 STR_VAR resource = EVAL "SPPR%spellcode%" END END	// Spell: Remove Spell [172]
    					DEFAULT
    				END
    			END	// of PATCH_IF (FILE_EXISTS_IN_GAME "SPPR%spellcode%.spl")
    		END		// of FOR (spellcode = bornesup ; spellcode > header*100 ; spellcode = spellcode - 1)
    	END			// of FOR (level = 4 ; level > 0 ; level = level - 1)
    BUT_ONLY
    
    GWCDSort is launched at each level (part of the CLAB file).

    You can decide to only prevent one spell or more...
  • RaduzielRaduziel Member Posts: 4,714
    @Gwendolyne This is way above my actual knowledge, but I'll do my best to use this.

    Thanks!
  • GwendolyneGwendolyne Member Posts: 461
    edited July 2017
    Let's say you don't want to be able to cast Cure Light wounds (SPPR103).

    Create an innate spell myspell.spl with one header and no effects.
    Add one Casting feature effect:

    opcode: 172 Spell: Remove Spell [172]
    target: 1 Self
    timing: 1-Permanent
    resource: SPPR103
    resist: 0-Nonmagical

    Then in your CLAB.2da file, add the following line:
    ABILITYF    AP_GWCDSORT AP_GWCDSORT AP_GWCDSORT AP_GWCDSORT AP_GWCDSORT AP_GWCDSORT AP_GWCDSORT AP_GWCDSORT AP_GWCDSORT AP_GWCDSORT AP_GWCDSORT AP_GWCDSORT AP_GWCDSORT AP_GWCDSORT AP_GWCDSORT AP_GWCDSORT AP_GWCDSORT AP_GWCDSORT AP_GWCDSORT AP_GWCDSORT AP_GWCDSORT AP_GWCDSORT AP_GWCDSORT AP_GWCDSORT AP_GWCDSORT AP_GWCDSORT AP_GWCDSORT AP_GWCDSORT AP_GWCDSORT AP_GWCDSORT AP_GWCDSORT AP_GWCDSORT AP_GWCDSORT AP_GWCDSORT AP_GWCDSORT AP_GWCDSORT AP_GWCDSORT AP_GWCDSORT AP_GWCDSORT AP_GWCDSORT AP_GWCDSORT AP_GWCDSORT AP_GWCDSORT AP_GWCDSORT AP_GWCDSORT AP_GWCDSORT AP_GWCDSORT AP_GWCDSORT AP_GWCDSORT AP_GWCDSORT
    
    Notes: Replace GWCDSORT with MYSPELL. My CLAB file has 50 columns (level). You can restrict it to 40.

    Then at each level, the spell MYSPELL will be launched on your character and will remove SPPR103 from his spellbook. So he won't be able to learn it.

    Hoping it is more understandable than my code intended to forbid all the cleric spells from level 1 to 4.
  • The user and all related content has been deleted.
  • RaduzielRaduziel Member Posts: 4,714
    @Gwendolyne Sorry for taking so long in giving you a feedback. Your second solution worked perfectly :)

    Now I'm trying to understand how to set the area of effect of a spell, but I'll reverse-engineer something. Currently, I'm killing every living being in Easthaven.
  • GwendolyneGwendolyne Member Posts: 461
    Glad to have been of some help.

    The first one is the same, but thanks WeiDU, allows to write all the effects automatically on the fly. Helpful when it comes to deal with too numerous spells and to manage compatibility with various installs providing different codes for the same spells. ;)
  • RaduzielRaduziel Member Posts: 4,714
    edited July 2017
    @Gwendolyne

    Right now I'm just trying to discover how I can make a party friendly spell centered on the caster with 30-foot radius area of effect. :neutral:
  • RaduzielRaduziel Member Posts: 4,714
    Ok, now I'm officially asking for help. Turned Sunfire upside down and I can't make my spell work the same way.
  • GwendolyneGwendolyne Member Posts: 461
    Did you try INAREAPA.pro (158-Instant Area (Party Only) (INAREAPA)) as projectile with target = 5-Self ?
Sign In or Register to comment.