Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Top Posters

Who's Online (0)

Powered by Vanilla. Made with Bootstrap.
  • chroniccommand
    Posts: 1,389
    So I decided to put my Python skills to the test. I'm working on a simple RPG coded completely in Python(Text based). It features levels, monsters, worlds, equipment, spells etc..
    Here is the code so far(Just got started)

    #!/usr/bin/python
    #Simple text based RPG
    #By chroniccommand
    '''
    http://iExploit.org/
    Join today to meet some smart people!
    '''
    import os, sys, random, time
    basic_enemies = ['Patroler', 'Diek', 'Mortge', 'Keal', 'Realmar']
    boss_enemies = ['Rat Master', 'King of Mana', 'Gordof', 'Xinapse']
    patrol_health = 50
    patrol_attack = 5
    patrol_defense = 7
    patrol_gold_take = [5, 10, 6, 7, 8, 9]
    runyesno = [1, 2]
    user_items = ['Matches']
    user_level = 1
    current_land = 1
    lands = 1
    gold = 10
    potions = 1
    user_health = 100
    user_mana = 100
    user_attack = 10 #Starting off with 10 AP. Max is 500
    user_speed = 10
    user_mage = 10
    user_accuracy = 10
    #User weapons. 1 for Rusty sword, etc..
    user_weapon = 1
    user_shield = 1
    user_armor = 1

    fire_spell = 0
    water_spell = 0
    rock_spell = 0
    dark_spell = 0
    white_spell = 0
    print(\"Welcome to pyPG(Python coded RPG)\")
    name = raw_input('What is your name, young soldier: ')
    player_name = name
    print(\"Welcome to the land of morageo, \" + player_name + '!')
    def menu() :
    print(\"What shall you do now?\")
    print(\"1 - Visit shop\")
    print(\"2 - Visit infirmary\")
    print(\"3 - Train\")
    print(\"4 - Battle\")
    print(\"5 - Exit game / Travel lands\")
    print(\"6 - Help\")
    print(\"7 - About / More\")
    choice = raw_input('Your choice: ')
    if choice == '1' :
    shop()

    def clear() :
    print(\"\n\" * 100)

    def aboutmore() :
    print(\"1 - About\")
    print(\"2 - Version\")
    print(\"3 - Credits\")
    print(\"4 - Lands\")
    print(\"5 - Story line\")
    print(\"6 - Back\")
    about_choice = raw_input('Your choice: ')
    if about_choice == '1' :
    print(\"pyPG coded by Chroniccommand in Python.\")
    print(\"http://iexploit.org/\")
    print(\"I ARE LOVEZ TEH LOLCOD3!>!?\")
    aboutmore()
    elif about_choice == '2' :
    print(\"pyPG current version is .1 Alpha.\")
    aboutmore()
    elif about_choice == '3' :
    print(\"Coder - Chroniccommand\")
    print(\"Providing lulz - iExploit pplz0rz\")
    print(\"Ideas - Chroniccommand\")
    print(\"So basically, I, chroniccommand, created this from scratch.\")
    print(\"Be jealous... BE VERYYY JEALOUS!!!1!\")
    aboutmore()
    elif about_choice == '4' :
    print(\"List of lands in pyPG:\")
    print(\"Morageo\")
    print(\"Outcast land\")
    print(\"Devils pool\")
    print(\"Vertical morageo\")
    aboutmore()
    elif about_choice == '5' :
    clear()
    print(\"pyPG story line:\")
    print(\"It's sometime in the medieval time period. You can't remember your name, but you remember one thing.\n\")
    print(\"You remember you are a soldier. A soldier of war.\")
    print(\"The dark lord, Xinapse, has taken control of all of the land and unleashed his evil minions all over.\")
    print(\"It's up to you to stop lord Xinapse, and take back the land.\")
    print(\"Good luck on your quest.\n\n\")
    aboutmore()
    elif about_choice == '6' :
    clear()
    menu()

    def travel() :
    print(\"Lands:\")
    print(\"1 - Morageo\")
    print(\"2 - Outcast land\")
    print(\"3 - Devils pool\")
    print(\"4 - Vertical morageo\")
    land_choice = raw_input('Your choice: ')
    if land_choice == '1' :
    print(\"Traveling to morageo...\")
    time.sleep(2)
    current_land = 1
    print(\"Now in morageo!\")
    menu()
    elif land_choice == '2' :
    if lands >= 2 :
    print(\"Traveling to Outcast land...\")
    time.sleep(2)
    current_land = 2
    print(\"Now in Outcast land!\")
    menu()
    elif lands > 2 :
    print(\"Sorry, this land is not yet available\")
    travel()
    elif land_choice == '3' :
    if lands >= 3 :
    print(\"Traveling to Devils pool...\")
    time.sleep(2)
    current_land = 3
    print(\"Now in Devils pool!\")
    menu()
    elif lands < 3 :
    print(\"Sorry, this land is not yet available\")
    travel()
    elif land_choice == '4' :
    if lands >= 4 :
    print(\"Traveling to Vertical morageo...\")
    time.sleep(2)
    current_land = 4
    print(\"Now in Vertical morageo!\")
    menu()
    elif lands < 4 :
    print(\"Sorry, this land is not yet available\")
    travel()
    def leave() :
    leave = raw_input('Are you sure you want to leave?[y/n] ')
    if leave == 'y' or 'Y' :
    sys.exit()
    if leave == 'n' or 'N' :
    clear()
    menu()

    def help() :
    print(\"1 - What to do\")
    print(\"2 - Battling\")
    print(\"3 - Controls\")
    print(\"4 - Back\")
    help_choice == raw_input('Your choice: ')
    if help_choice == '1' :
    clear()
    print(\"This is the wonderous land of pyPG\")
    print(\"The objective of this game, is to battle and train your character\")
    print(\"to the point where you're stronger, and wealthier than everybody.\")
    print(\"Their are quite a few words to travel too.\")
    print(\"From here, you should train and battle to collect gold.\")
    print(\"Once you can, buy some things from the town's shop.\")
    print(\"Once you have reached a point in the current land, you will go against\")
    print(\"a boss monster. After you beat the boss monster, a new world is available.\")
    print(\"Good luck, brave soldier.\")
    clear_help_1 = raw_input('Press Z(Lowercase) to continue: ')
    if clear_help_1 == 'z' :
    help()
    if help_choice == '2' :
    clear()
    print(\"To battle, select 4 on the main menu.\")
    print(\"When in a battle, you can use weapons and spells for offensive attacks.\")
    print(\"Buying armor and shields raises your defense, increasing your likelyhood to live.\")
    print(\"Purchase some weapons from the shop to raise attack, to crush your enememies swiftly.\")
    print(\"Training increases your skills, such as attack and defense.\")
    print(\"Good luck on your battles. Become a brave warrior!\")
    clear_help_2 = raw_input('Press Z(Lowercase) to continue: ')
    if clear_help_2 == 'z' :
    help()
    if help_choice == '3' :
    clear()
    print(\"pyPG is a text based RPG.\")
    print(\"To navigate the menu's press the number on your keyboard correspondant to the option you wish to choose.\")
    print(\"Once you strike the number key, press the ENTER / RETURN key on your keyboard.\")
    print(\"This will either preform the action or take you to it's sub-menu.\")
    print(\"The controls are very basic, and wont take long for you to get down.\")
    clear_help_3 = raw_input('Press Z(Lowercase) to continue: ')
    if clear_help_2 == 'z':
    clear()
    help()
    if help_choice == '4' :
    clear()
    menu()


    def basic_battle() :
    battle_enemy = random.choice(basic_enemies)
    print(\"Enemy \" + battle_enemy + ' jumped out!')
    if battle_enemy == 'Patroler':
    patroler_battle()



    def patroler_battle() :
    clear()
    print(\"Battle options:\")
    print(\"1 - Attack\")
    print(\"2 - Spells\")
    print(\"3 - Defend\")
    print(\"4 - Run\")
    patrol_choice == raw_input('Your choice: ')
    if patrol_choice == '1' :
    damage = random.choice(patrol_damage_taken)
    print(\"\" + player_name + \" attacked the patroler!\")
    patrol_health - damage
    patrol_health + patrol_health / 2
    print(\"Player dealt \" + damage + \" damage!\")
    print(\"Your health: \")
    print(user_health)
    print(\"Patroler health:\")
    print(patrol_health)
    patroler_battle()
    if patrol_choice == '2' :
    print(\"Spell book:\")
    print(\"1 - Fire(10 D)\")
    print(\"2 - Water(5 D)\")
    print(\"3 - Rock(10 D\")
    print(\"4 - Dark spell(KILL)\")
    print(\"5 - White spell(KILL)\")
    print(\"6 - Go back\")
    spellchoice = raw_input('Your choice:')
    if spellchoice == '1' :
    if fire_spell == 0 :
    print(\"Fire spell not available\")
    patroler_battle()
    elif fire_spell > 0 :
    print(\"Casting fire spell..\")
    patrol_health - 10
    print(\"Fire spell casted!\")
    fire_spell - 1
    patroler_battle()
    if spellchoice == '2' :
    if water_spell == 0 :
    print(\"Water spell not available\")
    patroler_battle()
    elif water_spell > 0 :
    print(\"Casting water spell..\")
    patrol_health - 5
    print(\"Water spell casted!\")
    water_spell - 1
    patroler_battle()
    if spellchoice == '3' :
    if rock_spell == 0 :
    print(\"Rock spell not available\")
    patroler_battle()
    elif rock_spell > 0 :
    print(\"Casting rock spell..\")
    patrol_health - 10
    print(\"Rock spell casted!\")
    rock_spell - 1
    patroler_battle()
    if spellchoice == '4' :
    if dark_spell == 0 :
    print(\"Dark spell not available\")
    elif dark_spell > 0 :
    print(\"Casting dark spell..\")
    patrol_health = 0
    print(\"Dark spell casted!\")
    dark_spell - 1
    patroler_killed()
    if spellchoice == '5' :
    if white_spell == 0 :
    print(\"White spell not available\")
    elif white_spell > 0 :
    print(\"Casting white spell..\")
    patrol_health = 0
    print(\"White spell casted!\")
    white_spell = 0
    patroler_killed()
    if spellchoice == '6' :
    patroler_battle()
    if patrol_choice == '3' :
    if user_shield == 0 :
    user_health - patrol_attack
    user_health + 1
    print(\"Patroler attacked!\")
    print(\"Your health:\")
    print(user_health)
    patroler_battle()
    elif user_shield == 1 :
    user_health - patrol_attack
    user_health + 3
    print(\"Patroler attacked!\")
    print(\"Your health:\")
    print(user_health)
    patroler_battle()
    elif user_shield == 2 :
    user_health - patrol_attack
    user_health + 6
    print(\"Patroler attacked!\")
    print(\"Your health:\")
    print(user_health)
    patroler_battle()
    elif user_shield == 3 :
    user_health - patrol_attack
    user_health + 10
    print(\"Patroler attacked!\")
    print(\"Your health:\")
    print(user_health)
    patroler_battle()
    elif user_shield == 4 :
    user_health - patrol_attack
    user_health + 30
    print(\"Patroler attacked!\")
    print(\"Your health:\")
    print(user_health)
    patroler_battle()
    if patrol_choice == '4' :
    yesno = random.choice(runyesno)
    if yesno == 1 :
    print(\"Ran away!\")
    clear()
    menu()
    elif yesno == 0 :
    print(\"Could not run away!\")
    patroler_battle()

    def patroler_killed() :
    print(\"Patroler was killed!\")
    gold_take_pat = random.choice(patrol_gold_take)
    print(\"Got \" + gold_take_pat + \" gold!\")
    gold + gold_take_pat
    menu_go = raw_input('Press Z to go to menu')
    if menu_go == 'Z' or 'z' :
    menu()


    def inventory() :
    clear()
    print(\"Welcome to the inventory\")
    print(\"1 - See gold\")
    print(\"2 - See weapon\")
    print(\"3 - See shield\")
    print(\"4 - See armor\")
    print(\"5 - Items\")
    print(\"6 - Current stats\")
    print(\"7 - Exit\")
    invent_choice = raw_input('Your choice: ')
    if invent_choice == '1' :
    print(\"Current gold:\")
    print(gold)
    inventory()
    if invent_choice == '2' :
    if user_weapon == 1 :
    print(\"Rusty sword\")
    inventory()
    elif user_weapon == 2 :
    print(\"Silver sword\")
    inventory()
    elif user_weapon == 3 :
    print(\"Mace\")
    inventory()
    elif user_weapon == 4 :
    print(\"Dark whip\")
    inventory()
    elif user_weapon == 5 :
    print(\"Magic sword\")
    inventory()
    elif user_weapon == 6 :
    print(\"White quake\")
    inventory()
    elif user_weapon == 7 :
    print(\"Oblivious hammer\")
    inventory()
    elif user_weapon == 8 :
    print(\"Devil power\")
    inventory()
    if invent_choice == '3' :
    if user_shield == 1 :
    print(\"Rusty shield\")
    inventory()
    elif user_shield == 2 :
    print(\"Silver protector\")
    inventory()
    elif user_shield == 3 :
    print(\"Magic bubble\")
    inventory()
    elif user_shield == 4 :
    print(\"Devils shield\")
    inventory()
    if invent_choice == '4' :
    if user_armor == 1 :
    print(\"Rusty armor\")
    inventory()
    elif user_armor == 2 :
    print(\"Knights gear\")
    inventory()
    elif user_armor == 3 :
    print(\"Red smelt\")
    inventory()
    elif user_armor == 4 :
    print(\"Chapeler\")
    inventory()
    elif user_armor == 5 :
    print(\"Invulnerable plating\")
    inventory()
    if invent_choice == '5' :
    items = user_items
    print(items)
    if invent_choice == '6' :
    print(\"Current stats:\")
    print(\"Attack: \" + user_attack)
    print(\"Speed: \" + user_speed)
    print(\"Magic power: \" + user_mage)
    print(\"Accuracy: \" + user_accuracy)
    inventory()
    if invent_choice == '7' :
    menu()

    def train() :
    clear()
    print(\"Welcome to the training menu\")
    print(\"1 - Wrestling(+1 Attack. 30 G)\")
    print(\"2 - Running(+1 Speed. 10 G)\")
    print(\"3 - Ritual(+1 Magic Power. 30 G)\")
    print(\"4 - Archery(+1 Accuracy. 10 G\")
    print(\"5 - Exit\")
    train_choice = raw_input('Your choice: ')
    if train_choice == '1' :
    if gold < 30 :
    print(\"Not enough gold!\")
    if gold > 30 :
    print(\"Training. Please wait...\")
    time.sleep(30)
    print(\"Attack increased by one point!\")
    user_attack + 1
    gold - 30
    if gold == 30 :
    print(\"Training. Please wait...\")
    time.sleep(30)
    print(\"Attack increased by one point!\")
    user_attack + 1
    gold - 30
    if train_choice == '2' :
    if gold < 10 :
    print(\"Not enough gold!\")
    if gold > 10 :
    print(\"Training. Please wait...\")
    time.sleep(10)
    print(\"Speed increased by one!\")
    user_speed + 1
    gold - 10
    if gold == 10 :
    print(\"Training. Please wait...\")
    time.sleep(10)
    print(\"Speed increased by one!\")
    user_speed + 1
    gold - 10
    if train_choice == '3' :
    if gold < 30 :
    print(\"Not enough gold!\")
    if gold > 30 :
    print(\"Training. Please wait...\")
    time.sleep(30)
    print(\"Magic power increased by one!\")
    user_mage + 1
    gold - 30
    if gold == 30 :
    print(\"Training. Please wait...\")
    time.sleep(30)
    print(\"Magic power increased by one!\")
    user_mage + 1
    gold - 30
    if train_choice == '4' :
    if gold < 10 :
    print(\"Not enough gold!\")
    if gold > 10 :
    print(\"Training. Please wait...\")
    time.sleep(10)
    user_accuracy + 1
    gold - 10
    if gold == 10 :
    print(\"Training. Please wait...\")
    time.sleep(10)
    user_accuracy + 1
    gold - 10
    if train_choice == '5' :
    menu()

    def healme() :
    clear()
    print(\"Welcome to the land's infirmary\")
    print(\"1 - Heal(10 seconds\")
    print(\"2 - Replenish mana(5 seconds)\")
    print(\"3 - Exit\")
    infirm_choice = raw_input('Your choice: ')
    if infirm_choice == '1' :
    print(\"Please wait.. Healing\")
    time.sleep(10)
    user_health = 100
    print(\"Health replenished!\nPlease come again\n\")
    if infirm_choice == '2' :
    print(\"Please wait.. Replenishing mana\")
    time.sleep(5)
    user_mana = 100
    print(\"Mana replenished!\nPlease come again\n\")
    if infirm_choice == '3' :
    menu()
    def shop() :
    clear()
    print(\"Welcome to the shop of morageo!\")
    print(\"What shall you do?\")
    print(\"1 - Buy\")
    print(\"2 - Sell\")
    print(\"3 - Leave shop\")
    shop_choice = raw_input('Your choice: ')
    if shop_choice == '1' :
    print(\"What shall you buy?\")
    print(\"1 - Potion(10 G)\")
    print(\"2 - Weapons\")
    print(\"3 - Spells\")
    print(\"4 - Level up(400 G)\")
    buy_choice = raw_input('Your choice: ')
    if buy_choice == '1' :
    if gold < 10 :
    print(\"Not enough gold!\")
    elif gold > 10 :
    potions + 1
    print(\"Potion aquired!\")
    gold - 10
    elif gold == 10 :
    potions + 1
    print(\"Potion aquired!\")
    gold - 10
    print(\"Current gold:\")
    print(gold)
    if buy_choice == '2' :
    print(\"Weapon / Armor shop\")
    print(\"1 - Rusty sword(20 G\")
    print(\"2 - Rusty shield(15 G\")
    print(\"3 - Rusty armor(20 G\")
    print(\"4 - Exit\")
    weapon_choice = raw_input('Your choice: ')
    if weapon_choice == '1' :
    if gold < 20 :
    print(\"Not enough gold!\")
    if gold > 20 :
    user_weapon = 1
    gold - 20
    print(\"Purchased\n\")
    if gold == 20 :
    user_weapon = 1
    gold - 20
    print(\"Purchased\n\")
    if weapon_choice == '2' :
    if gold < 15 :
    print(\"Not enough gold!\")
    if gold > 15 :
    user_shield = 1
    gold - 20
    print(\"Purchased\n\")
    if gold == 15 :
    user_shield = 1
    gold - 20
    print(\"Purchased\n\")
    if weapon_choice == '3' :
    if gold < 20 :
    print(\"Not enough gold!\")
    if gold > 20 :
    user_armor = 1
    gold - 20
    print(\"Purchased\n\")
    if gold == 20 :
    user_armor = 1
    gold - 20
    print(\"Purchased\n\")
    if weapon_choice == '4' :
    shop()
    if buy_choice == '3' :
    print(\"Spells shop. 5 spells per purchase\")
    print(\"1 - Fire spell(15 G\")
    print(\"2 - Water spell(15 G)\")
    print(\"3 - Rock spell(15 G)\")
    print('4 - Exit')
    spell_choice == raw_input('Your choice: ')
    if spell_choice == '1' :
    if gold < 15 :
    print(\"Not enough gold!\")
    if gold > 15 :
    fire_spell + 5
    gold - 15
    print(\"Purchased 5 fire spells\")
    if gold == 15 :
    fire_spell + 5
    gold - 15
    print(\"Purchased 5 fire spells\")
    if spell_choice == '2' :
    if gold < 15 :
    print(\"Not enough gold!\")
    if gold > 15 :
    water_spell + 5
    gold - 15
    print(\"Purchased 5 water spells\")
    if gold == 15 :
    water_spell + 5
    gold - 15
    print(\"Purchased 5 water spells\")
    if spell_choice == '3' :
    if gold < 15 :
    print(\"Not enough gold!\")
    if gold > 15 :
    rock_spell + 5
    gold - 15
    print(\"Purchased 5 rock spells\")
    if gold == 15 :
    rock_spell + 5
    gold - 15
    print(\"Purchased 5 rock spells\")
    if spell_choice == '4' :
    shop()
    if buy_choice == '4' :
    if gold < 400 :
    print(\"Not enough gold!\")
    if gold > 15 :
    user_level + 1
    gold - 400
    print(\"Leveled up!\")
    if gold == 400 :
    user_level + 1
    gold - 400
    print(\"Leveled up!\")
    if shop_choice == '2' :
    print(\"1 - Weapon / Armor\")
    print(\"2 - Spells\")
    print(\"3 - Other items\")
    print(\"4 - Leave\")
    print(\"Selling not yet implemented!\")
    shop()
    if shop_choice == '3' :
    menu()
    done = 0
    while not done :
    menu()

    Yes I know, it's basic. But It's pretty fun :P
    Ideas for anything are welcome because as you can see, I have very little.

    EDIT: Updated with alot more!

    UPDATE: Added more, such as battle and training, etc..

    Also, I need some ideas for the game. Throw them at me! :P
  • Xin
    Posts: 3,251
    Wow looks good! :) il definately look into this when i know more python
    Xin
  • chroniccommand
    Posts: 1,389
    said:


    Wow looks good! :) il definately look into this when i know more python



    Thanks. I need some ideas if you have any :P
  • Xin
    Posts: 3,251
    Im not sure really :), you should make a hacking sim/game
    Xin
  • chroniccommand
    Posts: 1,389
    said:


    Im not sure really :), you should make a hacking sim/game



    I'll be making one after this it's gonna be cool =P
  • Xin
    Posts: 3,251
    You should make a hacking one instead i can help with ideas;)
    Xin
  • chroniccommand
    Posts: 1,389
    said:


    You should make a hacking one instead i can help with ideas;)



    Well I'm gonna finish pyPG then work on pyHak.
  • Xin
    Posts: 3,251
    Sounds good :), remember to make videos of them so i can upload
    Xin
  • chroniccommand
    Posts: 1,389
    said:


    Sounds good :), remember to make videos of them so i can upload



    Ok. I'm still working on pyPG ATM. I got the shop function pretty much done.
  • Bursihido
    Posts: 406
    Thank you bro :) ........ . . . . . .. ..
  • Xin
    Posts: 3,251
    Shouldnt this be pyRPG as pyPG is just python playing game, pyRPG would be python role playing game
    Xin
  • chroniccommand
    Posts: 1,389
    said:


    Shouldnt this be pyRPG as pyPG is just python playing game, pyRPG would be python role playing game



    Well I know. But pyRPG has been used before and just sounds so... meh. So it's pyPG as the 'py' part acts as the R in RPG.[hr]
    EDIT: Big update. Check the code out again I have so much more..
    Plus I've decided to make this a big full on text based terminal game. Using user options, there will be many realms, weapons, armor, enemies, objectives etc...
    Then after that I'll get working on pyHak.
  • Xin
    Posts: 3,251
    Wow sounds good ! :)
    Xin
  • chroniccommand
    Posts: 1,389
    said:


    Wow sounds good ! :)



    Thanks. I've updated the code again =D
  • Xin
    Posts: 3,251
    Yeah ive been looking :) its good
    Xin
  • chroniccommand
    Posts: 1,389
    said:


    Yeah ive been looking :) its good



    Thanks I've been working hard on it.
    PS> There is a slight bug in the signatures...
  • Xin
    Posts: 3,251
    Yeah its looking really nice,
    Xin
  • DizzY
    Posts: 155
    A game in python? NICE!!!
  • Flashlight
    Posts: 173
    just a suggestion i would suggest you make a save feature so people can exit and not have to worry about their game.
  • Xin
    Posts: 3,251
    Yeah deffo need a save, maybe just save to a .txt,
    Xin
  • chroniccommand
    Posts: 1,389
    Yea I've been thinking about that. Maybe saving and loading from an XML file.