RAND and Functions - Printable Version +- SphereCommunity (https://forum.spherecommunity.net) +-- Forum: Sphere 0.56d (/Forum-Sphere-0-56d) +--- Forum: Script Help (/Forum-Script-Help) +--- Thread: RAND and Functions (/Thread-RAND-and-Functions) |
RAND and Functions - pinku - 02-03-2014 06:06 PM Hey! I have been messing with RAND, skills and such stuff, and I'm kinda stuck to understand something.. I'm sorry if this is dumb. I want the first function1 to be harder to happen than the others. Function1 the hardest, function6 the easiest. So I thought, I would start from the hardest, if it doesn't happen, we move to next one. Code: ON=@DClick Now, what really happens is: Always function1 or function2 runs, always! I don't know where I'm going wrong. If I try on first function, using 50 skill, for example: Code: IF (<EVAL RAND(1000)>) <= (100 + <SRC.SKILL>) So, 150 can't be higher than RAND(1000) all the single time, but it still happens non stop when I double click. Any tips for me? Am I plain stupid? Others and better ways to do it are welcome too! Thanks a lot! RE: RAND and Functions - Mazer - 02-03-2014 09:49 PM Im sorry im not best scripter in UO, but as i understand EVAL RAND(500) is random number between 0 and 500 second i dont really know how SRC.SKILL return value 50.5% skill its 505 or 50.5. And you should start from easiest function. With 50% of skill if its 50.0. The chance to get last ELSEIF is about 1:30000. You really want this ? If you could declare random value in the beginning of the script. etc x = EVAL RAND(500) + SKILL if player have 50% skill and he rolls 100, x would be 150 then declaring chances if X >= 550 then function1 (rarest) elseif x >= 400 then function2 elseif x >= 300 then function3 elseif x < 300 then function4 function1 gona happen 1:500 times with 50% skill and 50:500 with 100% skill function 2 gona happen 150:500 times with 50% skill and 200:500 with 100% skill function 3 gona happen 250:500 times with 50% skill and 300:500 with 100% skill and function4 gona happen 350:500 times with 50% skill and 400:500 with 100% skill RE: RAND and Functions - Alaric - 02-03-2014 10:15 PM I wrote almost the same but removed that because i found out, that with this system you will have with 0%skill 0%chance to do the best thing. I was quite confused how he wants it to work and how to do it. I would have to sit back and look at it closely. After evaluation skill value should be 10times higher than real value. 100%=1000. RE: RAND and Functions - Coruja - 02-04-2014 12:46 PM probably the math fails because 100.0 skill = 1000 value, not 100 also, just replace the formula with real numbers and you will see the mistake Code: (<EVAL RAND(500)> <= 100+<SRC.SKILL>) RE: RAND and Functions - pinku - 02-04-2014 04:58 PM (02-03-2014 09:49 PM)Mazer Wrote: Im sorry im not best scripter in UO, but as i understand EVAL RAND(500) is random number between 0 and 500 second i dont really know how SRC.SKILL return value 50.5% skill its 505 or 50.5. Thank you, a lot! I did what you said with a simple LOCAL and I could make the things happen, plus, making my char say the numbers rolled. (02-03-2014 10:15 PM)Alaric Wrote: I wrote almost the same but removed that because i found out, that with this system you will have with 0%skill 0%chance to do the best thing. I was quite confused how he wants it to work and how to do it. I would have to sit back and look at it closely. Thanks, I could swear I was using the RAND wrong, in the end, it was the skill 10 times higher, just like you said. Thank you! (02-04-2014 12:46 PM)Coruja Wrote: probably the math fails because 100.0 skill = 1000 value, not 100 Thank you, Coruja! Your help was much appreciated! |