Easycore 31 Posted August 16, 2015 Hi, I want do that skill "SM_BASH" has damage x2 only when target have Vit = multiples by 5. Then every 5,10,15,20,25,30,35,40,45,50,etc. Bash will deal damage x2. My problem is how do that always read multiples, and not putting an infinity of numbers. I don't want the following: case MS_BASH: skillratio += 30 * skill_lv; if (tstatus->vit == 5||10||15||20||25||30||35||40||45||50||55||) //And infinity numbers... skillratio *= 2; break; This metod is too tedious. Any know how simplify this? Regards ~ and sorry for my bad english Quote Share this post Link to post Share on other sites
0 Gordis 3 Posted August 16, 2015 (edited) Why don't you use the modulus operator(%)?So if a number modulus 5 equals 0, then it's a mutiple of five.For example: if (25%5 == 0) -> True if(26%5 ==0) -> False25 / 5 = 5 it is an exact division, whereas 26/5 = 5 and we get 1 as a rest. Edited August 16, 2015 by Gordis 1 Easycore reacted to this Quote Share this post Link to post Share on other sites
0 Easycore 31 Posted August 16, 2015 I didn't know this Then... how can combine this with tstatus? (Sorry for noob question, but I don't know much of SRC) Quote Share this post Link to post Share on other sites
0 Gordis 3 Posted August 16, 2015 (edited) I think it would be: if (tstatus->vit % 5 == 0) Edited August 16, 2015 by Gordis 1 Easycore reacted to this Quote Share this post Link to post Share on other sites
0 Easycore 31 Posted August 16, 2015 I think it would be: if (tstatus->vit % 5 == 0) Ohh! you're the best, this work. Thank for teach me ~ Quote Share this post Link to post Share on other sites
Hi,
This metod is too tedious.
Any know how simplify this?
Regards ~ and sorry for my bad english
Share this post
Link to post
Share on other sites