icantevenname Posted June 23, 2017 Share Posted June 23, 2017 I've posted a question here about giving a character I'm working on a crit rate. Someone responded, asking if I wanted the crits to apply to the character, the character when using ranged weapons, or to a custom item I want to give to my character. I asked about it applying to ranged weapons and the custom item, figuring that the two values would stack and encourage players to craft and use it. But it's been a month and I haven't gotten a response. I might as well ask again. Oh, and I also need to know how to make it impossible and to guarantee the crits for testing. Link to comment Share on other sites More sharing options...
RinShigure Posted June 25, 2017 Share Posted June 25, 2017 (edited) @icantevenname ahm well i am not really expert in this lua lenguage but as far as i know in everygame critical hits are applied by "RNG" wich is for random number generation so you could use the random function giving it it's own probabiliti and if the probability is fulfilled then give the character a 2x damage as an example. you can call a random generated number by doing this math.random() < .1 i that case the ".1" means 10% chance so that way you can give a probability to your critical hits, hope the info is useful for you, and good luck. Sorry forgot to mention that all that can be coded in a function that executes on attack for example Wigfrid's onattack function "local function onattack(inst, data)" Edited June 25, 2017 by RinShigure Link to comment Share on other sites More sharing options...
icantevenname Posted June 28, 2017 Author Share Posted June 28, 2017 Still stumped... You're onto something with using Wigfrid's code, but I still have no idea what I'm doing... Link to comment Share on other sites More sharing options...
IronHunter Posted June 28, 2017 Share Posted June 28, 2017 Is this what you want? I provided a couple of different answers here that may help, as well as explainations. Cheers, IronHunter Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now