Using stats to calculate chain % chance - hard to implement?

Ask and answer questions about making games and related topics. Unrelated topics go in that other forum.

Moderators: marionline, SDHawk

Post Reply
User avatar
Foxley
Metal Slime
Posts: 832
Joined: Sat Nov 09, 2013 5:54 pm

Using stats to calculate chain % chance - hard to implement?

Post by Foxley »

I feel lousy asking about potentially adding a feature with you guys backed up and busy enough as it is, but would implementing the ability to make attack chain chance based on stats (e.g. tying a critical hit chance to Luck) be doable without much trouble?
User avatar
msw188
Metal Slime
Posts: 787
Joined: Tue Oct 16, 2007 1:43 am
Location: Los Angeles, CA

Post by msw188 »

Depending on how many such attacks there are, and how finely graded you want the chances to be, you can already approximate this with if/then style attack chains.
I am Srime
User avatar
Foxley
Metal Slime
Posts: 832
Joined: Sat Nov 09, 2013 5:54 pm

Post by Foxley »

I had just typed up a pretty long schematic of how that would work in a critical hit example, but... At the very end I realized that it wouldn't work for an instead-chain to a critical attack, because it can't do a % chance instead-chain to the critical damage attack and also do an instead-chain to the next 'rung' down to lower and lower % chain chance versions of the attack if a "Luck" stat were below a certain threshold. (I even just confused myself.) Also I'm not sure that Else-Chains can replace failed Instead-Chains, or only failed Regular Chains.

Maybe there's a different way to do this and I just haven't thought it through enough yet. In any case, it's still annoying and kind of hacky to do a ton of attack chains for a single attack so there aren't huge jumps between % chain chance intervals. If anything, I might only incorporate crits into a single character's skill set, to limit the overhead of doing it this way.
User avatar
msw188
Metal Slime
Posts: 787
Joined: Tue Oct 16, 2007 1:43 am
Location: Los Angeles, CA

Post by msw188 »

If you do decide to hack it, try having the logical checks not inflict damage, but instead chain to the relevant attacks "next". For example:

atkCRIT = the critical damage attack

atk1A = no damage
if(luck<75) do atk2A INSTEAD
chain to atk1B NEXT

atk1B = normal attack
75% chance to do atkCRIT INSTEAD

atk2A = no damage
if(luck<50) do atk3A INSTEAD
chain to atk2B NEXT

atk2B = normal attack
50% chance to do atkCRIT INSTEAD

etc.
I am Srime
User avatar
Bob the Hamster
Lord of the Slimes
Posts: 7660
Joined: Tue Oct 16, 2007 2:34 pm
Location: Hamster Republic (Ontario Enclave)
Contact:

Post by Bob the Hamster »

This should definitely be a built-in feature of chains.

Having to do a half-assed version with a painful series of complicated chains is way too much work.

I have been looking at the code, and I am trying to decide on the best way to express this.

So suppose you have named a stat LUCK. And you want 0 luck to mean no criticals ever, and 100 should mean critical every single time

So the chain checking code should pick a random number from 1 to 100 and if that number is <= to your luck stat then the chain happens.

So in the chain editor, you would edit the Chain Conditional and set it to "Attacker stat random%" and then under that you would see "Random% stat LUCK" (or whatever stat you choose)

Does that seem to make sense? I will probably hold off on doing this until after the callipygous stable release, but it is totally doable.
User avatar
Matokage
Slime Knight
Posts: 275
Joined: Sat May 26, 2012 11:48 pm
Contact:

Post by Matokage »

That would make my Zombie Survival game doable.
But I think i'm too late for the zombie hype.
"I can't buy food with glory"
User avatar
Foxley
Metal Slime
Posts: 832
Joined: Sat Nov 09, 2013 5:54 pm

Post by Foxley »

That does make sense, and would be greatly appreciated. Even if it were just a linear "0-100 Luck = 0-100% chain chance" situation, that'd be totally workable and a great option to have.

I don't know if it'd be much more complicated to be able to choose an x2, x3, or x0.5 factor for that though. In other words:

0-200 stat number-> 0-100% chain chance (e.g. a Luck stat of 70 would give you 35% chance)
0-300 stat number -> 0-100% chain chance (e.g. a Luck stat of 63 would give you 21% chance)
0-50 stat number -> 0-100% chain chance (e.g. a Luck stat of 25 would give you 50% chance)

Or something along those lines. It could come in handy for calculating chain % for stats that tend to get pretty high, like Str for fighters and Int for mages.

EDIT:
I have no idea what happened to my post, maybe using lesser than/greater than symbols messed something up. :???:
Last edited by Foxley on Wed Feb 17, 2016 1:12 am, edited 1 time in total.
Post Reply