Skip to content

Trap Detection/Recovery/Evasion

2

Comments

  • kjeronkjeron Member Posts: 2,368
    @4ltair The bed with the Human Flesh isn't trapped, nor is it a container, door, or a proximity trigger (it's classified as an info trigger), so the mod shouldn't even be looking at it, which is what I see on my end. Do you have any other mods that might be altering the bed prior, I may need to add something for compatibility?
  • 4ltair4ltair Member Posts: 24
    edited September 2019
    I have a full vanilla install, except your mod.

    You are correct, that script of the bed with the human flesh is not touched by the mod but it has a "Bed" variable and the same "Bed" variable is also present in the script of the trapped bed, which is modified by the mod.

    If the trap script changes this variable first, the human flesh script is not working anymore (it checks for Bed variable with value 0 or 1 and the trap script changes it to 12 or -1).

    I did a test where i did not detect the trap on the bed and the human flesh script is working ok but as soon as i detect that trap before interacting with the other bed, i only get the message that there is nothing under it.


    This is the human flesh script:
    IF
    	Clicked([ANYONE])
    	Range(LastTrigger,9)
    	Global("Bed","AR0502",0)
    THEN
    	RESPONSE #100
    		DisplayString(Myself,27913)  // There is a revolting stench coming from beneath the bed. It smells of decay. You could search beneath the bed if you wish to.
    		SetGlobal("Bed","AR0502",1)
    END
    
    IF
    	Clicked([ANYONE])
    	Range(LastTrigger,9)
    	Global("Bed","AR0502",1)
    THEN
    	RESPONSE #100
    		DisplayString(Myself,27914)  // Beneath the bed, you find a mass of pale skin sewn into the shape of a tunic.
    		GiveItemCreate("LEAT22",LastTrigger,0,0,0)  // Human Flesh
    		SetGlobal("Bed","AR0502",2)
    END
    
    IF
    	Clicked([ANYONE])
    	Range(LastTrigger,9)
    THEN
    	RESPONSE #100
    		DisplayString(Myself,27915)  // There is naught else beneath the bed but flies and blood stains.
    END
    

    This is the trap code:
    IF
    	Disarmed([ANYONE])
    THEN
    	RESPONSE #100
    		SetGlobal("Bed","MYAREA",-1)
    END
    
    IF
    	OR(3)
    		Detect([GOODCUTOFF.0.0.THIEF_ALL])
    		Detect([GOODCUTOFF.0.0.MONK])
    		Detect([GOODCUTOFF.0.0.SHAMAN])
    	Range(LastSeenBy,15)
    	!StateCheck(LastSeenBy,STATE_BLIND)
    	!CheckStatLT(LastSeenBy,20,TRAPS)
    	!CheckStatLT(LastSeenBy,5,LORE)
    	TriggerOverride(LastSeenBy,ModalState(DETECTTRAPS))
    	!GlobalTimerNotExpired("Bed","MYAREA")
    	ActionListEmpty()
    THEN
    	RESPONSE #100
    		Wait(1)
    		DisplayStringHead(Myself,103256)  // Call Lightning Trap
    		ReallyForceSpellRES("__0000",Myself)  // No such index
    		SetGlobalTimer("Bed","MYAREA",TWO_ROUNDS)
    END
    
    IF
    	OR(3)
    		Detect([GOODCUTOFF.0.0.THIEF_ALL])
    		Detect([GOODCUTOFF.0.0.MONK])
    		Detect([GOODCUTOFF.0.0.SHAMAN])
    	Range(LastSeenBy,15)
    	!StateCheck(LastSeenBy,STATE_BLIND)
    	!CheckStatLT(LastSeenBy,20,TRAPS)
    	CheckStatLT(LastSeenBy,5,LORE)
    	TriggerOverride(LastSeenBy,ModalState(DETECTTRAPS))
    	!GlobalTimerNotExpired("Bed","MYAREA")
    	ActionListEmpty()
    THEN
    	RESPONSE #100
    		Wait(1)
    		DisplayStringHead(Myself,103243)  // Trap
    		ReallyForceSpellRES("__0000",Myself)  // No such index
    		SetGlobalTimer("Bed","MYAREA",TWO_ROUNDS)
    END
    
    IF
    	Detect([GOODCUTOFF])
    	Range(LastSeenBy,15)
    	CheckSpellState(LastSeenBy,FIND_TRAPS)
    	!CheckStatLT(LastSeenBy,5,LORE)
    	!GlobalTimerNotExpired("Bed","MYAREA")
    	ActionListEmpty()
    THEN
    	RESPONSE #100
    		Wait(1)
    		DisplayStringHead(Myself,103256)  // Call Lightning Trap
    		ReallyForceSpellRES("__0000",Myself)  // No such index
    		SetGlobalTimer("Bed","MYAREA",TWO_ROUNDS)
    END
    
    IF
    	Detect([GOODCUTOFF])
    	Range(LastSeenBy,15)
    	CheckSpellState(LastSeenBy,FIND_TRAPS)
    	CheckStatLT(LastSeenBy,5,LORE)
    	!GlobalTimerNotExpired("Bed","MYAREA")
    	ActionListEmpty()
    THEN
    	RESPONSE #100
    		Wait(1)
    		DisplayStringHead(Myself,103243)  // Trap
    		ReallyForceSpellRES("__0000",Myself)  // No such index
    		SetGlobalTimer("Bed","MYAREA",TWO_ROUNDS)
    END
    
    IF
    	Opened([ANYONE])
    THEN
    	RESPONSE #100
    		DisplayString(LastTrigger,14381)  // Trap Sprung
    		ForceSpell(LastTrigger,TRAP_CALL_LIGHTNING)  // SPPR987.SPL (Call Lightning)
    END
    
    
    
  • kjeronkjeron Member Posts: 2,368
    Ah, conflicting script names between the different beds, I misunderstood you the first time.
    Thanks for the details. I've added some code to differentiate them, the bed with the Human Flesh will now use a variable matching it's name (bed_click).
  • 4ltair4ltair Member Posts: 24
    Another solution could be adding some randomness to variable names used in trap scripts, either as Bed123 or Bed_AR0502 for example.
  • kjeronkjeron Member Posts: 2,368
    AR0502 is technically already a part of both variable names, added on automatically as "AR0502BED", so it doesn't conflict with other areas.

    I derive the variable name for each script from it's object name, which is supposed to be unique within each area anyway, so this should just be a rare exception, but if it's not I'll look into extending the variable name with an extra unique ID.
  • deratiseurderatiseur Member Posts: 258
    Really cool mod. Thank you :)
  • Adam_en_tiumAdam_en_tium Member Posts: 99
    Hello,
    This mod looks fantastic !!!
    Is it possible to install for my current run or do I need to wait for my next playthrough ?
    Thanks :)
  • LZennerLZenner Member Posts: 19
    edited July 2020
    @kjeron I crashed to desktop when I set multiple traps near one another. Had 3 in the same area (Durlag's Tower), Fear tripped one before chasing me. When I led him to the others, CtD while he approached them. One trap was a web, a fireball, and call lightning. I think the web had been fired, but not positive, since I was running in the opposite direction at the time (didn't want to be hit by my own fireballs LOL). This is in Windows, EET using cdTweaks and a few NPC mods that shouldn't have interfered. If you need me to repeat the process to gather data, let me know. I didn't make incremental saves so would have to do it all again, but that's ok.

    EDIT: Verified in NI that the 2 that were left were the call lightning and fireball traps.
    Post edited by LZenner on
  • kjeronkjeron Member Posts: 2,368
    edited July 2020
    @LZenner its the Call Lightning Trap. Apparently the hard-coded Call Lightning projectiles cannot be used as explosion projectiles. I'll likely insert an exception to replace any recovered Call Lightning Trap with a single-shot version, as soon as I finish testing uploaded.
    I would not update an existing game though, just avoid using the Call Lightning traps you recover.
  • LZennerLZenner Member Posts: 19
    Ok, thank you! That was quick... :)
  • EndarireEndarire Member Posts: 1,519
    edited September 2020
    @kjeron
    May we get the latest version of this uploaded to GitHub and the first page's link be updated to that so the mod has more visibility and we know what's latest?

    Is this mod compatible with EET? Rogue Rebalancing? Might and Guile? Epic Thieving? Other similar mods? What's the best place for it in the install order?

    What else at present?

    Thankee!
  • kjeronkjeron Member Posts: 2,368
    Endarire wrote: »
    @kjeron
    May we get the latest version of this uploaded to GitHub and the first page's link be updated to that so the mod has more visibility and we know what's latest?
    I do not use GitHub. The latest version is listed in the first post (as part of the filename).
    Endarire wrote: »
    Is this mod compatible with EET? Rogue Rebalancing? Might and Guile? Epic Thieving? Other similar mods? What's the best place for it in the install order?
    No reason it wouldn't be - it makes no changes to thieves or any other class, the changes are strictly to the areas and their trap scripts. The later the better, but at least after mods that add/alter areas and/or alter spells (enough to alter their description).
  • EndarireEndarire Member Posts: 1,519
    EET uses different area codes for BG2/ToB than default.
  • GraionDilachGraionDilach Member Posts: 593
    edited January 2022
    The en_US.tra file of this mod's encoded in ANSI, corrupting the description of the Dire Charm traps, the Magic Missile trap and the Fireball trap. (noticed it via NI's relatively new check for corrupted texts option).
  • kjeronkjeron Member Posts: 2,368
    edited January 2022
    That's what I get for directly copying them from Near Infinity. Damn — character. Was time for a new version anyway.
    v0.20 adds new option - Anyone Unlock. Anyone can click on locked door/container and will attempt to unlock it.
  • EndarireEndarire Member Posts: 1,519
    @kjeron
    May we get cross-mod compatibility with Thieving Skills for Bards, especially for Fast Trap Detection? What about allowing anyone (optionally only anyone with thieving skills) to use Fast Trap Detection?

    May we also get formal EET compatibility if it doesn't already exist in this mod?

    Thankee!
  • suysuy Member Posts: 30
    Thank you for the update, kjeron!

    Can you clarify what the new component does? The "anyone" on the name makes me think that anyone can actually pick locks. Or it's just that it's a kind of automated check to make a character use the pick locks on a nearby container? I'm confused, sorry. :-)
  • kjeronkjeron Member Posts: 2,368
    edited February 2022
    It will trigger a "PickLock()" action for any character, no matter class, but it is still dependent on the characters actual skill with Pick Locks.

    By default, it's not much more than a convenience for the Cleric/Thief, whose thieving button is hidden in the special abilities menu.
    This is mostly because non-thieves do not receive their DEX/RACE bonuses to thieving skills (because of a 0x multiplier).

    However, any modded item/class/kit that gives points to Open Locks skill, or grants them their DEX/RACE bonus, will be able to utilize it without requiring the Thieving button.
  • UlkeshUlkesh Member Posts: 280
    edited June 2023
    please delete.


    Post edited by Ulkesh on
  • gregyk75gregyk75 Member Posts: 3
    Hi Kjeron,
    Thanks for the mod. I'm new to the forum, am having issues with the v0.20 (installing on MacOS):

    Parse error (state 852) at ~~

    [TRAP_OVERHAUL/SETUP-TRAP_OVERHAUL.TP2] PARSE ERROR at line 6 column 16-40
    Near Text: DEFINE_DIMORPHIC_FUNCTION
    GLR parse error

    [TRAP_OVERHAUL/SETUP-TRAP_OVERHAUL.TP2] ERROR at line 6 column 16-40
    Near Text: DEFINE_DIMORPHIC_FUNCTION
    Parsing.Parse_error
    ERROR: parsing [TRAP_OVERHAUL/SETUP-TRAP_OVERHAUL.TP2]: Parsing.Parse_error
    ERROR: problem parsing TP file [TRAP_OVERHAUL/SETUP-TRAP_OVERHAUL.TP2]: Parsing.Parse_error

    FATAL ERROR: Parsing.Parse_error


    Many thanks in advance !
    Loving your various mods so far :)
  • jmerryjmerry Member Posts: 3,881
    What version of WeiDU are you using? DEFINE_DIMORPHIC_FUNCTION was added with WeiDU version 247, so you need that or a more recent version in order to install this mod. The latest version is 249, available here.
  • gregyk75gregyk75 Member Posts: 3
    jmerry wrote: »
    What version of WeiDU are you using? DEFINE_DIMORPHIC_FUNCTION was added with WeiDU version 247, so you need that or a more recent version in order to install this mod. The latest version is 249, available here.

    Thanks for the quick reply.

    No it's not that, I'm using v249 already.
  • kjeronkjeron Member Posts: 2,368
    @gregyk75 Unless this is a some weird disconnect between Windows and MacOS weidu versions, I have no idea how such a parse error could be user-dependent like this.
  • jmerryjmerry Member Posts: 3,881
    edited April 2023
    And this looks exactly like a "old version of WeiDU" error. It's a syntax error in the preamble. Which definitely should work, because this has been tested. I just checked for myself, and saw the menu properly.

    My setup: Mac, using the Mac WeiDU Launcher tool, with WeiDU v249 - that is, the copy of WeiDU contained in MWL is v249.
  • gregyk75gregyk75 Member Posts: 3
    Thank you both.

    I ended up creating a new game folder and it worked fine, not sure what happened but now it's on and it's great !
  • UlkeshUlkesh Member Posts: 280
    Hello Kjeron,
    two questions:

    1) What are the differences between this mod and the following one (https://github.com/BGforgeNet/bg2-tweaks-and-tricks) when it comes to fast trap detection?

    2) I also noticed that the mod linked above also has "Increase detection range" ("Increases the range to line of sight"). Does yours have it too, or the detection range is "vanilla"? (even if I tend to this you increase it to LoS given your statement "Some caution must still be taken when going around corners/through doorways (anywhere that blocks LoS)."
  • kjeronkjeron Member Posts: 2,368
    Ulkesh wrote: »
    1) What are the differences between this mod and the following one (https://github.com/BGforgeNet/bg2-tweaks-and-tricks) when it comes to fast trap detection?
    I think the only differences are which Classes and which States are checked:
    I only check for not being Blinded, since being in Find Traps modal already excludes having other problematic states.
    I don't run any CLASS check, any character that manages the Find Traps modal or Find Traps spell active can detect them.
    Ulkesh wrote: »
    2) I also noticed that the mod linked above also has "Increase detection range" ("Increases the range to line of sight"). Does yours have it too, or the detection range is "vanilla"? (even if I tend to this you increase it to LoS given your statement "Some caution must still be taken when going around corners/through doorways (anywhere that blocks LoS)."
    My Range is 15', which I think is vanilla.
  • UlkeshUlkesh Member Posts: 280
    kjeron wrote: »
    My Range is 15', which I think is vanilla.
    I would like to request a line of sight detection plugin :P, unless you think it's wasted work.
  • kjeronkjeron Member Posts: 2,368
    edited June 2023
    It's a simple enough edit if you want to do it yourself. Just change lines 974 & 997 in the .tp2 from:
    Range(LastSeenBy,15)
    
    to
    Range(LastSeenBy,30)
    
    before installing.
  • dunehunterdunehunter Member Posts: 10
    Hi, I download the mod and put it in Project Infinity's mods folder, but the tool cannot detect it, any idea?
Sign In or Register to comment.