How to Traps work?

Any developer realated stuff
Post Reply
Maven
Posts: 138
Joined: Sat Apr 16, 2011 9:39 pm

How to Traps work?

Post by Maven »

Normally, I pretty much ignore traps. I TRZP them if I have to. But I ran a campaign with no magic users, and I had to deal with them some more. Now I'm curious. Let me post what I think and see what you guys can add to my findings.

I built a party to do some tests, and here's what I found out so far.

There are two kinds of Traps. One you step on, and the other is attached to chests. This is about the kind on chests:

In the first level of the Cellars, the only kind of trap I found was Poison Needle.

Even at level one, I seldom had to worry about this trap if I had 18 luck. (I know it isn't normal to have 18 luck at level one. I didn't want my trap testing party dying too much so I raised them a bunch of levels and then went and insulted the Specter until they were all back to level one. That way I have decent hit points. But now all my tests start with 18 luck.)

Sometimes there is no trap on the chest. In which case you always are able to disarm it, even if you type in garbage for the trap guess.

If there IS a trap on the chest, I was only able to set it off about one time in 20 when typing in garbage for the trap guess. If I ever typed in POISON NEEDLE, it was always disarmed successfully.

Examining the chest was successful about a quarter of the time. This is consistent with what Drifting posted once in another thread.

If I went down one level, I was able to sometimes get a DARTS trap.

My guess is that there is a level associated with certain kinds of traps. I noticed in my Fighter campaign that different kinds of traps showed up in deeper levels of the dungeons. Gas Clouds in the cats. MindTraps in the castle. My guess is that the Dungeon Difficulty byte of the dungeon data structure determines this.

I think the level of difficulty also determines how likely I am to be hurt by the trap, and how much damage it does. I think Luck plays a big part in this, and character level as well. It might be a straight save using the saving throw algorithm that is used for running from encounters and repelling spells. In which case it would cap at level 36.


Now, about traps that you step on. In the IBM PC Version, these traps report Basilisk Snare or Gas Cloud, but they don't stone anyone or poison anyone. They just do damage.

But they seem to have different names as the dungeon levels progress, and they seem to do more damage, as well.
User avatar
Darendor
Posts: 1502
Joined: Wed Jan 14, 2009 1:53 am
Location: Red Deer, Alberta, Canada

Post by Darendor »

I'm presuming you refer to Bard's Tale I.

The chest traps are all stored in a single file on the dungeon disk, while the dungeon traps are hardcoded into memory. I think.

I know that if you happen to guess the name of the trap without checking the chest, you automatically will disarm it. I've done this on occasion out of desperation.

I also agree that the dungeon difficulty byte is linked to the degree of trap nastiness.

To be honest I never explored the trap mechanic to any great degree before.
drifting
Posts: 153
Joined: Wed Dec 07, 2011 10:21 pm

Re: How to Traps work?

Post by drifting »

From the PC version.

The chest traps are randomly selected from 4 possible traps for each dungeon level. This is the array:

Code: Select all

seg019:5EFC byte_3978C      db 0, 0, 1, 1
seg019:5EFC                 db 1, 1, 2, 3           ; 4
seg019:5EFC                 db 3, 4, 4, 5           ; 8
seg019:5EFC                 db 3, 4, 5, 5           ; 12
seg019:5EFC                 db 5, 6, 6, 7           ; 16
seg019:5EFC                 db 5, 6, 7, 7           ; 20
seg019:5EFC                 db 6, 5, 7, 7           ; 24
seg019:5EFC                 db 5, 6, 7, 7           ; 28
The values here are:

Code: Select all

0 - No trap
1 - POISON NEEDLE
2 - BLADES
3 - DARTS
4 - GAS CLOUD
5 - SHOCKER
6 - CRAZYCLOUD
7 - MINDTRAP
So the first level of the sewers will either have no trap or a POISON NEEDLE.
Maven wrote:If there IS a trap on the chest, I was only able to set it off about one time in 20 when typing in garbage for the trap guess. If I ever typed in POISON NEEDLE, it was always disarmed successfully.
If you type in the correct trap name, it disarms 100% of the time.

If you enter the incorrect trap name, the checks go like this:
1. If you're luck is greater than a random number between 0 and 255 then
the trap is disarmed anyway.

2. There is a 1 in 4 chance of setting off the trap. Note that this is the same check if you just go ahead and open the chest.

3. You get the "disarm failed" message.

I imagine the 1 in 20 result is due to there being a 50% chance of no trap on the first level of the sewers combined with the 1 in 4 chance of actually setting off the trap.
Maven wrote:I think the level of difficulty also determines how likely I am to be hurt by the trap, and how much damage it does.
Each trap has an Xd4 number. That array is:

Code: Select all

chestTrapDmgDice db 1, 1, 2, 4, 3, 7, 1, 1
That number is multiplied by the dungeon difficulty plus 1. So a SHOCKER trap on dungeon difficulty 2 would roll 21d4 to get damage.

After that there is the normal saving throw and half damage check.
Maven wrote:Now, about traps that you step on. In the IBM PC Version, these traps report Basilisk Snare or Gas Cloud, but they don't stone anyone or poison anyone.
This is a bug. The special effect is set and then for some reason cleared before applying it to the party.
User avatar
Darendor
Posts: 1502
Joined: Wed Jan 14, 2009 1:53 am
Location: Red Deer, Alberta, Canada

Post by Darendor »

So is it correct then that the dungeon difficulty byte determines the array?
drifting
Posts: 153
Joined: Wed Dec 07, 2011 10:21 pm

Post by drifting »

Darendor wrote:So is it correct then that the dungeon difficulty byte determines the array?
Yes. The index into the trap array is: ((dungeon difficulty * 4) + random_number_between_0_and_3.
Maven
Posts: 138
Joined: Sat Apr 16, 2011 9:39 pm

Post by Maven »

Thanks, Drifting. That's quite a bit of complexity and some stuff I wouldn't have guessed. Most of what I've seen is consistent with that, but there is one thing that might be off, and I have a couple more questions.

So it looks like in the case of the Cellar, dungeon difficulty 0, I should get Poison Needles about half the time, and no trap half the time. That's pretty close to what I'm seeing. In the case of no trap, it doesn't matter what you type in for the trap name, it will always give the disarmed message. And any time you type in the correct trap name, it will give the disarmed message. So... if you type in Poison Needle, you always get the disarmed message whether there is a trap or not. I can confirm that this works, and it is good to know.

I thought that would be a good way to make more money at low levels. I had understood that monsters drop 1-128 gold in town during the day, and 1-256 any other time. But it looks like in the cellars, they only drop 1-128 gold. So I may as well just run around in town during the day.

Do some of the traps attack a single party member and some of them attack the entire party? How would I know which ones?

Is there any difference between kinds of traps you step on? The Basilisk Snare and Timed Warstrike don't show up in the list.

About the saving throw, I understand how to calculate saving throws for party members. How do you calculate the saving throw for the trap? Is it Dungeon Difficulty * 4 + rnd(32) or something like that?
User avatar
Darendor
Posts: 1502
Joined: Wed Jan 14, 2009 1:53 am
Location: Red Deer, Alberta, Canada

Post by Darendor »

You know, this thread gives me an idea for my current modifications to the C64 game. I could put in an event that changes the dungeon difficulty byte, then offers a chest for the party to try to disarm.

Oh, the fun that could be had.




Of course, knowing me, I'd end up causing a CPU jam or something. It took me like 4 days to debug my one little event file modification, and countless deleting/editing/saving. :?
Post Reply