Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- term.clear()
- term.setCursorPos(1,1)
- print"Welcome to ipadman123's RPG!"
- print""
- sleep(2)
- xp = 0
- ms = 0
- lvl = 1
- fs = 0
- while true do
- if xp >= 50 then
- print"You leveled up!"
- sleep(2)
- lvl=lvl+1
- print("Level: ", lvl)
- xp=xp-50
- sleep(2)
- term.clear()
- term.setCursorPos(1,1)
- end
- print"What would you like to do?"
- print""
- print"Type help for options"
- choice = read()
- mine = "mine"
- battle = "battle"
- help = "help"
- fish = "fish"
- if choice == help then
- term.clear()
- term.setCursorPos(1,1)
- print"The choices are:"
- print""
- print"mine"
- print"battle"
- print"help"
- print"fish"
- print""
- end
- random = math.random(1, 100)
- if choice == mine then
- term.clear()
- term.setCursorPos(1,1)
- print"You go mining"
- sleep(2)
- print"You find..."
- sleep(2)
- if random < 31 then
- print"Nothing."
- sleep(1)
- term.clear()
- term.setCursorPos(1,1)
- end
- if random < 51 and random > 30 then
- print"Coal!"
- sleep(1)
- print"Mining skill increased by 1!"
- ms=ms+1
- sleep(1)
- print("Mining skill: ", ms)
- sleep(1)
- xp=xp+1
- print("Total xp: ", xp)
- sleep(2)
- term.clear()
- term.setCursorPos(1,1)
- end
- if random < 66 and random > 50 then
- print"Iron!"
- sleep(1)
- print"Mining skill increased by 3!"
- ms=ms+3
- sleep(1)
- print("Mining skill: ", ms)
- sleep(1)
- xp=xp+3
- print("Total xp: ", xp)
- sleep(2)
- term.clear()
- term.setCursorPos(1,1)
- end
- if random < 81 and random > 65 then
- print"Gold!"
- sleep(1)
- print"Mining skill increased by 5!"
- sleep(1)
- ms=ms+5
- print("Mining skill: ", ms)
- sleep(1)
- xp=xp+5
- print("Total xp: ", xp)
- sleep(2)
- term.clear()
- term.setCursorPos(1,1)
- end
- if random < 91 and random > 80 then
- print"Redstone!"
- sleep(1)
- print"Mining skill increased by 7!"
- sleep(1)
- ms=ms+7
- print("Mining skill: ", ms)
- sleep(1)
- xp=xp+7
- print("Total xp: ", xp)
- sleep(2)
- term.clear()
- term.setCursorPos(1,1)
- end
- if random < 101 and random > 90 then
- print"Diamond!"
- sleep(1)
- print"Mining skill increased by 10!"
- sleep(1)
- ms=ms+10
- print("Mining skill: ", ms)
- sleep(1)
- xp=xp+10
- print("Total xp: ", xp)
- sleep(2)
- term.clear()
- term.setCursorPos(1,1)
- end
- end
- if choice == battle then
- term.clear()
- term.setCursorPos(1,1)
- print"You step into the arena"
- sleep(2)
- mob = math.random(1, 5)
- if mob == 1 then
- print"A zombie approaches you!"
- mob = "zombie"
- end
- if mob == 2 then
- print"A skeleton approaches you!"
- mob = "skeleton"
- end
- if mob == 3 then
- print"A spider approaches you!"
- mob = "spider"
- end
- if mob == 4 then
- print"A creeper approaches you!"
- mob = "creeper"
- end
- if mob == 5 then
- print"A enderman approaches you!"
- mob = "enderman"
- end
- x = 1
- mhp = 20
- php = 20
- st = 0
- mobheal = 0
- while x == 1 do
- print("Current Health: ", php ,"/20")
- print("Enemy Health: ", mhp ,"/20")
- print"What do you do?"
- sleep(1)
- print"(leave, stun, punch, slice, jab, heal)"
- action = read()
- leave = "leave"
- slice = "slice"
- jab = "jab"
- heal = "heal"
- punch = "punch"
- stun = "stun"
- if action == leave then
- print"You cowardly leave the fight"
- print""
- sleep(2)
- x=x+1
- term.clear()
- term.setCursorPos(1,1)
- end
- if action == punch then
- print("You punch the ", mob," in the face!")
- sleep(1)
- print("The ", mob ," takes 2 damage!")
- sleep(2)
- mhp=mhp-2
- term.clear()
- term.setCursorPos(1,1)
- end
- if action == slice then
- print("You slice at the ", mob)
- sleep(2)
- luck = math.random(1, 2)
- if luck == 1 then
- print"Your slice succeded!"
- sleep(1)
- print("The ", mob ," takes 5 damage!")
- sleep(1)
- mhp=mhp-5
- print(mob,"'s health: ", mhp)
- sleep(2)
- term.clear()
- term.setCursorPos(1,1)
- else
- print"Your slice failed!"
- sleep(2)
- term.clear()
- term.setCursorPos(1,1)
- end
- end
- if action == jab then
- print("You jab at the ", mob)
- sleep(2)
- luck = math.random(1, 5)
- if luck == 1 then
- print"Your jab succeeded!"
- sleep(2)
- print("The ", mob ," takes 12 damage!")
- sleep(2)
- mhp=mhp-12
- print(mob,"'s health: ", mhp)
- sleep(2)
- term.clear()
- term.setCursorPos(1,1)
- else
- print"Your jab failed!"
- sleep(2)
- term.clear()
- term.setCursorPos(1,1)
- end
- end
- if action == heal then
- print"You attempt to heal yourself!"
- sleep(1)
- if php <= 20 then
- luck = math.random(1, 8)
- if luck >= 2 then
- print"Your heal is successful!"
- sleep(1)
- print"You heal 10 points!"
- php=php+10
- sleep(2)
- term.clear()
- term.setCursorPos(1,1)
- if php > 20 then
- php = 20
- end
- else
- print"Your heal failed!"
- sleep(2)
- term.clear()
- term.setCursorPos(1,1)
- end
- end
- end
- if action == stun then
- print("You try to stun the ", mob)
- sleep(2)
- luck = math.random(1, 2)
- if luck == 1 then
- print"Your stun succeeded!"
- sleep(1)
- print("The ", mob ," can't attack for 2 turns!")
- sleep(2)
- st=st+2
- term.clear()
- term.setCursorPos(1,1)
- else
- print"Your stun failed!"
- sleep(2)
- term.clear()
- term.setCursorPos(1,1)
- end
- end
- if mhp <= 0 then
- print"You have defeated the enemy!"
- sleep(1)
- x=x+1
- sleep(2)
- print"You gain 35 xp!"
- xp=xp+35
- sleep(1)
- print("Current xp: ", xp)
- sleep(2)
- term.clear()
- term.setCursorPos(1,1)
- end
- if mhp <= 5 and st == 0 then
- print("The ", mob ," attempts to heal itself!")
- sleep(1)
- mh = math.random(1, 2)
- mobheal=mobheal+1
- if mh == 1 then
- print("The ", mob ," successfully healed itself!")
- sleep(1)
- print"It heals 5 points!"
- mhp=mhp+5
- sleep(2)
- term.clear()
- term.setCursorPos(1,1)
- else
- print("The ", mob ," failed to heal itself!")
- sleep(2)
- term.clear()
- term.setCursorPos(1,1)
- end
- end
- if x == 1 and st == 0 and mobheal == 0 then
- dmg = math.random(1, 4)
- print("The ", mob ," attacks!")
- sleep(1)
- if dmg == 1 then
- print"The attack deals 3 damage!"
- sleep(1)
- php=php-3
- sleep(2)
- term.clear()
- term.setCursorPos(1,1)
- end
- if dmg == 2 then
- print"The attack deals 4 damage!"
- sleep(1)
- php=php-4
- sleep(2)
- term.clear()
- term.setCursorPos(1,1)
- end
- if dmg == 3 then
- print"The attack deals 5 damage!"
- sleep(1)
- php=php-5
- sleep(2)
- term.clear()
- term.setCursorPos(1,1)
- end
- if dmg == 4 then
- print("The ", mob, "'s attack misses!")
- sleep(2)
- term.clear()
- term.setCursorPos(1,1)
- end
- end
- if st > 0 then
- st=st-1
- end
- if mobheal > 0 then
- mobheal=mobheal-1
- end
- if php <= 0 then
- term.clear()
- term.setCursorPos(1,1)
- print"You have lost the battle!"
- sleep(2)
- x=x+1
- term.clear()
- term.setCursorPos(1,1)
- end
- end
- end
- if choice == fish then
- term.clear()
- term.setCursorPos(1,1)
- print"You go Fishing"
- sleep(2)
- print"You catch..."
- sleep(2)
- if random < 31 then
- print"Nothing."
- sleep(1)
- term.clear()
- term.setCursorPos(1,1)
- end
- if random < 51 and random > 30 then
- print"Flounder!"
- sleep(1)
- print"Fishing skill increased by 1!"
- fs=fs+1
- sleep(1)
- print("Fishing skill: ", fs)
- sleep(1)
- xp=xp+1
- print("Total xp: ", xp)
- sleep(2)
- term.clear()
- term.setCursorPos(1,1)
- end
- if random < 66 and random > 50 then
- print"Cod!"
- sleep(1)
- print"Fishing skill increased by 3!"
- fs=fs+3
- sleep(1)
- print("Fishing skill: ", fs)
- sleep(1)
- xp=xp+3
- print("Total xp: ", xp)
- sleep(2)
- term.clear()
- term.setCursorPos(1,1)
- end
- if random < 81 and random > 65 then
- print"Bass!"
- sleep(1)
- print"Fishing skill increased by 5!"
- sleep(1)
- fs=fs+5
- print("Fishing skill: ", fs)
- sleep(1)
- xp=xp+5
- print("Total xp: ", xp)
- sleep(2)
- term.clear()
- term.setCursorPos(1,1)
- end
- if random < 91 and random > 80 then
- print"Salmon!"
- sleep(1)
- print"Fishing skill increased by 7!"
- sleep(1)
- fs=fs+7
- print("Fishing skill: ", fs)
- sleep(1)
- xp=xp+7
- print("Total xp: ", xp)
- sleep(2)
- term.clear()
- term.setCursorPos(1,1)
- end
- if random < 101 and random > 90 then
- print"Marlin!"
- sleep(1)
- print"Fishing skill increased by 10!"
- sleep(1)
- fs=fs+10
- print("Fishing skill: ", fs)
- sleep(1)
- xp=xp+10
- print("Total xp: ", xp)
- sleep(2)
- term.clear()
- term.setCursorPos(1,1)
- end
- end
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement