Support Forums

Full Version: Reading a text doc?
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Pages: 1 2 3
I am a giant noob, troll if you must

Hey so, Im making a simple rpg (turn based) game in vb... (please dont say IMPOSSIBLE or w.e). The combat system is going good but i got stuck on the exp system... right now im planing on using something like

( i know the code is fake/wrong )
PHP Code:
on monster death
     
if monsterlv "1" then "250" exp

     
if exp = < "250" then playerlv +1
       
else 

I am now asking how would i do this part

Code:
if monsterlv = "1" then + "250" exp

Without having to do this

Code:
if monsterlv = "1" then + "250" exp
if monsterlv = "2" then + "500" exp
if monsterlv = "3" then + "750" exp
etc

Could i save the exp level thingys into a text doc or .dll ? and read it ?
would something like this work for you?

Code:
Select Case monsterlv
            Case "1"
                exp += 250
            Case "2"
                exp += 500
            Case "3"
                exp += 750
            Case Else
                MessageBox.Show("something went wrong")
        End Select
(11-12-2010, 10:08 AM)the_GENie Wrote: [ -> ]would something like this work for you?

Code:
Select Case monsterlv
            Case "1"
                exp += 250
            Case "2"
                exp += 500
            Case "3"
                exp += 750
            Case Else
                MessageBox.Show("something went wrong")
        End Select

Possible i have never used "case" before so i have no idea
Code:
exp+=250*monsterlv
so easy...
Yeah guys, but hes asking if he could write the data to a file, and yes you can. Not sure why you would want to though, I think it would be more trouble than its worth
(11-13-2010, 08:11 AM)Xzotic Wrote: [ -> ]Yeah guys, but hes asking if he could write the data to a file, and yes you can. Not sure why you would want to though, I think it would be more trouble than its worth
What i mean is i dont want to have to write code for every level my game is going to have up to 1000 levels so... I was wondering if i could just put somthing like this in a txt doc

1=250
2=500
etc (level and exp)

and make the program read it and do the work...
(11-13-2010, 09:56 AM)pers2981 Wrote: [ -> ]What i mean is i dont want to have to write code for every level my game is going to have up to 1000 levels so... I was wondering if i could just put somthing like this in a txt doc

1=250
2=500
etc (level and exp)

and make the program read it and do the work...

if each level increments by 250 then you wont need to read from a text. just do what thanasis2028 said.

exp += 250 * monsterlv

which is the same thing as
exp = exp + 250 * monsterlv
No its not going up by 250 each time... i was just using that as an example
I really think that it would be easier in the end to just code it in the program itself. Put it in a function so all you have to do is call a function. Of course that would take more planning that just what i said. Might need to add a few more variables and statements, but overall I think it is a better method. You would still have to read it from the file everytime + have the information in the file.
(11-13-2010, 02:44 PM)Xzotic Wrote: [ -> ]I really think that it would be easier in the end to just code it in the program itself. Put it in a function so all you have to do is call a function. Of course that would take more planning that just what i said. Might need to add a few more variables and statements, but overall I think it is a better method. You would still have to read it from the file everytime + have the information in the file.
The thing is i have never used a function :L
Pages: 1 2 3