Skip to content

[(BG1\2)] Opcodes 146, 148 and 177 when used on/by containers

GalactygonGalactygon Member, Developer Posts: 412
edited November 2012 in Fixed
CURRENT BEHAVIOR (BG1,2):

Opcode 146 works on containers but setting param2 "Type" to 1 does not. The .spl is cast normally (as if param2=0) rather than applied (when param2=1) silently. Download attachment SPWI207 (Knock) and then cast it on any container to reproduce.

Opcode 148 does not work with containers. Opcode 148 can be useful if you have many .spls embedded/cast by one spell. Download attachment SPWI011, CLUA yourself to AR3016 (BGII: ToB), and open the trapped containers at x=1145 y=860 or x=1365 y=860 to reproduce.

[See SPWI011 and SPWI207 attachments in the second post]

Opcode 177 crashes the game if used by a container (such as a trap) to summon a creature for example. I made this report more than a year ago in the ToBEx forums:
http://www.shsforums.net/topic/47510-withheld-cast-spell-at-creature-opcode-mod/page__view__findpost__p__508854
This can be reproduced in BGII:ToB by downloading SPWI810.spl (Incendiary Cloud) from the attachment in the above linked post, and then CLUA-ing yourself to AR6012 (BGII:ToB) to open the trapped bookcase.
Post edited by Tanthalas on

Comments

  • GalactygonGalactygon Member, Developer Posts: 412
    EXPECTED BEHAVIOR:

    Opcode 146 param2=1 should work as intended, you should be able to launch a fireball onto the container/door of your choosing without disrupting any subsequent actions

    Opcode 148 should work, the two trapped containers in AR3016 should launch a fireball and a flame arrow to the trap triggerer.

    Opcode 177 should not crash the game, the marilith should be summoned normally.

    [Still can't post long posts]

    -Galactygon
  • GalactygonGalactygon Member, Developer Posts: 412
    I would like to add that spells cast via traps are cast at level one - this is not a problem in BG1, where traps use a different spell from regular spells.

    This can be a problem in BG2, especially ToB where traps use the same version spell as cast by the PCs. There are plenty of unused bytes in the container header of the .are file format, so it's possible to set one short to determine the casting level of the priest/wizard/innate .spl.

    -Galactygon
  • CuvCuv Member, Developer Posts: 2,535

    There are plenty of unused bytes in the container header of the .are file format, so it's possible to set one short to determine the casting level of the priest/wizard/innate .spl.

    -Galactygon

    Heck yeah! If they have the time to add that in, would be very helpful.

  • SethDavisSethDavis Member Posts: 1,812
    edited August 2012
    @Galactygon - Ok, I think I have 146 and 148 working. Do you want the behvaiour to be applied to doors/triggers as well?

    I think I have 177 working. There may be some files missing for the DEMOSUMM effect, but SUMDJINN works fine.
    Post edited by SethDavis on
  • GalactygonGalactygon Member, Developer Posts: 412
    @SethDavis

    146, 148: Yes, they should work if 146 is cast onto a door (even if nested in a 177 that calls for an EA of INANIMATE), and 148 should work if it's cast by the trap (note: 148 almost always uses target=self). In other words, the trap should be able to cast the 148 just like a normal .cre.

    177 is not working (tested in BGII:ToB) due to a memory leak which is fixed by ToBEx. I'll drop @Ascension64's name, since he knows about this more than I do.

    -Galactygon
  • Ascension64Ascension64 Member Posts: 560
    146, 148: I haven't had anything to do with these.
    177: Reported in TobEx bugs as A64_16.

    O: Effect #177 “Use EFF File” causes a crash when used in a trap script for containers/doors because of double delete
    E: Effect #177 “Use EFF File” does not cause a crash when used in a trap script for containers/doors

    Sounds like 177 got fixed anyhoo.
  • SethDavisSethDavis Member Posts: 1,812
    @Ascension64 - The 177 problem was an improperly set up if chain where the first case would delete the effect, but allow the function to continue to check and eventually delete it again. The second delete was causing the crash by attempting to delete member pointers in the destroyed structure which were set to 0xfeeefeee rather than NULL. Does this line up with the ToBEx fix or have I just avoided the real problem?
  • Avenger_teambgAvenger_teambg Member, Developer Posts: 5,862
    Well, since Asc64 also mentioned double delete, i think you swatted the bug squarely :)
    At least, definitely killed one bug.
  • SethDavisSethDavis Member Posts: 1,812
    edited August 2012
    That's what I get for only having a few hours of sleep lol, completely missed the "because of double delete"

    Potentially fixed - The behaviours have been extended onto doors and traps.
  • Ascension64Ascension64 Member Posts: 560
    @SethDavis: Smack! Bang! Crash! You got it. :)
  • BhryaenBhryaen Member Posts: 2,874
    @Ascension64
    Is Opcode 177 handled by ToBEX16 then? I'll probably cross-list this one to keep filling out the ToBEx numbers... if I can figure out how to test any of the three Opcodes...
  • Avenger_teambgAvenger_teambg Member, Developer Posts: 5,862
    Only 177 was tied to tobex 16, so you are free to link it to this bugfix and consider it implemented.
  • TanthalasTanthalas Member Posts: 6,738
    Did anyone actually test this?
  • BhryaenBhryaen Member Posts: 2,874
    @Tanthalas
    Doesnt look like it. I started to last night- downloaded the files mentioned- but I'm not sure yet how to test it in-game both in vBG1 and BGEE to see if it crashes the former and works in the latter
  • Ascension64Ascension64 Member Posts: 560
    edited September 2012
    Opcode 177 tested.
    Modified ACT11.BCS to:
    IF
    Opened([ANYONE])
    THEN
    RESPONSE #100
    ForceSpellRES("SPWI810",Myself)
    END
    Got SPWI810.SPL from http://www.shsforums.net/topic/47510-withheld-cast-spell-at-creature-opcode-mod/page__view__findpost__p__508854.
    Modified DEMOSUM1.EFF to summon Ajantis instead of Marilith.
    Started new game, went into Candlekeep Inn, lock bashed the drawers, and then opened.
    Viola, a very very violent Ajantis!

    Haven't tested the other two opcodes.

    As a side note, because all the BIOWARE_ASSERTs have been removed, an invalid CRE animId now just crashes the game without any message.
  • BhryaenBhryaen Member Posts: 2,874
    edited September 2012
    Confirmed still learning how to test this...

    -OPCODE177:
    Sought out the original source in vBG2's AR6012 mentioned by @Galactygon in the outside link mentioned in the OP, created a BGEE trap BCS using the same script from AR6012's trap- i.e.:
    IF
    OR(2)
    Entered([ANYONE])
    Opened([ANYONE])
    THEN
    RESPONSE #100
    DisplayString(LastTrigger,14381) // Trap Sprung
    ForceSpell(LastTrigger,WIZARD_INCENDIARY_CLOUD)
    END
    Then placed the spell SPWI810 from the outside link to Overrides, trapped the bookcase in Withrop's Inn and added the new BCS to it, went in-game and opened the bookcase... Crashed game. It did start to make a fire animation though, showed the "Trap Sprung" display string, and the noblefolks started running for the door. Maybe that spell won't work in BGEE for some reason? Missing resources?

    All that said, I don't see where OPCODE177 ever shows up in the preparation for that test, so...


    -OPCODE146
    Created a scroll that casts SPWI207(Knock), downloaded the attached SPWI207 and put it in Overrides. Went in-game, clicked to use the spell... Fireball exploded on caster... ??? No crash... :-)


    -OPCODE148
    Looked for one of the containers in AR3016 mentioned in the OP, found one at 1347,885 (Container 4, "Table2") that was trapped. Copied the trap BCS and created it for BGEE:
    IF
    Opened([ANYONE])
    THEN
    RESPONSE #100
    DisplayString(LastTrigger,14381) // Trap Sprung
    ForceSpell(LastTrigger,TRAP_ARROW_FIRE)
    END
    Added it to the locked chest in WIthrop's inn. Went in-game and... Success: exploding arrow shot in from... somewhere. Boom-o. Again no crash.


    No idea if any of that is an improvment... Or a valid test...
    Post edited by Bhryaen on
  • TanthalasTanthalas Member Posts: 6,738
    @Bhryaen

    Now that I think about it, from reading Ascension64's post you're probably getting a crash because Marilith's aren't present in BGEE. You could probably try getting it from BG2 and dropping it in the override.

    Though, it looks like Ascension already confirmed that one to be working anyway.
Sign In or Register to comment.