Hit Chance - Printable Version +- SphereCommunity (https://forum.spherecommunity.net) +-- Forum: Sphere X (/Forum-Sphere-X) +--- Forum: Script Submissions (/Forum-Script-Submissions--61) +--- Thread: Hit Chance (/Thread-Hit-Chance) |
Hit Chance - ISOcol - 08-28-2022 04:27 PM // Discord Collection // Example for sphere.ini custom [CombatHitChanceEra=0] // // Events related to all players // // EventsPlayer= // [EVENTS e_combat_hitchance] ON=@HitTry LOCAL.AnimDelay=6 // speed of how early damage happens from swing animation (1=fastest 6=best 10=long anim) ARGN1=7 // delay between attacks (1=fastest can cause dbl hits) (7=best) local.R=<R900> // store Random number of 900 in local.R IF (<ISPLAYER>) // serv.log (<local.R> <= <<ACTION>>) % // show in console the Rrandom number and the skill amount being used in <<ACTION>> IF (<local.R> <= <<ACTION>>) // IF random number is lesser then or equal to the skillbeingused number ACTDIFF=1 // (1 success) (-1 fail/miss) (1000 skill = 100% chance) SERV.LOG <i.NAME> hitchance using <i.ACTION> is: <<ACTION>>) % // console show name, skill, skill% ELSE // else if your skill isnt high enough you will have a miss chance IF (<EVAL RAND(5)> > 1) // 1 in 5 chance // faster swing maybe need more than 5 // or less than 5 SERV.LOG <i.NAME> hitchance using <i.ACTION> is: <<ACTION>>) %%% <EVAL RAND(2)> // show in console ACTDIFF=-1000 // (1 success) (-1 fail/miss) ENDIF ENDIF //or [EVENTS e_combat_hitchance] ON=@HITTRY LOCAL.AnimDelay=6 actdiff = 1000 //actdiff above or equal 0always hit if ((<argo.isvalid>) && (<argo.isweapon>)) local.skill = <<weapon.skill>> endif if <action> == skill_wrestling local.skill = <wrestling> endif local.x = <R1,<dlocal.skill>> if <dlocal.skill> <= <dlocal.x> + 75 actdiff = -1000 //actdiff < 0 always miss endif |