Answered by:
If and Then and an Array
Question

what would through become
Sub enemy
Math.GetRandomNumber(100)
If (rande = 1 through 39) Then
TextWindow.Clear()
skeletonfight()
'40% chance of a skeleton
ElseIf (rande = 40 through 79) Then
TextWindow.Clear()
zombiefight()
'40% chance of a zombie
ElseIf (rande = 80 through 100) Then
TextWindow.Clear()
demonfight()
'20% chance of a demon
EndIf
endsub
Sub randencounter
rande = Math.GetRandomNumber(100)
TextWindow.WriteLine(rande)
If (rande = 1 through 4)then
TextWindow.Clear()
TextWindow.WriteLine("You found a HP Potion!")
HPPot = HPPot + 1
enter()
TextWindow.PauseWithoutMessage()
TextWindow.Clear()
selectLocation()
'4% chance of finding a mp potion
ElseIf (rande = 5 through 8) then
TextWindow.Clear()
TextWindow.WriteLine("You found a MP Potion!")
MPPot = MPPot + 1
enter()
TextWindow.PauseWithoutMessage()
TextWindow.Clear()
selectLocation()
'4% chance of finding a smokebomb
ElseIf (rande = 9 through 15) then
TextWindow.Clear()
TextWindow.WriteLine("You found a Smoke Bomb!")
SmokeBomb = SmokeBomb + 1
enter()
TextWindow.PauseWithoutMessage()
TextWindow.Clear()
selectLocation()
'8% chance of finding a shop
elseIf (rande = 16 through 19) Then
TextWindow.Clear()
TextWindow.WriteLine("You found a shop!")
enter()
TextWindow.PauseWithoutMessage()
TextWindow.Clear()
shop()
elseIf (rande = 20 through 100) Then
'80% chance of an enemy
enemy()
EndIf
EndSubAnd how would I make it so every 50 exp you gain 1 level and 1 sp and the max level is 99
Sub player 'every 50 exp is 1 level 'level 10 is cap If (exp > 49 And exp < 100) then sp = sp + 1 level = level + 1 ElseIf (exp < 101 And exp > 149) then sp = sp + 1 level = level + 1 ElseIf (exp < 150 And exp > 199) then sp = sp + 1 level = level + 1 ElseIf (exp < 200 And exp > 249) then sp = sp + 1 level = level + 1 ElseIf (exp < 250 And exp > 299) then sp = sp + 1 level = level + 1 ElseIf (exp < 300 And exp > 349) then sp = sp + 1 level = level + 1 ElseIf (exp < 350 And exp > 399) then sp = sp + 1 level = level + 1 ElseIf (exp < 400 And exp > 449) then sp = sp + 1 level = level + 1 ElseIf (exp < 450 And exp > 499) then sp = sp + 1 level = level + 1 Else sp = sp + 1 level = level + 1 endif '1 15 dmg firstwep = Math.GetRandomNumber(15) 'starting dmg is 10  25 pdmg = firstwep + str TextWindow.WriteLine("PLAYER") TextWindow.WriteLine("HP: " + PLAYERHP + "/" + PLAYERTOTALHP + " MP: " + PLAYERMP + "/" + PLAYERTOTALMP + LF) EndSub
 Edited by Dinomite07 Thursday, September 11, 2014 3:07 AM
Answers

 Proposed as answer by Nonki TakahashiModerator Wednesday, September 17, 2014 10:10 AM
 Marked as answer by WhTurner33Editor Saturday, October 4, 2014 3:20 PM
All replies

Answer for your first question:
The second line should be rande=Math.GetRandomNumber
After that you can use:
If rande<40 then
....
Elseif rande<80 then
.... 'because if rande is <40 you can't reach this line it it not necessary to test for that
Elseif ....
For your second question it is not clear what happens to exp. Do you come here with one value and after that exp starts again from zero, or is there added every time something to it?
For instance if exp=220 you gain one level or do you want to gain 4 levels?
I think you should look at the possibilities of Math.Floor(exp/50) which is 0 for exp= 0 to 49, 1 for exp= 50 to 99
Jan [ WhTurner ] The Netherlands
 Proposed as answer by litdevModerator Sunday, September 28, 2014 5:38 PM

For every 50 exp you gain 1 level and 1 sp example: At 400 exp you get 1 level and 1 sp
 Marked as answer by Dinomite07 Thursday, September 11, 2014 2:55 PM
 Unmarked as answer by Dinomite07 Thursday, September 11, 2014 2:55 PM
 Edited by Dinomite07 Thursday, September 11, 2014 2:56 PM



Analysis of the level updates.
( line numbers are from CDP1040)
The variable exp increases with 10 (line 1014), 15 (line 807) or 25 (line 897)
A typical secence becomes e.g. 10 35 50 60 75 90 115 125 ......
You want to update level if exp crosses a multiple of 50. In the sequence above thus at 50 and 115. The only way is to compare the old value of exp with the new one, therefor insert above each of the lines in which exp is increased the line oldexp = exp
The test in the Sub Player is then very simple:
If Math.Floor( exp / 50 ) <> Math.Floor( oldexp / 50 ) then
sp=sp+1
level=level+1
EndIf
......Jan [ WhTurner ] The Netherlands

 Proposed as answer by Nonki TakahashiModerator Wednesday, September 17, 2014 10:10 AM
 Marked as answer by WhTurner33Editor Saturday, October 4, 2014 3:20 PM

Nonki,
The two threads are about the same problem, but it is still not clear what the real question is. When should a 1 be added to the level , on the reaching of a multiple of 50, or the passing of a multiple of 50? My solution above works in both situations, but Dinomite07 does not explain what he wants.
Jan [ WhTurner ] The Netherlands