Jump to content

  •  

Photo

Optimize target status


Best Answer Gordis, 16 August 2015 - 02:12 AM

I think it would be:

 [color=rgb(0,0,136);]if[/color] [color=rgb(102,102,0);]([/color]tstatus[color=rgb(102,102,0);]->[/color]vit % 5 == 0)

Go to the full post


  • Please log in to reply
4 replies to this topic

#1 Easycore

Easycore

    Advanced Member

  • Members
  • PipPipPip
  • 156 posts

Posted 16 August 2015 - 01:20 AM

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

 



#2 Gordis

Gordis

    Member

  • Members
  • PipPip
  • 10 posts

Posted 16 August 2015 - 01:40 AM

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) -> False
25 / 5 = 5 it is an exact division, whereas 26/5 = 5  and we get 1 as a rest.


Edited by Gordis, 16 August 2015 - 01:44 AM.


#3 Easycore

Easycore

    Advanced Member

  • Members
  • PipPipPip
  • 156 posts

Posted 16 August 2015 - 02:06 AM

I didn't know this :o

 

Then... how can combine this with tstatus? (Sorry for noob question, but I don't know much of SRC)



#4 Gordis

Gordis

    Member

  • Members
  • PipPip
  • 10 posts

Posted 16 August 2015 - 02:12 AM   Best Answer

I think it would be:

 [color=rgb(0,0,136);]if[/color] [color=rgb(102,102,0);]([/color]tstatus[color=rgb(102,102,0);]->[/color]vit % 5 == 0)


Edited by Gordis, 16 August 2015 - 02:12 AM.


#5 Easycore

Easycore

    Advanced Member

  • Members
  • PipPipPip
  • 156 posts

Posted 16 August 2015 - 02:21 AM

I think it would be:

 [color=rgb(0,0,136);]if[/color] [color=rgb(102,102,0);]([/color]tstatus[color=rgb(102,102,0);]->[/color]vit % 5 == 0)

Ohh! you're the best, this work.

 

Thank for teach me ~






1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users


This topic has been visited by 23 user(s)