Number solving

Alright ive been busy on a text based game and i got stuck again i want my zombies to have 5 attack but with 2 zombies 10 i know how to do this but a zombies health is 10 all i need to do is if the health is 39 it should make it 3 zombies or 72 6 zombies and so on i really dont know how to do this is there any equation to do this or any code thank you

What's your pattern? You want:

1 - 5
2 - 10
3 - 39
6 - 72


And your question isn't 'fully' clear to me.
Last edited on
sorry no pattern i just want 1-10 to be 1 and 11-20 to 2 and so on but i found out how to do it thanks though
since it is fixed but still a little huge if i want to go to higher numbers like 100 is there any way u can simplify this code
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
                            if ( z > 0 || z < 11)
                            
                            y = 1;
                            }
                            
                            else if ( z > 11 || z < 21)
                            {
                            y = 2;
                            }
                            else if ( z > 21 || z < 31)
                            y = 3;  
                            } 
                            else if ( z > 31 || z < 41)
                            {
                            y = 4;
                            }
                            else if ( z > 41 || z < 51)
                            y = 5;
                            }
I don't know if this is the most effective way but you can check like this and set values:
 
life = (number_of_zombie / 11 ) + 1;


Please let me know if this works.
Last edited on
Dam thats a nice way but it messes out becuase when i want 19 to be 2 it end up being 3 becuase its 2.7 but for larger numbers it works great thanks man really nice
Topic archived. No new replies allowed.