Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Reading a text doc?
#1
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 ?
Reply
#2
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
Reply
#3
(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
Reply
#4
Code:
exp+=250*monsterlv
so easy...
My software company: Porosis Software
Games: Terrantula
Apps: Mathanasis, ColorGrabber
Reply
#5
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
"Death smiles at us all. All a man can do is smile back".
[Image: siggy.png]
MSN: Xzotic@live.com
Reply
#6
(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...
Reply
#7
(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
Reply
#8
No its not going up by 250 each time... i was just using that as an example
Reply
#9
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.
"Death smiles at us all. All a man can do is smile back".
[Image: siggy.png]
MSN: Xzotic@live.com
Reply
#10
(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
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  TextBox2.Text | Transfer Text to ListBox Die 3 2,664 01-02-2012, 06:09 PM
Last Post: AceInfinity
  Text Converter. Turn your text upside down! Red X 29 8,688 08-01-2011, 07:46 AM
Last Post: Red X

Forum Jump:


Users browsing this thread: 5 Guest(s)