Skip to content

Trap Detection/Recovery/Evasion

kjeronkjeron Member Posts: 2,367
edited January 2022 in General Modding
I've seen several threads related to these ideas, but never any actual mods to implement them, so I decided to try my hand at them. This mod has 4 optional parts:

Fast Trap Detection - Any Monk/Thief/Shaman using "Detect Traps" modal with sufficient Find Traps skill will detect traps as soon as they are within detection range. If they're lore is at least 50% of the necessary detection value, they will also detect what type of trap it is. Some caution must still be taken when going around corners/through doorways (anywhere that blocks LoS).
- The Cleric's Find Trap spell is now also updated to be detected by traps in the same way, and will automatically identify the type of trap.

Trap Recovery - Anytime a trap is disarmed, if the thief's Find Traps skill is at least 125% of the removal score then they will recover the trap, which they may then set similar to their own Snares (dependent on the Set Traps skill). All such traps have a proximity radius of 4 ft and require 15 lore to ID (but not to use). Only traps that can be reproduced (cast spells) can be recovered. Traps that cast normal spells will pull their description from the spell itself, but traps that use trap spells have pre-written descriptions, so there may be some inconsistencies if they've been modified.

Monk Trap Evasion - Monks can bypass (without triggering) traps if their Find Traps skill is high enough to detect the trap.
- This component only applies to area traps, not container/door traps.

(New v0.20)
Anyone Unlock - clicking on a locked door or container, while close enough, will have the character attempt to unlock it with the Open Locks skill.
- Locks that require a key or scripted event will not be attempted.
- Some positioning may be required for certain doors, as the character must be able to see it.

Area files are updated with new trap scripts, so this will not work in any areas that an existing game has already visited. For the same reason, I would not update to a new version of this mod on an existing game.
Post edited by kjeron on
RaduzielThacoBellGusindaronaldoFlashburnGrammarsaladlefreutStummvonBordwehrArdulOlvynChurulolienZaghoulJuliusBorisovMantis37rsw0x_Luke_CrevsDaak4ltairBlackraven
«13

Comments

  • RaduzielRaduziel Member Posts: 4,714
    I didn't even know I want this until this moment. Good job!
    ThacoBellStummvonBordwehrlolien
  • The user and all related content has been deleted.
  • kjeronkjeron Member Posts: 2,367

    Very cool. If traps use .SPL effects (I know at least some do), you could use my spell evasion function to allow characters to evade trap effects that are triggered.

    I had never actually looked to check, but even in IWDEE, none of the trap spells are setup for an Evasion check, even those that should be, like fireballs/lightning bolts.
    Raduziel
  • The user and all related content has been deleted.
    Raduziel
  • dorifdorif Member Posts: 16
    very nice mod !
  • LoldrupLoldrup Member Posts: 291
    Could the cleric 'Find traps' spell be modified to also reveal the type of the trap found? That would give clerics a nice edge, as they often have appropriate defensive spells to mitigate various types of damage (heat/cold at least...).

    In general, it would be nice for casters to be able to know the type of damage of a trap, since that would allow them to evade them more intelligently than simply walking over or around them.
    [Deleted User]
  • kjeronkjeron Member Posts: 2,367
    Loldrup said:

    Could the cleric 'Find traps' spell be modified to also reveal the type of the trap found?

    So far I've not had any luck. Either traps can't detect spellstates or something else is interfering.
  • UlbUlb Member Posts: 295
    kjeron said:

    Loldrup said:

    Could the cleric 'Find traps' spell be modified to also reveal the type of the trap found?

    So far I've not had any luck. Either traps can't detect spellstates or something else is interfering.
    You could probably have a helper creature set the caster's modal state via 'ActionOverride(LastSummonerOf(Myself),FindTraps())'.

    Of course, it is kinda easy to break a modal state so you'd either have to have the creature stick around and re-apply it or edit the spell in away that makes it clear that the caster has to "concentrate" for the detection to continue.

    Nvm, at that point it would probably be easier to have the helper creature do the detecting and follow the summoner around?
  • kjeronkjeron Member Posts: 2,367
    edited December 2018
    I found the issue - I just needed a nights rest and a clear head to spot my error. I'll post an update later today. Updated, also found/fixed a rather obvious bug, not sure how it's gone unnoticed.

    The changes will require manually uninstalling the old version before replacing it with the new, and it will likely not be compatible with saved games from the prior version.
    Post edited by kjeron on
  • TheTHXTheTHX Member Posts: 4
    hi,
    does it work with IWD:EE ?
  • kjeronkjeron Member Posts: 2,367
    @TheTHX it should, yes.
  • RaduzielRaduziel Member Posts: 4,714
    Knowing Kjeron's work like I do it will work even with Minecraft.
    Grammarsalad_Luke_
  • TheTHXTheTHX Member Posts: 4
    edited January 2019
    i ve a issue

    give u txt version from debug file
  • TheTHXTheTHX Member Posts: 4
    GREAT !
    Thx u so much :smile:
    JuliusBorisov
  • FlashburnFlashburn Member Posts: 1,847
    I tried to install option 7 on BG1EE+SoD on v2.3 and it didn't work. I probably have to update to the dreaded v2.5, don't I?
    8dbwlb17f147.png
  • kjeronkjeron Member Posts: 2,367
    @Flashburn updating to v2.5 shouldn't be necessary, I'm not sure what happened (this should have been caught already), but it should be fixed now (v0.1).
    RaduzielFlashburnGusindalolien
  • rsw0xrsw0x Member Posts: 3
    Hi, great mod. Worked fine in BGEE/SoD, but there's a bug with BG2EE where it displays the wrong strrefs. Using the "Fast Trap Detection" part only(#2)
  • kjeronkjeron Member Posts: 2,367
    @rsw0x Sorry about that - two lines got misplaced in the previous update, new version up (v.11).
    rsw0x
  • ArthasArthas Member Posts: 1,091
    edited June 2019
    Hello,
    is this compatible with EET and BGT ?
  • kjeronkjeron Member Posts: 2,367
    @Arthas I don't know of any reason why it wouldn't work on EET - it reads the game files "as is", the only pre-defined aspects are the names/descriptions for the default trap spells that otherwise lack any, which AFAIK are the same between BGEE and BG2EE, so they should line up.

    BGT (or any of the originals) will not work for Trap Detection - support for the Find Traps spell uses EE-only mechanics. The Trap Recovery and Monk-Evasion components might still work, however, I cannot test on the original games.
    Arthas
  • FlashburnFlashburn Member Posts: 1,847
    @kjeron
    The monk trap evasion component may be bugged. Walking over a detected trap properly lets the monk ignore it, but the trap will fire as soon as Find Traps mode is turned off for any reason. This happens regardless of distance away from the trap or time elapsed since the trap was walked over.

    I say it may be bugged because I also play with Ding0Tweaks which lets anyone set off traps, which could be interfering with it, but I install it before Trap Overhaul.
  • kjeronkjeron Member Posts: 2,367
    @Flashburn you're correct - it would appear that the IESDP is incorrect about the "Entered()" triggers behavior, I'll have to look for an alternative. I might have to remove the the modal check and let monks automatically bypass them if their find traps skill is high enough.
    Flashburn
  • kjeronkjeron Member Posts: 2,367
    @Flashburn - I have been unable to find a working alternative, so for now I've removed the requirement for monks to be in Detect Traps modal to evade traps, they will only need sufficient find traps skill.
    Flashburn
  • AquadrizztAquadrizzt Member Posts: 1,065
    Excellent work as always @kjeron. You always find really cool things to implement.
    CrevsDaakGrammarsalad
  • 4ltair4ltair Member Posts: 24
    First of all, brilliant work, this is exactly what i was looking for.

    And a possible bug report: after disarming some traps in the basement of Durlag's Tower, the trap names kept appearing after the traps were disarmed, even after i unlocked the container and taken an item from it.
    If it helps, the traps in question were the 3 traps (2 containers and 1 ground traps) in the small room just left of the entrance on the level with Love, Fear, Avarice ...
  • kjeronkjeron Member Posts: 2,367
    @4ltair
    I've not been able to reproduce the issue, and cannot find anything special about the containers/floor trap you refer to (see image to verify correct room).
    98g7faowssae.png
    Which install option did you use? Are the traps actually still active (trigger) after being disarmed, or is it just the name display?
  • 4ltair4ltair Member Posts: 24
    edited September 2019
    Indeed, those are the traps that i was referring to.
    Mod version is v0.12 and i have installed only option 2, Fast Trap Detection.

    I looked a bit in the install code (the Trap_Overhaul.tp2 and it seems that when option 2 is selected during install, the trap code is missing the part contained in .../inlined_temp_script_subx.baf. I have modified the script to include it (see below) and then the mode behaved correctly.

    ACTION_IF	sub2 = 1	BEGIN
    	EXTEND_TOP ~%bcs%.bcs~ ~.../inlined_temp_script_subx.baf~ EVAL
    	EXTEND_TOP ~%bcs%.bcs~ ~.../inlined_temp_script_sub2.baf~ EVAL
    END
    

    Also, a bit of a side question: do you know if it is possible to mod the code which handles the Detect Trap/Illusion or that's hard-coded in the game engine?
  • kjeronkjeron Member Posts: 2,367
    4ltair wrote: »
    Indeed, those are the traps that i was referring to.
    Mod version is v0.12 and i have installed only option 2, Fast Trap Detection...
    That was the issue - not installing Trap Recovery wasn't adding the disable code, fixed and uploaded.
    (What you added will work as long as you don't install the Trap Recovery option, minor change was still needed for both to work.)
    4ltair wrote: »
    Also, a bit of a side question: do you know if it is possible to mod the code which handles the Detect Trap/Illusion or that's hard-coded in the game engine?
    The general mechanic is hardcoded.
  • 4ltair4ltair Member Posts: 24
    Wanted to report another bug: the trap script from the bed in the tanner's cellar interferes with the bed script that gives you the Human Flesh armor (both use the same "Bed" variable).

    If you don't detect the trap from the bed, the script for the human flesh works as it should and you get the armor; if you detect the trap and then you try to get the armor, you only receive a message that there is nothing under the bed.
    CrevsDaak
Sign In or Register to comment.