diff options
author | Jesusaves <cpntb1@ymail.com> | 2024-05-16 20:00:11 -0300 |
---|---|---|
committer | Jesusaves <cpntb1@ymail.com> | 2024-05-16 20:00:11 -0300 |
commit | 65dc69b9c61a1b3020653296c22ff1d2b08b48f5 (patch) | |
tree | 7c82233b1dd9fda491826f86dd04db58bc0604cc | |
parent | fce43ff827bb2d2748731fa741fa66b9f71066fb (diff) | |
download | serverdata-65dc69b9c61a1b3020653296c22ff1d2b08b48f5.tar.gz serverdata-65dc69b9c61a1b3020653296c22ff1d2b08b48f5.tar.bz2 serverdata-65dc69b9c61a1b3020653296c22ff1d2b08b48f5.tar.xz serverdata-65dc69b9c61a1b3020653296c22ff1d2b08b48f5.zip |
Improve Botter Syndrome + Safeguard to division by zero
-rw-r--r-- | npc/functions/array.txt | 1 | ||||
-rw-r--r-- | npc/functions/captcha.txt | 18 |
2 files changed, 10 insertions, 9 deletions
diff --git a/npc/functions/array.txt b/npc/functions/array.txt index f29e8500a..48bafff3e 100644 --- a/npc/functions/array.txt +++ b/npc/functions/array.txt @@ -220,6 +220,7 @@ function script array_difference { function script array_avg { .@size = getarraysize(getarg(0)); + if (!.@size) return 0; .@suma = array_sum(getarg(0)); return .@suma / .@size; } diff --git a/npc/functions/captcha.txt b/npc/functions/captcha.txt index dc4cb8147..b2c9b5a13 100644 --- a/npc/functions/captcha.txt +++ b/npc/functions/captcha.txt @@ -150,8 +150,8 @@ OnTimer800000: initnpctimer; end; -// Pick a random target for captcha checks, which happens every 5 seconds -OnTimer5000: +// Pick a random target for captcha checks, which happens every 10 seconds +OnTimer10000: // Script disabled by admins if (!$CAPTCHA) { initnpctimer; @@ -258,13 +258,13 @@ OnTimer5000: if (!playerattached()) break; ///////////////////////////////////////////////////////////////// - // The chance of you contracting the Syndrome starts at 70.0% - .@chance = 700; - // You killed less than 4 monsters, fall to 40.0% - if (.@mpk + 4 > MONSTERS_KILLED) - .@chance -= 300; - // (If you killed less than 7 monsters, fall to 55.0% instead) - else if (.@mpk + 7 > MONSTERS_KILLED) + // The chance of you contracting the Syndrome starts at 65.0% + .@chance = 650; + // You killed less than 7 monsters, fall to 40.0% + if (.@mpk + 7 > MONSTERS_KILLED) + .@chance -= 250; + // (If you killed less than 12 monsters, fall to 55.0% instead) + else if (.@mpk + 12 > MONSTERS_KILLED) .@chance -= 150; // If you interacted with any NPC, it falls to 27.5% if (@npctalk+600 > gettimetick(2)) |