Hello everybody! Here is Zoroark173 with my first released program! I plan on making a multitude of programs, but I shall start you all of with a game that I have made! Note, this is the very first version of the game, so there are many features in it that might be missing that I will add over time!
Installation: To install any of my games, open your computer in game and type in:
pastebin get {pastebin id} {program name}
This will allow you to use pastebin to get any of my programs automagically uploaded to your computer!
Or you can do it the manual wat buy making the .text file in your computers file in your worlds save folder...
SwordQuest v1.1!
In the game SwordQuest, you travel across the land, fighting deadly monsters while trying to stay alive!
Pastebin ID: dpxaV7s9
Manual code:
Spoiler
--SwordQuest
--Made by Zoroark173
--Release Candidite for NDF-OS
--Do not change version number
local versionnumber = 1.1
local var = 0
local var2 = 10
local var3 = 7
local var4 = 1
local var5 = 0
local i = 1
function clean()
term.clear()
term.setCursorPos(1,1)
end
function creature()
var3 = 7
var = math.random(1,6)
if var==1 then
monster = "Goblin"
elseif var==2 then
monster = "Giant Spider"
elseif var==3 then
monster = "Dragon Hatchling"
elseif var==4 then
monster = "Possessed Santa Clause"
elseif var==5 then
monster = "Zombie"
elseif var==6 then
monster = "Skeleton"
end
var5 = math.random(1,6)
if var5==1 then
scene = "A "
scene2 = " stole your treasure!"
elseif var5==2 then
scene = "The princess was kindnapped by a "
scene2 = " that wanted to marry her!"
elseif var5==3 then
scene = "You must defeat the "
scene2 = " king!"
elseif var5==4 then
scene = "Destroy the "
scene2 = " before it gets to the village!"
elseif var6==5 then
scene = "Your family was slain by a "
scene2 = ", so defeat him for revenge!"
elseif var6==6 then
scene = "The "
scene2 = " is a fan of Justin Bieber. We must kill it."
end
end
--Declaring variables and functions
--------------------------------------
--Bulk of the program
clean()
print("Hello, welcome to SwordQuest!")
print("Type 1 to start the game!")
print("Or 2 to see the Help section!")
print("Or 3 to see the credits!")
startmenu = read()
if startmenu == "2" then
print("Type 1 at the main screen to start the game")
print("Commands avalible in-game are Move, Attack, and Potion")
print("Move brings you to a new monster.")
print("Attack attacks the monster.")
print("Potion uses a healing potion.")
print("Exit leaves the game.")
print("Contact Zoroark173 for more info!")
sleep(7)
print("Please restart me")
end
if startmenu == "3" then
textutils.slowPrint("Coded by Zoroark173")
textutils.slowPrint("Small edits by Lyqyd")
textutils.slowPrint("Thanks to sIdEkIcK_ for major bugfix")
textutils.slowPrint("And a big thanks to you for playing :D/>/>/>")
sleep(3)
print("Please restart me...")
end
--Help section
--------------------------------
--In battle
if startmenu == "1" then
clean()
creature()
print(scene..monster..scene2)
print("Move, Attack, Potion, or Exit?")
repeat
battle = string.lower(read())
if battle == "potion" then
var2 = 10
print("Heal Complete!")
print("HP: "..var2)
print(monster.." attacks!")
var2 = var2-1
print("HP: "..var2)
sleep(3)
elseif battle == "attack" then
var3 = var3-1
print("Did 1 damage to "..monster)
var2 = var2-1
print("Monster's HP: "..var3)
print(monster.." did 1 damage to you.")
print("HP: "..var2)
sleep(2)
if var3 <= 0 then
print("You have defeated the "..monster)
sleep(2)
clean()
creature()
print(scene..monster..scene2)
sleep(2)
elseif var2 <= 0 then
print("You have somehow managed to die in a game where you have infinite free heals, Adventurer.")
sleep(3)
print("Farewell brave Hero!")
break
end
elseif battle == "move" then
print("Moving...")
clean()
creature()
print(scene..monster..scene2)
i = i+1
elseif battle == "exit" then
print("Quitting Game...")
sleep()
break
else
print("Unknown action.")
end
until var4 == 100
end
Changelog:
Spoiler
12/24/2012- Added a few thigns, namely checking to see if you or your opponent are dead, and scenarios, to make the game a bit more interesting!
10/17/2012- First release
Note:
You may use my program on your own world or a server, but please do not claim the program as your own, include it in an OS, or use it to make money (eg. adf.ly) without my permission.
People with permssion so far: @NDFJay - in the NDF-OS
For when you get a random monster, these lines can be changed into two simple lines with a table:
var = math.random(1,6)
if var==1 then
monster = "Goblin"
elseif var==2 then
monster = "Giant Spider"
elseif var==3 then
monster = "Dragon Hatchling"
elseif var==4 then
monster = "Possessed Santa Clause"
elseif var==5 then
monster = "Zombie"
elseif var==6 then
monster = "Skeleton"
end
For when you get a random monster, these lines can be changed into two simple lines with a table:
var = math.random(1,6)
if var==1 then
monster = "Goblin"
elseif var==2 then
monster = "Giant Spider"
elseif var==3 then
monster = "Dragon Hatchling"
elseif var==4 then
monster = "Possessed Santa Clause"
elseif var==5 then
monster = "Zombie"
elseif var==6 then
monster = "Skeleton"
end
Thanks RemiX, but I like the way I have it, because it makes it super easy for someone to change it up, and implement their own monsters, without getting a bit confused, especially novice coders.
Thanks RemiX, but I like the way I have it, because it makes it super easy for someone to change it up, and implement their own monsters, without getting a bit confused, especially novice coders.
To add new monsters with remiX's solution it is actually easier to change it meaning less chance for issues arising from them missing to say change the 6 in math.random to add however many they added... to add a new monster to remiX's this is all you have to change
t_monsters = {"Goblin", "Giant Spider", "Dragon Hatchling", "Possessed Santa Clause", "Zombie", "Skeleton", "Some new mob" }
its that easy, there is nothing else to change because the math.random is dynamic to the size of the monsters table...
Yeah, all you have to do is add another string to the table of a new mob's name and it will work 100%. But don't let us force you, you can do it your way if you want