Page 1 of 1
[Help] Trying to create a block chance script
Posted: Sat Mar 19, 2022 8:47 pm
by Epton
I am working on a fighting tease
And I want to create a chance based of block/dodge from the opponents attack.
I don't understand why it doesn't work with the IFs actions
I've also tried with Storage but it just broke down...
Init:
https://ibb.co/G7Cb7CL
Page:
https://ibb.co/Hr3wWJ2
Re: [Help] Trying to create a block chance script
Posted: Sun Mar 20, 2022 3:47 am
by spaisin
You're using the Block1 as an array and a variable. That'll hurt.
Swap the eval to
BlockRoll = Block()
And test against that in the IF's:
If
BlockRoll == 1 || BlockRoll == 2 //etc
And index the Block1 properly in the Block()-function; you're using rest.length, it might be something you want, but I'd bet you want Block1.length there instead.
And I'm not going to guess why you're using an array that looks like a dice for this, but...
..
// IF Math.random() < blockChance
Re: [Help] Trying to create a block chance script
Posted: Sun Mar 20, 2022 10:45 pm
by Epton
spaisin wrote: Sun Mar 20, 2022 3:47 am
You're using the Block1 as an array and a variable. That'll hurt.
Swap the eval to
BlockRoll = Block()
And test against that in the IF's:
If
BlockRoll == 1 || BlockRoll == 2 //etc
And index the Block1 properly in the Block()-function; you're using rest.length, it might be something you want, but I'd bet you want Block1.length there instead.
And I'm not going to guess why you're using an array that looks like a dice for this, but...
..
// IF Math.random() < blockChance
Thanks for the answer but it doesn't work for me

Re: [Help] Trying to create a block chance script
Posted: Mon Mar 21, 2022 3:29 pm
by spaisin
Dunno what to say, so here; a working sample:
https://milovana.com/webteases/showteas ... 9b85967281
You can download the script for that using:
https://milovana.com/webteases/geteossc ... 9b85967281
Once you have the .json, create a new tease and restore it as a backup to see it in your editor.
I added a little saner way to do it as a sample, but it might not be what you're looking for.