Saibot393 / LocknKey

A Foundry VTT module to handle locking and unlocking of doors and other objects
MIT License
10 stars 7 forks source link

System Compatibility: TDE5 / DSA5 #64

Closed m1lklinG closed 6 months ago

m1lklinG commented 9 months ago

Hi there,

i really like the idea of your module! Unfortunately it seems not to support TDE/DSA at this very moment (https://foundryvtt.com/packages/dsa5).

Is it possible to make this possible?

Kind regards

Saibot393 commented 9 months ago

Sure, could you give me quick run down of/a link to the relevant rules?

m1lklinG commented 9 months ago

QuickStart Guide can be found here: https://paizo.com/products/btpy9maz/discuss?The-Dark-Eye-QuickStart-Rules

To provide a little more information:

Each skill check in TDE/DSA depends on 3 attribute checks, which differ from skill to skill. Lockpicking (i.e.) depends on Intuition / Agility / Agility.

Let's say your character has 9 Intuition and 11 Agility and your Skill in Lockpicking is 4, then the check would occur as follows:

  1. Roll 3D20 simultaneously (1st D20 against Intuition, 2nd D20 against Agility, 3rd D20 against Agility).
  2. Every D20 is meant to be <= the corresponding attribute value. If this is the case in all 3D20 then skill check succeeded.
  3. Your skill level is a wildcard / buffer to cope with rolls worse than <= attributeValue.
  4. With the character above you had 4 buffer points (in total, for the whole check!) which can be used to lower the D20 rolls.
  5. If the buffer points are not enough to achieve @Nr. 2, then the skill check failed.

Last but not least:

Skill checks with two (or three) 1's are critical success checks. Skill checks with two (or three) 20's are critial failure checks.

Saibot393 commented 9 months ago

Is there some kind of difficulty scaling for check, e.g. could a lock do something like add to the buffer to make the check easier?

m1lklinG commented 9 months ago

Yes, indeed. There is at least one factor which can modify a skill check. In our case (lockpicking) it could be the difficulty of the lock itself.

This would modify the buffer value for this very lock (LockpickingSkill - LockDifficulty = TempBufferValue). The higher the buffer value the better the playing actor is at lockpicking. And vice versa. There is no auto-success or auto-fail by high or low buffervalues itself, as critical success rolls (at least 2D20 = "1") and critical failure rolls (at least 2D20 = "20") within the skillcheck will overrule.

Example (from above) for positive (or "zero") TempBufferValues:

Characters values: 9 IN, 11 AG, 4 LockPicking LockDifficulty 4

-> Skillcheck: 3D20 (9 / 11 / 11) + BufferValue (4-4=0) => 3D20(9 / 11 / 11)

You'd have to roll <= 9 / <= 11 / <= 11 to pick the lock.

But: SkillCheck = 20 / 20 / X, 20 / X / 20, X / 20 / 20 results in critical failure.

The BufferValue can also become negative. This has a little different mechanic, as it makes every attribute checkRoll harder.

Example (from above) for negative TempBufferValues:

Characters values: 9 IN, 11 AG, 4 LockPicking LockDifficulty 6

-> Skillcheck: 3D20 (9 / 11 / 11) + BufferValue (4-6=-2) => 3D20(9-2 / 11-2 / 11-2)

You'd have to roll <=7 / <= 9 / <= 9 to pick the lock then.

But: SkillCheck = 1 / 1 / X, 1/ X / 1, X / 1/ 1results in critical success.

Saibot393 commented 9 months ago

I will deffinetly be able to implement the first case you described. The second case where the BufferValue becomes negative and additional values are applied to the dice rolls themselves will be a bit more tricky, but i will see what i can do.

m1lklinG commented 9 months ago

It's a pitty I am not a coder at all. As far as i understand you will try to redo some of the work which already has been done forr the game system?

The SkillCheck itself within the system TDE/DSA is (of course) working. Couldn't you "just" make your module "trigger" this SkillCheck and grab the result after it has been rolled?

Saibot393 commented 9 months ago

Things like rolls are extremely system dependent. In Pf2e for example it is quite easy to let Lock&Key trigger the pick lock action and use the result on the lock. Pf2e is more of an exception though. In most systems rolls as such are not even directly available and the only thing i can normally do is open the roll request window, so i have to code my own roll logic based on core foundry rolls. (The reason i can not simply use the roll request window is, that it is quite hard in most systems to grab the results since it is only put in the chat without any further indentifiers, if i am lucky they at least have their used skill defined). That is also the reason Lock & Key requires the systems roll formula. The problem is now, that the lock modifier would have to be present in the roll formula for the second case to work, which would be a bit hard to do with the current way lock & key calculates locks. Maybe i can come up with a solution for that though.

Saibot393 commented 9 months ago

I have discovered another problem. Unlike most systems, DSA5 uses items for its talents/skill. Items are impossible (as far as i know) to reference in roll formulas without hard coding them. I will continue searching for a solution but it may take a while.

Saibot393 commented 9 months ago

Good new, the problem has been resolved, i will now start working on the formulas

m1lklinG commented 9 months ago

Very cool :-) If i can help you any further, please give me a hint.

Saibot393 commented 9 months ago

So, i think i have a working, albeit ugly, roll formula. The formula will currently not work without a small update (including crits). Before i push the update i would like to test of the formula works, so could you test a few scenarios (different lock DCs, characteristics/skill values) just to make sure that everything works? This is the formula: (max(1d20 - (@actor.system.characteristics.in.value + min(@DC, 0)), 0) +max(1d20 - (@actor.system.characteristics.ff.value + min(@DC, 0)),0) + max(1d20 - (@actor.system.characteristics.ff.value + min(@DC, 0)),0)) - (@skills.Pick_Locks.system.talentValue.value + max(@DC, 0)) for lock picking. As mentioned the formula currently doesn't work, but will output into the chat by how much the results overshoots the skills value (including negative DCs). So values smaller or equal to 0 will be a success, large than 0 a failure. The formula also assumes that the lock picking skill is named "Pick Locks", should you use a language other then english you will have to replace "PickLocks" in the formula with the appropiate skill name (replacing " " with "")

m1lklinG commented 8 months ago

Hey there. During christmas time i unfortunately couldnt make it to have a look at this - hope you had a few relaxing days as well.

How can i use this formula in foundry? I tried to use it in an empty macro as well as as entry for your "configure lock&key" -> "lockpick formula". It does not seem to do anything yet. There is a high chance i did it very wrong.. sorry :)

Saibot393 commented 8 months ago

The formula above should simply work when set as the "Lockpick roll formula". Are there any chat messages or console(F12) messgaes when trying to pick a lock while having this formula set?

m1lklinG commented 8 months ago
image

No chat message but that console message above

Saibot393 commented 8 months ago

Could you, while having an actor selected, enter this into the console and send me the ouput:

r = new Roll("1d20 + @actor.system.characteristics.in.value", {actor : canvas.tokens.controlled[0].actor});
await r.evaluate();
r.result;
m1lklinG commented 8 months ago

'18 + 14'

I did that a few times. The first number (above: 18) seems to be randomly generated between 1 and 20. The second number (above: 14) seems to be persistent (every result did contain it).

Edit: The skill level in lockpicking of the token was "10"

Saibot393 commented 8 months ago

Ok, thats what i expected. One questions, which Lock & Key version are you using? To narrow down the problem could you try these things:

  1. Enter this line into the console while controlling a token and send me the output: canvas.tokens.controlled[0].actor.items.filter(item => ["skill"].includes(item.type))
  2. Could you try using these roll formula for the "Lockpick roll formula" and try using lockpicking on a door: 1d20 - (@actor.system.characteristics.in.value + min(@DC, 0))
  3. Could you also try this formula: @skills.Pick_Locks.system.talentValue.value
m1lklinG commented 8 months ago

I'm using v. 2.4.3

  1. Enter this line into the console while controlling a token and send me the output: canvas.tokens.controlled[0].actor.items.filter(item => ["skill"].includes(item.type))
image
  1. Could you try using these roll formula for the "Lockpick roll formula" and try using lockpicking on a door: 1d20 - (@actor.system.characteristics.in.value + min(@DC, 0))
image
  1. Could you also try this formula: @skills.Pick_Locks.system.talentValue.value

This one does open (and lock, if already open) the lock! But it seems like there is no roll being requested.

image
Saibot393 commented 8 months ago

Sorry for all the question but i am really lost on that first error message you send. What foundry and wat DSA5 version are you using? Could you send me file of the world in which the first error appeared?

m1lklinG commented 8 months ago

Yes, ofc. You're very welcome asking. I'm sorry that i am not that helpful right now.

Foundry v. 11.315 DSA5 v. 5.2.8 (German Language Setting)

[deleted]

Saibot393 commented 8 months ago

Thank you, but i do not seem to be able to load the world file you attached, or rather i don't know how to load it. It only seems to contain the .json and .bak, but lacks the worlds files (scenes, settings, actors...)

Saibot393 commented 8 months ago

Yes, i think discord may be more convenient, if you wan't you can DM me: saibot5279

Dicio83 commented 8 months ago

I have only just found the module and I am thrilled. I also need it for DSA 5. Is there a new news?

Saibot393 commented 8 months ago

I did a few tests with m1lklinG and i think i should have all the bugs narrowed down. I would estimate that i will push an update for DSA5 within the next one or two weeks

Dicio83 commented 8 months ago

wow, thank you :-)

are spells that allow locks to be opened also built in? Can they be prised open later with crowbars or lock picks?

If you need help trying it out, please write to me. I can't programme, but I can try things out :-)

Saibot393 commented 8 months ago

Lock picking spells are relatively easy to add (though will need to be configured by hand). You will basically just need to enter a unique string present in the flavour text of these spells so that lock & key can recognise them. Both lock pciking and using raw strength to break locks will be possible, though i just noticed that i am not sure which kind of skill would be used to break open locks, i would guess "Feat of strength"?

Dicio83 commented 8 months ago

Thats right - "Feath of Strength/Kraftakt" is correct and for lock picking it is "Lock picking/Schlösserknacken" :-) :-D

Saibot393 commented 8 months ago

I have released support for DSA with v2.4.3. I will leave this issue open for now, in case something doesn't work as intended or there are questions

Dicio83 commented 8 months ago

Youre awsome! Will test it and response. Where is your donation-link? :-)

Dicio83 commented 8 months ago

This appears wenn I try to lock pick image

and this when I try to use raw strenght

image

Dicio83 commented 8 months ago

Ok. Changed "Lock_pick" to "Schlösserknacken" due to the german client.

(max(1d20 - (@actor.system.characteristics.in.value + min(@DC, 0)), 0) + max(1d20 - (@actor.system.characteristics.ff.value + min(@DC, 0)),0) + max(1d20 - (@actor.system.characteristics.ff.value + min(@DC, 0)),0)) - (@skills.Schlösserknacken.system.talentValue.value + max(@DC, 0))

Now this appears for an miss:

image

and this for succsess

image

Force to open doesnt work anyway

Dicio83 commented 8 months ago

Is it possible to open the roll-window like if you roll out of the charakter sheet?

Looks like this for lockpicking: image

and this for force

image

Saibot393 commented 8 months ago

Regarding the lock breaking, does it work if you set this as the "Schlossaufbrechen Wurfformel": (max(1d20 - (@actor.system.characteristics.ko.value + min(@DC, 0)), 0) + max(1d20 - (@actor.system.characteristics.kk.value + min(@DC, 0)),0) + max(1d20 - (@actor.system.characteristics.kk.value + min(@DC, 0)),0)) - (@skills.Kraftakt.system.talentValue.value + max(@DC, 0))? The roll window will not be possible due to the system independent way Lock & Key handles rolls, atleast for now.

Dicio83 commented 8 months ago

That works image

Dicio83 commented 8 months ago

If it is technically possible, it would be great if you could programme it so that you could, for example, press "Alt+ right click" to pick locks and then open the standard window for DSA to roll for lock picking.

image

There you can then set the DC and take into account any reductions made by a lock pick (e.g. with a simple lock pick, the 2nd subtest for dexterity (ff) is reduced by 1 according to the rules).

image

Dann rollt man und abhängig vom Ergebnis knackt man die Türe oder nicht.

Dicio83 commented 8 months ago

The DSA system is a bit more complicated than that of DnD. Depending on the type of lock, it is easier or more difficult to pick in the game. If it is a heavy metal lock, for example, the test would be -1 to -6 more difficult. If it is a simple lock, it would be made easier by +1 to +6.

Tools such as a lock pick make the partial test easier, e.g. when picking locks:

The test consists of intuition (in), dexterity (ff) and again dexterity (ff). If you have a lock pick with you, the 2nd sub-test, i.e. the test for the first dexterity, is made easier by 1.

If you have an improved lockpick with you, both dexterity tests are reduced by 1.

I hope I've explained myself well and it's clear what I mean :-)

Saibot393 commented 8 months ago

I had a look at the underlying code for rolls in DSA and it seems to be relatively complicated, i am not sure if there is a elegant way to add rolls via this window and react correctly react to the results without virtually recoding the whole window. Getting the level of compatibility with the DSA system up to this point already took a considerable amount of custom code, i will look into adding the boni fields you described for items but i can make no promises on this.

Dicio83 commented 8 months ago

As it currently stands, I can only enter a default value for a relief and aggravation in the menu of the module, but not in the running game

Saibot393 commented 8 months ago

what exactly do you mean by "relief and aggravation"?

Dicio83 commented 8 months ago

I had a look at the underlying code for rolls in DSA and it seems to be relatively complicated, i am not sure if there is a elegant way to add rolls via this window and react correctly react to the results without virtually recoding the whole window. Getting the level of compatibility with the DSA system up to this point already took a considerable amount of custom code, i will look into adding the boni fields you described for items but i can make no promises on this.

No stress and no rush. They are just ideas and questions as to whether it is even possible. I'm grateful that someone is taking the trouble to develop such cool modules for DSA :-)

Dicio83 commented 8 months ago

what exactly do you mean by "relief and aggravation"?

Sorry, I don't think I have the right English words for it :-)

Will try to explain:

Saibot393 commented 8 months ago

If you want we can write in german

Dicio83 commented 8 months ago

Alter :-D Nicht dein ernst :-D Ich brech mir hier einen ab mit dem Google-Übersetzer und meinem Schulenglisch :-)

Sollen wir vielleicht im Discord reden und/oder schreiben?

Saibot393 commented 8 months ago

Soll mir recht sein, wenn du willst kannst du mir auf Discord an saibot5279 schreiben

Plushtoast commented 8 months ago

Hi, I am the developer for this system. I didn't check how you code your functions but maybe the following code sample helps a little faciliating the process. This is how you process a role including roll window with all modifiers etc in TDE:

const skills = {
    de: {
        lockpicking: "Schlösserknacken",
        breakOpen: "Kraftakt"
    },
    en: {
        lockpicking: "Lockpicking",
        breakOpen: "Feat of Strength"
    }
}

const skill = actor.items.find(x => x.type == "skill" && x.name == skills[game.i18n.lang]["lockpicking"])

const someSubTitle = "someSubTitle" //optional
const difficulty = 0

actor.setupSkill(skill, { modifier: difficulty, subtitle: ` (${someSubTitle})` }, actor.sheet.getTokenId()).then(async(setupData) => {
        setupData.testData.opposable = false
        const res = await actor.basicTest(setupData)

        //this is the level of success up to 6
        const availableQs = res.result.qualityStep || 0

        if (availableQs > 0) {
            //the roll was a success
            //unlock the door
        }

    });
Saibot393 commented 8 months ago

Thank you, that will be quite helpfull. I will look into implementing that for the lock rolls.

Plushtoast commented 8 months ago

Ah auch verpeilt dass es auf deutsch weitergeht

Saibot393 commented 8 months ago

Mit v2.5.0 sollten die DSA Würfe nun inklusive des Einstellungs Fensters funktionieren (sollte die Einstellung "Nutze System Würfe" aktiviert ist). Noch einmal vielen Dank für den Code.