Checking area objects such as containers and doors.
Yo.
I need some help. Im currently making some thievery skills for none thieving classes.
The issues are ofc the hardcapped values none thief classes has.
So for hide in shadows im done, using hide() until level 6, then custom invisibility spell, ofc check of enemy in sight etc is added in script, and correct strings and sound used.
But for open locks it gets harder. I desided to go the spell route straight away.
Which works fine in many ways, i got XP bonus based on success, and i get correct strings for fail and success and i had to record a pick lock sound.
The issue here is that this spell ignores "Lock Difficulty". Which basicly means i could just cast the spell with 10% chance over and over again until it unlocked a container with 100% lock difficulty.
I dont understand how to live read the container/door lock difficulty.
Spell is using "Preset Target", which means i can use:
LastHitBy(Myself, MyTarget) as targeting system.
But reading this type of info is hard.
I have had ideas by giving the container a custom override BCS, and have it check its own stats somehow and then force me to cast a the open lock spells with use of ActionOverride.
Could anyone help me, found this topic, but dont find anything that looks normal in nearinfinity script.
https://forums.beamdog.com/discussion/1285/iesdp-unknowns?
I dont understand what this WORD is.
I need some help. Im currently making some thievery skills for none thieving classes.
The issues are ofc the hardcapped values none thief classes has.
So for hide in shadows im done, using hide() until level 6, then custom invisibility spell, ofc check of enemy in sight etc is added in script, and correct strings and sound used.
But for open locks it gets harder. I desided to go the spell route straight away.
Which works fine in many ways, i got XP bonus based on success, and i get correct strings for fail and success and i had to record a pick lock sound.
The issue here is that this spell ignores "Lock Difficulty". Which basicly means i could just cast the spell with 10% chance over and over again until it unlocked a container with 100% lock difficulty.
I dont understand how to live read the container/door lock difficulty.
Spell is using "Preset Target", which means i can use:
LastHitBy(Myself, MyTarget) as targeting system.
But reading this type of info is hard.
I have had ideas by giving the container a custom override BCS, and have it check its own stats somehow and then force me to cast a the open lock spells with use of ActionOverride.
Could anyone help me, found this topic, but dont find anything that looks normal in nearinfinity script.
https://forums.beamdog.com/discussion/1285/iesdp-unknowns?
I dont understand what this WORD is.
0
Comments
Got it 👍 You’re doing some deep Infinity Engine work there. Let’s go over what’s *actually* possible through the BCS (script) layer in Baldur’s Gate: Enhanced Edition and where the engine walls are.
---
### ⚙️ Background
Unfortunately, the **BCS scripting language cannot directly read internal structure values** like `m_lockDifficulty` or the locked flag from `CAreaFileContainer` or `CAreaFileDoor`. Those are stored in the **ARE** file and accessible only to the engine, not exposed via scripting triggers or actions.
However, you *can* check **certain container/door states** indirectly via:
* **`ObjectLocked("container")`** — true if the container or door is currently locked.
* **`ObjectOpened("container")`** — true if it has been opened.
* **`Global`/`Local` variables** — for storing custom difficulty or progression values.
* **`ActionOverride("container", Unlock())`** — to manipulate state.
* **`SpellCastOnMe()`** or **`See([PC])`** to respond to spells.
There is **no native BCS trigger or action** to read `LockDifficulty` (it’s purely an ARE field used by the engine when checking pick locks).
---
### 🧩 Practical Workaround
You can simulate reading `LockDifficulty` using a **parallel data table or globals**, e.g. you set the difficulty manually in your script system.
#### 1. Assign a custom script to the container/door
Make a container override script like this (e.g. `CONTAINER_OVERRIDE.BCS`):
```bcs
IF
Global("LockCheck","LOCALS",0)
ObjectLocked(Myself)
THEN
RESPONSE #100
// Optional feedback
DisplayStringHead(Player1,~This chest is locked.~)
// Force spell attempt
ActionOverride(Player1, ReallyForceSpell(Player1,MY_UNLOCK_SPELL))
SetGlobal("LockCheck","LOCALS",1)
END
IF
!ObjectLocked(Myself)
THEN
RESPONSE #100
DisplayStringHead(Player1,~The chest opens.~)
SetGlobal("LockCheck","LOCALS",0)
END
```
#### 2. Store or fake difficulty
Since you can’t read the ARE `m_lockDifficulty` directly, you can embed your own difficulty marker using:
* The container’s **script name** to look up a table value.
* A custom **global or local variable** that you define when the area loads.
Example (in area script):
```bcs
IF
Global("MyChestInit","AR0100",0)
THEN
RESPONSE #100
SetGlobal("LockDiff_MyChest","GLOBAL",70)
SetGlobal("MyChestInit","AR0100",1)
END
```
Then your spell or door script can retrieve `Global("LockDiff_MyChest","GLOBAL")` to simulate the lock difficulty.
---
### 🧠 Optional: Spell → Container Interaction
If your spell is cast and you want it to read/act on the container that triggered it:
```bcs
IF
SpellCastOnMe([ANYONE],MY_UNLOCK_SPELL)
ObjectLocked(Myself)
THEN
RESPONSE #100
// Example: pseudo lockpick chance roll
SmallWait(1)
DisplayStringHead(Myself,~Attempting magical unlock...~)
// Compare roll vs your global difficulty
// (since you can't access m_lockDifficulty)
END
```
---
### 🧱 Summary of Engine Limits
| Property | Accessible in BCS? | Workaround |
|
|
|
|
| `ObjectLocked()` | ✅ | Directly available |
| `ObjectOpened()` | ✅ | Directly available |
| `LockDifficulty` | ❌ | Use global/local lookup |
| `MagicallyLocked` flag | ❌ | Encode in script or name |
| `KeyType` | ❌ | Use manual table |
| `m_dwFlags` | ❌ | No direct access |
---
### 🧰 Next Steps
You can build your system by:
1. Giving containers a known `ScriptName`.
2. Storing custom difficulty values in globals keyed by script name.
3. Having a spell script check `ObjectLocked()` and compare to that stored value.
If you want, I can draft a full working example that:
* Assigns difficulty values per container name,
* Uses a custom spell to roll vs. those values,
* Auto-unlocks or displays messages based on success/failure.
Would you like me to write that full system (spell + container script + globals setup)?
One way you can give someone some actual thief skills by special ability is by having the ability summon an invisible monster that uses override to make the character hide or search (and probably do bard song, but it's been a while since I looked at the list of actions, so don't quite remember). I have an example somewhere, but can't find it ATM. I know I've done it for my Camouflage spell, but I can't find the code ATM. Here is the description. Best to search by the name:
https://github.com/Grammarsalad/Spells_and_Magic/issues/23
Also, now you can just give non thief classes thief buttons and skills using EEex. You can't allow thief skill selection for other classes since a more recent (as in a few years ago) EEex update, but button assignment and skill assignment by opcode in the clab is a viable option:
https://forums.beamdog.com/discussion/71798/mod-eeex-v0-10-2-alpha/p1
Thanks i will look true it tomorrow
I made hide in shadow script work, the issue is that none thiefs has strict caps in thieving skills.
So i use Hide() until level 5, then change into casting a invisibility spell on myself over level 5, with xx% chance to roll succes, but only casted if i dont see enemies, and the spell is level progression. As well as correct strings and sound.
I have made everything ready in form of open lock and find trap spell, it will scale both xp and chance by level. The issue is reading containers/doors lock/unlock, trap/not trapped flags, as well as lock difficulty and trap difficulty.
So my and chatgpt plan was to use tp2 file to copy all area codes and make gobal values i can actually read live and decide theese things with my override script.
But the invisible creature could work fine as well, just make it a thief and scale its summon by level. Should give xp and acting real as well.
For pickpocket i had something simular of thinking, clone myself, then have it change class to thief etc, or simply a summon. Which i can party by dialog if needed for store stealing.
So ye, maby the invisible creature would be best. But hard to scale such, as it would increase in level in legacy of bhaal?