<

Welcome to Dream.In.Code
Getting Help is Easy!

Join 86,269 Programmers. There are 1,873 online right now! Ask your question and get quick answers from Dream.In.Code experts. Join the #1 programming help community on the internet! Registration is fast and FREE... Join Now!

Chat LIVE With a Expert
Powered by LivePerson.com

Register to Make This Box Go Away!

FINISHED RPG GAME

 
Reply to this topicStart new topic

FINISHED RPG GAME, HAH!

rickyadd
post 19 Oct, 2007 - 01:23 PM
Post #1


New D.I.C Head

*
Joined: 4 Oct, 2007
Posts: 8



CODE


# Weirdest Role-Playing-Game in this world!
#
#coded and tested by Ricky Addington, and Tyler Wells
#
#-------------------------------------------------------
#----Define Stats--------
health = 10
maxhealth = 10
strength = 1
magic = 1
level = 1
cheater = "1"
################Stats###################
#--------Define attacks-------
damage = rand(strength) + rand(strength)
magicdamage = rand(magic) + rand(magic)
enemydamage = rand(strength) + 1
enemyhealth = 1
###################################

#-------Begins Game Phase----------
while health > 0
fight = 0

print"THE BEST RPG EVER!\n\n"
print"(enter to continue)\n"
con=gets
print"A wise old man approaches you"
con = gets
print"whats your name young child?\n"
name=gets.chomp.to_s
#------checks for a name of 5 or 6 letters-----------
name2 = name.length
if name2 == 5 or name2 == 6
health = health + 15
maxhealth = maxhealth + 15
magic = magic + 5
strength = strength + 5
#####################Name Check#################################
print "Oh so You are that legendary hero named #{name} right?\n"
con = gets
print "Well we have special stat enhancing potions for you sir!\n"
con = gets
print"***********stats**************\n"
print"Health = #{health}/#{maxhealth}\n"
print"Strength = #{strength}\n"
print"Magic = #{magic}\n"
print"Level= #{level}\n"
print"******************************\n\n\n"
con = gets
else
print"#{name} huh? Never heard of ya\n"
print"But... I like it\n\n"
con = gets
end
#-------------------Do You Battle Old Man?-----------------------
while health > 0
print"#{name}, would you like to join my team,\n to fight the forces of evil?(1 for yes, 2 for no)\n"
ask = gets.to_i
if ask == 1
print"YOU WILL?!?! YES!\n"
con = gets
break
elsif ask == 2
print"You won't?\n"
con = gets
print"Well then I'm sorry to say that you must die now....\n"
con = gets
print "The Wise Old Man turns out to be a crazed fanatical lunatic!\n"
con = gets
print "He Pulls out a Blue mystical ...shiny....STAFF!!!\n"
con = gets
print"He wants to battle!!\n"
fight = 1
break
######################Old Man Decision#######################################
else
print "Please? will you join us?\n"
next
end
end
#----------------Old Man Fight--------------
if fight == 1 and level > 1
enemyhealth = rand(100) + 200
enemystrength = rand(10) + 30
while enemyhealth > 0
print"His health is #{enemyhealth}\n"
con = gets
print"Your health is #{health}/#{maxhealth}\n"
damage = rand(strength) + rand(strength)
magicdamage = rand(magic) + rand(magic)
enemydamage = rand(enemystrength) + 1
print"What would you like to do?\n(1 for attack, 2 for magic)\n"
action = gets.to_i
if action == 1
print"you attack and do #{damage} damage\n"
puts"                .::--                   "
puts"                     --:/               "
puts"                         :/          -  "
puts"        .oddddh/ --:/-     :/     :ym/   #{damage}"
puts"        MMMMMMMM      ---      .yMMm-   "
puts"        MMMMMMMM  .--.   -   .yMMm/     "
puts"        yMMMMMMy     -/.    /MMm/       "
puts"         hMMMm.          /mMMo.         "
puts"        oMMMMM      hMMMMMMm/           "
puts"        oMMMMy:::oooydMMMMMo/           "
puts"        oMMMMMMMMMMMMMMmy.oo/           "
puts"        oMMMMmhyoyMMmyo                 "
puts"        MMMMMo  :my/                    "
puts"        MMMMM.                          "
puts"        MMMMM.                          "
puts"      :MMMMM                           "
puts"      :MMMMMM.                          "
puts"     .MMMmyMMo                          "
puts"    :MMMm-.MMM                          "
puts"  .yMMMm.  MMM                          "
puts"  mMMMo    MMM                          "
puts"  mMMMo    mMMm.                        "
puts"   .-.      ---.    "
con = gets
enemyhealth = enemyhealth - damage
elsif action == 2
print"You use magic and do #{magicdamage} damage\n"
puts"                                  MMMMMd-`              "
      puts"                     -shmds.    /MMMMMMNh-            "
     puts"                     :MMMMMM:     sMMMMMMN-            "
     puts"                     .hNMMMN-      +MMMMM/             "
     puts"                       `NN.`       -MMMM+              "
    puts"            .--.         NN         +MMMd               "
   puts"           .hMMMMNo       NN         hMMM-               "
    puts"          oMMMMMMM+     .MN        .MMMMNy/.            "
    puts"          +MMMMMMMo     +Mo        sMMMMMMMMy-          "
    puts"    `md-   :MMMMNs.     +Mo         `:odNMMMMMms/`      "
    puts"     :mM+. `Mm.`     ./hNs.             `-oyNMMMMM/     "
     puts"     `+dMy+Md   -ohNhs-                    `oMMMN`     "
      puts"       .omMmoyMdo-`                        sMMM-      "
      puts"         `MNs/.                           `mMMs       "
      puts"         `Md                              :MMMo       "
       puts"        oMMs:                            hMMMy       "
       puts"        oMsyNm+.                         :hMMMo      "
       puts"        oM/ `/dMs`                         .+mMo     "
         puts"      oM/    +Nm-                           :ss    "
       puts"        hM/     -hMs`                           `    "
         puts"      Mm       `yMs                           #{magicdmage}     "
        puts"      +Mo        `/.                                "
        puts"       `                                            "
con = gets
enemyhealth = enemyhealth - magicdamage
else
print"Invalid Move\n"
con = gets
next
end
if enemyhealth < 1
break
end
print"Enemy attacks and does #{enemydamage} damage\n"
con = gets
health = health - enemydamage
end
end
if health < 1
break
end
#################Old Man Fight#########################
#--------------------Old Man Owns Nubs-----------------
if fight == 1 and level == 1
print"Old man kills you!!! You idiot!!\n You have no weapons or fighting skills!!!!!\n\n\n"
con = gets
health = 0
break
end
if health < 1
break
end
########################Nubs Owned##################
#-------------------Old Man's Secret----------------
if enemyhealth <= 0
print"You have defeated the crazed old man!!\n You pick up his shiny blue staff!!!!!\n\n"
con = gets
print"\nYou also found a magic carpet!!!\n\n"
con = gets
print"You leveled up!!\n"
con = gets
print"Health + 10\n"
print"Strength + 2\n"
print"Magic + 5\n"
con = gets
health = health + 10
maxhealth = maxhealth + 10
strength = strength + 2
magic= magic + 5
level = level + 1
print"***********stats**************\n"
print"Health = #{health}/#{maxhealth}\n"
print"Strength = #{strength}\n"
print"Magic = #{magic}\n"
print"Level= #{level}\n"
print"******************************\n\n\n"
con = gets
print"You feel a mystical power flow through you!!!\n"
con = gets
print"No wonder the old man was so strong!!!\n"
con = gets
print"Health + 50\n"
print"Strength + 40\n"
print"Magic + 50\n"
con = gets
health = health + 50
maxhealth = maxhealth + 50
strength = strength + 40
magic= magic + 50
print"***********stats**************\n"
print"Health = #{health}/#{maxhealth}\n"
print"Strength = #{strength}\n"
print"Magic = #{magic}\n"
print"Level= #{level}\n"
print"******************************\n\n\n"
con = gets
end
########################Old Man's Secret###################
if health < 0
break
end
#-------------------Role Choice----------------------------
while health > 0
print"What class do you want?\n(1 for scorcerer, 2 for knight, 3 for alchemist, 4 for paladin)\n"
myclass = gets.to_i
if myclass == 1
myclass = "scorcerer"
magic = magic + 4
print"Scorcerer huh?\n those are magic masters\n"
break
elsif myclass == 2
myclass = "knight"
strength = strength + 4
print"Knights huh?\n those are weapons and strength masters\n"
break
elsif myclass == 3
myclass = "alchemist"
strength = strength + 2
magic = magic + 2
print"Alchemists huh?\n they are skilled at magic and strength\n"
break
elsif myclass == 4
myclass = "paladin"
magic = magic + 3
health = health + 5
maxhealth = maxhealth + 5
print"paladin huh?\n they are magic masters, and have alot of health\n"
break
else
next
end
end
#----------------------------class is picked--------------------------
print" "
con = gets
while health > 0
print" What would you like as a weapon?\n(1 for sword, 2 for magic staff)\n"
weapon = gets. to_i
if weapon == 1
print"strength + 3\n"
con = gets
strength = strength + 3
break
elsif weapon == 2
print"magic + 3\n"
con = gets
magic = magic + 3
break
else
next
end
end
print"***********stats**************\n"
print"Health = #{health}/#{maxhealth}\n"
print"Strength = #{strength}\n"
print"Magic = #{magic}\n"
print"Level= #{level}\n"
print"******************************\n\n\n"
con = gets
#------------------------------First Battle-----------------------------
print"An enemy appears!\n\n"
enemyhealth = rand(10) + 3
enemystrength = rand(2) + 1
while enemyhealth > 0
print"His health is #{enemyhealth}\n"
con = gets
print"Your health is #{health}/#{maxhealth}\n"
damage = rand(strength) + rand(strength)
magicdamage = rand(magic) + rand(magic)
enemydamage = rand(enemystrength) + 1
print"What would you like to do?\n(1 for attack, 2 for magic)\n"
action = gets.to_i
if action ==1
print"you attack and do #{damage} damage\n"
puts"                .::--                   "
puts"                     --:/               "
puts"                         :/          -  "
puts"        .oddddh/ --:/-     :/     :ym/  "
puts"        MMMMMMMM      ---      .yMMm-   #{damage}"
puts"        MMMMMMMM  .--.   -   .yMMm/     "
puts"        yMMMMMMy     -/.    /MMm/       "
puts"         hMMMm.          /mMMo.         "
puts"        oMMMMM      hMMMMMMm/           "
puts"        oMMMMy:::oooydMMMMMo/           "
puts"        oMMMMMMMMMMMMMMmy.oo/           "
puts"        oMMMMmhyoyMMmyo                 "
puts"        MMMMMo  :my/                    "
puts"        MMMMM.                          "
puts"        MMMMM.                          "
puts"      :MMMMM                           "
puts"      :MMMMMM.                          "
puts"     .MMMmyMMo                          "
puts"    :MMMm-.MMM                          "
puts"  .yMMMm.  MMM                          "
puts"  mMMMo    MMM                          "
puts"  mMMMo    mMMm.                        "
puts"   .-.      ---.    "
con = gets
enemyhealth = enemyhealth - damage
elsif action == 2
print"You use magic and do #{magicdamage} damage\n"
puts"                                  MMMMMd-`              "
      puts"                     -shmds.    /MMMMMMNh-            "
     puts"                     :MMMMMM:     sMMMMMMN-            "
     puts"                     .hNMMMN-      +MMMMM/             "
     puts"                       `NN.`       -MMMM+              "
    puts"            .--.         NN         +MMMd               "
   puts"           .hMMMMNo       NN         hMMM-               "
    puts"          oMMMMMMM+     .MN        .MMMMNy/.            "
    puts"          +MMMMMMMo     +Mo        sMMMMMMMMy-          "
    puts"    `md-   :MMMMNs.     +Mo         `:odNMMMMMms/`      "
    puts"     :mM+. `Mm.`     ./hNs.             `-oyNMMMMM/     "
     puts"     `+dMy+Md   -ohNhs-                    `oMMMN`     "
      puts"       .omMmoyMdo-`                        sMMM-      "
      puts"         `MNs/.                           `mMMs       "
      puts"         `Md                              :MMMo       "
       puts"        oMMs:                            hMMMy       "
       puts"        oMsyNm+.                         :hMMMo      "
       puts"        oM/ `/dMs`                         .+mMo     "
         puts"      oM/    +Nm-                           :ss    "
       puts"        hM/     -hMs`                           `    "
         puts"      Mm       `yMs                             #{magicdamage}"
        puts"      +Mo        `/.                                "
        puts"       `                                            "
con = gets
enemyhealth = enemyhealth - magicdamage
else
print"Invalid Move\n"
con = gets
next
end
if enemyhealth <= 0
break
else
print"Enemy attacks and does #{enemydamage} damage\n"
con = gets
health = health - enemydamage
end
if health < 1
break
end
end
if health < 1
break
end
print"You have won your first battle!\n\n"
con = gets
#------------------------------Won first Battle-------------------------
#-------------------------------First level up-------------------------------
print"You leveled up!!\n"
print"magic + 1\n"
print"strength + 1\n"
print"health + 5\n\n"
con = gets
magic = magic + 1
strength = strength + 1
health = health + 5
maxhealth = maxhealth + 5
level = level + 1
print"***********new stats**************\n"
print"Health = #{health}/#{maxhealth}\n"
print"Strength = #{strength}\n"
print"Magic = #{magic}\n"
print"Level= #{level}\n"
print"******************************\n\n\n"
con = gets
#---------------------------------End of level up---------------------------
while health > 0
print"what do you want as a second weapon?\n(1 for sword, 2 for staff, 3 for wand, 4 for mace)\n"
weapon2 = gets.to_i
if weapon2 == 1
print"strength + 3\n"
con = gets
strength = strength + 3
break
elsif weapon2 == 2
print"magic + 3\n"
con = gets
magic = magic + 3
break
elsif weapon2 == 3
print"magic + 5\n"
con = gets
magic = magic + 5
break
elsif weapon2 == 4
print"strength + 5\n"
con = gets
strength = strength + 5
break
else
next
end
end
print"Good Choice!\n"
con = gets
print"You head for the castle #{name}\n"
con = gets
print"You leave for the castle,\n to ward out the evil spirit inside\n"
con = gets
if enemyhealth > 0
print"As you leave another enemy appears!\n"
con = gets
print"Enemyhealth is 18\n"
con = gets
print"Ill take care of this one #{name}\n"
con = gets
print"The old man pulls out a staff and uses magic\n"
con = gets
print"He does 24 damage\n"
con = gets
print"The enemy is defeated\n"
con = gets
print"You both continue toward the castle\n"
con = gets
end
print"After about 15 minutes of walking,\n You arrive\n"
con = gets
puts"            .omh/`                                                         "
puts"        `:odNMMMMNy:                                                       "
puts"      ./hNMMMMMMMMMMMmo:                                                   "
puts"    /yNMMMMMMMMMMMMMMMMMm/                                                 "
puts"   yMMMMMMMMMMMMMMMMMMMMMMs`                    ``            /ooo++///////"
puts"   /oshdmNMdNhhhdNNMNNNNNNN:    `mhyyyyhhyyyyyyhmN            dy-:sy////+d/"
puts"       ``oN:d---:mdy.......`    .Mo////sy//////smM.           dh::sy::::+d:"
puts"         +N:d---:mdy`           .M/....oo......+hM.           dy..oo....:h."
puts"         +N`d   `dohyyyshysssssshm-    ++      /ymyssssyhsssssdo  /+    -y "
puts"         +N`d   `d `````h-``````d.     ++      /o``````-h```````  /+    -y "
puts"         +N`d   `d      y.      d`     ++      /o      .h         /+    -y "
puts"         +N+N++++m++++++do++++++m++++++yy++++++yh++++++om+++++++++yh++++od+"
puts"         +N m   `d      y.      d`     ++      /o      .h         /+    -y "
puts"         +N`m```.d``````h-``````d.`````+o``````/o``````-h`````````+o````-h`"
puts"         +N/N///+m//////do//////m+/////yy//////sy//////+d/////////yy////od/"
puts"         +N d   `d      y.      d`     +o......+s......:d.........:s    -y "
puts"         oN d`  `d      y.      d`  `sydhysyssssssssssoooooooooohN-y    -y "
puts"         sd.d-...d......h:......d...+M/.                        /M+y....:h."
puts"         sd:m/::/m::::::d+::::::m/::sN                          -Myh::::+d:"
puts"         sh d`  `d      y.      d`  +N                          `Myy    -y "
puts"         sd`h-``.d``````h:``````d.``oN                           mmd////od/"
puts"         sm/ho///m//////d+//////m///yN                           hMy````-y`"
puts"         sh s:  `d      y.      d`  +N                           +My    -y "
puts"         sd-y+---m------h/------m---sN                           +My    -y "
puts"         sd-y+--:m------h/------m:--sN                           +Md++++od+"
puts"         sh o-  `h      h.      d`  sm                           +My    -y   \n\n\n\n"                                                                                            
con = gets
print"you enter and stumble upon a healing fountain,\n Will you drink\n(1 for yes, 2 for no)"
action = gets.to_i
######################Drinking fountain------------------------------------------------------------------
if action == 1
print "Health is restored...... Time to go kill some zombies!\n"
health = maxhealth
con = gets
else
print"Your choice\n\n"
con = gets
end
print"O.M.G.....This is Princess Peach's Castle!!!\n"
con = gets
print"I wonder if there is a zombie Bowser?!?!\n"
con = gets
print "Not paying attention again you stumble off the tower,\nfall 100 feet,\n and find yourself in a weird underground abyss\n where screams of tortured souls fill the air...\n\n"
con = gets
print"Enemy appears!\n"                                                                            
puts"      -.                                                                   "
puts"     /yy.                     .s:                                          "
puts"    +yyyo`          ^         -syy:                                        "
puts"  .+yyyyyy-        +o`      .syyyy/`        `:s`   `/`                     "
puts"  ssyyyysss.     `syyo`   .oyyyyyyyo.     .oys:     .ys-                   "
puts"    `.o.        :yyyyyo`  `..../o-..`     /yys      /yyy:                  "
puts"      +        +yyyyyyyo`      `/         /yyyso::-.oyyy:                  "
puts"      +       `....o....`      `/         `-syyyyyyyyys/.                  "
puts"      +            +           `/          -yyyyyyyyyy/                    "
puts"      +            +           ::          syyyyyyyyyyy`                   "
puts"      ::           +          -+           -yyyyyyyyyy/                    "
puts"       -/:.`       +        `/:             -oyyyyyys:                     "
puts"         `.--------o--------:.                `-yy/`                       "
puts"                   +                       -//::yy/.....                   "
puts"                   +                   .:ssyysyyyyyyyyyyo/`                "
puts"                   +                -/oyyy/-` `syyyo``.:syy/`              "
puts"                   +              -syyy+.      syyyo     :syy:             "
puts"                   +           .:syys`         syyyo       oyyo            "
puts"                   +      `-+syyyy/-           syyyo        :yys:          "
puts"                 -oyyo+++yyyyo/-.             -yyyyo         `/yys.        "
puts"                 oyyyys+++/-                  /yyyyo           .syys+.     "
puts"                  -o.                        .yyyyyo             `/oys.    "
puts"                   +                         syyyyyo                       "
puts"                   +                        :yyyyyyy/                      "
puts"                   +                       .yyyyyyyyy:                     "
puts"                   +                      .yyyyyyyyyys.                    "
puts"                   +                     `syyyyy/syyyy:                    "
puts"                   +                    `oyyyyy: `oyyys`                   "
puts"                   +                    /yyyyy:   -yyyy+                   "
puts"                   +                   /yyyyy:     -yyyo`                  "
puts"                   +                   syyys-       /yyy/                  "
puts"                   +                  :yyys.         syyy`                 "
puts"                   +                  +yyy:          syyy`                 "
puts"                   +                 .yyyy:          syyy`                 "
puts"                   +                 -yyyy:          syyy`                 "
puts"                   .                 syyyy-          syyy`                 "
puts"                                     `---`           :+ys                  \n\n"
con = gets
enemyhealth = rand(20) + 20
enemystrength = rand(10) + 1
if cheater == "1"
enemyhealth = rand(20) + 40
end
while enemyhealth > 0
print"His health is #{enemyhealth}\n"
con = gets
print"Your health is #{health}/#{maxhealth}\n"
damage = rand(strength) + rand(strength)
magicdamage = rand(magic) + rand(magic)
enemydamage = rand(enemystrength) + 1
print"What would you like to do?\n(1 for attack, 2 for magic)\n"
action = gets.to_i
if action ==1
print"you attack\n"
puts"                .::--                   "
puts"                     --:/               "
puts"                         :/          -  "
puts"        .oddddh/ --:/-     :/     :ym/  "
puts"        MMMMMMMM      ---      .yMMm-  #{damage}"
puts"        MMMMMMMM  .--.   -   .yMMm/     "
puts"        yMMMMMMy     -/.    /MMm/       "
puts"         hMMMm.          /mMMo.         "
puts"        oMMMMM      hMMMMMMm/           "
puts"        oMMMMy:::oooydMMMMMo/           "
puts"        oMMMMMMMMMMMMMMmy.oo/           "
puts"        oMMMMmhyoyMMmyo                 "
puts"        MMMMMo  :my/                    "
puts"        MMMMM.                          "
puts"        MMMMM.                          "
puts"      :MMMMM                           "
puts"      :MMMMMM.                          "
puts"     .MMMmyMMo                          "
puts"    :MMMm-.MMM                          "
puts"  .yMMMm.  MMM                          "
puts"  mMMMo    MMM                          "
puts"  mMMMo    mMMm.                        "
puts"   .-.      ---.    "
con = gets
enemyhealth = enemyhealth - damage
elsif action == 2
print"You use magic and do #{magicdamage} damage\n"
puts"                                  MMMMMd-`              "
      puts"                     -shmds.    /MMMMMMNh-       &n
User is offlineProfile CardPM
Go to the top of the page
+Quote Post


PennyBoki
post 20 Oct, 2007 - 01:38 PM
Post #2


system("revolution");

Group Icon
Joined: 11 Dec, 2006
Posts: 2,006

well one little thing.. you need these 3 lines of code so that the game will run:
CODE

end
end
end


there is still room room for more scenario... keep up the good work.
User is offlineProfile CardPM
Go to the top of the page
+Quote Post

rickyadd
post 22 Oct, 2007 - 12:33 PM
Post #3


New D.I.C Head

*
Joined: 4 Oct, 2007
Posts: 8

QUOTE(PennyBoki @ 20 Oct, 2007 - 01:38 PM) *

well one little thing.. you need these 3 lines of code so that the game will run:
CODE

end
end
end


there is still room room for more scenario... keep up the good work.

OH it didnt post the whole code!

ill repost it
User is offlineProfile CardPM
Go to the top of the page
+Quote Post

angelsgeek
post 22 Oct, 2007 - 02:15 PM
Post #4


New D.I.C Head

*
Joined: 19 Oct, 2007
Posts: 22

Looks good
User is offlineProfile CardPM
Go to the top of the page
+Quote Post

Evileyeball
post 30 Oct, 2007 - 04:02 PM
Post #5


New D.I.C Head

*
Joined: 30 Oct, 2007
Posts: 47

looks pretty cool so far.

Havent had much time to learn ruby but it looks pretty simple to learn. (easier than C,C++)

icon_up.gif
User is offlineProfile CardPM
Go to the top of the page
+Quote Post

Fast ReplyReply to this topicStart new topic
Time is now: 5/16/08 10:31AM

Live Help!

Tutorials

Programming

Web Development

Reference Sheets

Code Snippets

Bye Bye Ads

Free DIC T-Shirt

T-Shirt Example

Related Sites

Monthly Drawing

Thumb Drive

Partners

Top Contributors

Top 10 Kudos This Month