[Source] Text-Based RPG Battle System

Discussion in 'Programming General' started by Blupig, Dec 3, 2007.

[Source] Text-Based RPG Battle System
  1. Unread #1 - Dec 3, 2007 at 8:44 AM
  2. Blupig
    Joined:
    Nov 23, 2006
    Posts:
    7,145
    Referrals:
    16
    Sythe Gold:
    1,609
    Discord Unique ID:
    178533992981594112
    Valentine's Singing Competition Winner Member of the Month Winner MushyMuncher Gohan has AIDS Extreme Homosex World War 3 I'm LAAAAAAAME
    Off Topic Participant

    Blupig BEEF TOILET
    $5 USD Donor

    [Source] Text-Based RPG Battle System

    [SOURCE] Text-Based RPG Battle Engine

    About:
    I was really into making my own RPG at some point, so I made a battle system then never got around to finishing the rest. So, here it is. Massive credits to Terrankiller for his RandomInt function.
    What this does is player 1 clicks their turn button. A random number is picked between 1 and 10, and the opponent suffers that damage. Then, the opponent's button has to be clicked, then they do damage between 1 and 10 to the player. The first one to reach 0 HP loses.


    WHAT YOU NEED
    -Label (4)
    1: name = playerhp
    2: name = opphp
    3: name = dmgplayer
    4: name = dmgopp
    -Command Button (2)
    1: name = oppgo, enabled = false
    2: name = playergo
    -Timer (1)
    1: name = tmrDmg

    This is Terrankiller's RandomInt function. It randomly picks a number between Low and High. Add it into a module:
    Code:
    'RandomInt Function by Terrankiller, http://www.terrankiller.com/
    Public Function RandomInt(ByVal Low As Long, ByVal High As Long) As Long
    
       Randomize: RandomInt = Int((High - Low + 1) * Rnd) + Low
      
    End Function
    
    Now make a normal form and add this into it's code:
    Code:
    Option Explicit
    Dim oppdmg As Integer
    Dim plrdmg As Integer
    
    Private Sub Form_Load()
    
    playerhp.Caption = 20
    opphp.Caption = 20
    
    End Sub
    
    Private Sub oppgo_Click()
    
    playerhp.Caption = playerhp.Caption - oppdmg
    oppgo.Enabled = False
    playergo.Enabled = True
    dmgopp.Caption = oppdmg
    If playerhp.Caption <= 0 Then
    playerhp.Caption = "0"
    MsgBox "You died.", vbCritical, ":("
    Unload Me
    End If
    
    End Sub
    
    Private Sub playergo_Click()
    
    dmgplayer.Caption = plrdmg
    opphp.Caption = opphp.Caption - plrdmg
    playergo.Enabled = False
    oppgo.Enabled = True
    If opphp.Caption <= 0 Then
    opphp.Caption = "0"
    MsgBox "You won!", vbExclamation, ":)"
    Unload Me
    End If
    
    End Sub
    
    Private Sub tmrDmg_Timer()
    
    oppdmg = RandomInt(1, 10)
    plrdmg = RandomInt(1, 10)
    
    End Sub
    
     
  3. Unread #2 - Feb 9, 2008 at 12:04 PM
  4. Visual Basic Matt
    Joined:
    Jan 29, 2008
    Posts:
    647
    Referrals:
    2
    Sythe Gold:
    56
    Discord Unique ID:
    223154494878253056

    Visual Basic Matt Apprentice

    [Source] Text-Based RPG Battle System

    What is the point of this thread? Somone????
     
  5. Unread #3 - Feb 9, 2008 at 12:19 PM
  6. Line
    Joined:
    Jan 20, 2008
    Posts:
    271
    Referrals:
    1
    Sythe Gold:
    5

    Line Forum Addict

    [Source] Text-Based RPG Battle System

    Obviously to point someone in the right direction who's interested in making a game in vb6 I guess...


    Nice code btw. :)
     
  7. Unread #4 - Feb 10, 2008 at 1:19 PM
  8. Blupig
    Joined:
    Nov 23, 2006
    Posts:
    7,145
    Referrals:
    16
    Sythe Gold:
    1,609
    Discord Unique ID:
    178533992981594112
    Valentine's Singing Competition Winner Member of the Month Winner MushyMuncher Gohan has AIDS Extreme Homosex World War 3 I'm LAAAAAAAME
    Off Topic Participant

    Blupig BEEF TOILET
    $5 USD Donor

    [Source] Text-Based RPG Battle System

    It's a battle code for someone who wants to make a text-based RPG game in VB6.
     
< Is it possible to make an IRC server out of visual basic? | What IS java? >

Users viewing this thread
1 guest


 
 
Adblock breaks this site