Batch RPG Turn combat

Discussion forum for all Windows batch related topics.

Moderator: DosItHelp

Message
Author
ShadowThief
Expert
Posts: 1167
Joined: 06 Sep 2013 21:28
Location: Virginia, United States

Re: Broken Health Potion and Enemy on Batch Rpg

#31 Post by ShadowThief » 10 Oct 2015 15:56

TheHunterManX wrote:forgot the set variable
this is your code:

Code: Select all

if %input% == 1 set hpots= %hpots% - 1
if %input% == 1 %health% + 35
if %input% == 1 goto fight

and this is the correct code:

Code: Select all

if %input% == 1 set hpots= %hpots% - 1
if %input% == 1 set health= %health% + 35
if %input% == 1 goto fight

Actually, the correct code would be

Code: Select all

if %input% == 1 set /a hpots=%hpots%-1
if %input% == 1 set /a health=%health%+35
if %input% == 1 goto fight


You could also say

Code: Select all

if %input%==1 (
    set /a hpots=%hpots%-1
    set /a health=%health%+35
    goto fight
)

TheHunterManX
Posts: 54
Joined: 14 Aug 2015 05:59

Re: Broken Health Potion and Enemy on Batch Rpg

#32 Post by TheHunterManX » 10 Oct 2015 16:06

Yeah, kind of oversaw that.

j0y
Posts: 26
Joined: 10 Oct 2015 08:22

Re: Broken Health Potion and Enemy on Batch Rpg

#33 Post by j0y » 10 Oct 2015 16:13

Thanks Shadow Thief!
But it still leaves the broken enemy health bar problem. Whenever I get into a fight, it says the enemy has 88 health, cuz im on lvl 8, but i kill it with just 1 hit! Even if I do 1 damage.

TheHunterManX
Posts: 54
Joined: 14 Aug 2015 05:59

Re: Broken Health Potion and Enemy on Batch Rpg

#34 Post by TheHunterManX » 10 Oct 2015 16:34

Let me know if this helps!

Code: Select all

@echo off
:fight1
call Save.bat
set enehealth=70
if %level% == 2 set enehealth=82
if %level% == 3 set enehealth=83
if %level% == 4 set enehealth=84
if %level% == 5 set enehealth=85
if %level% == 6 set enehealth=86
if %level% == 7 set enehealth=87
if %level% == 8 set enehealth=88
if %level% == 9 set enehealth=99
if %level% GTR 9 set enehealth=100
:fight
if %health% GTR 100 set health=100
if %health% LSS 1 goto lose
cls
echo FIGHT
echo -------------------------------------------------
echo Rosanna's Hp:%health%/100 Level:%level%
echo Weapon:%wepdis%  Armour:%armdis% Spell:%spldis%
echo -------------------------------------------------
echo Enemy
echo Hp:%enehealth%/100
echo.
echo 1) Attack
echo 2) Drink Potion
echo 3) Spell
echo 4) Flee
echo.
set /p input=Enter:

if %input% == 1 goto attack
if %input% == 2 goto potion
if %input% == 3 goto spell
if %input% == 4 goto flee
goto fight

:attack
set /a num=%random% %%10 +1 + %level%*2+1
cls
echo You take %num% health from
echo the enemy.
pause >nul
set /a enehealth= %enehealth% - %num%
set /a exp= %exp% + %num% * 2
goto eneattack

:eneattack
if %enehealth% LSS 1 goto win
set /a num=%random% %%10 +1 + %level%*2+1
if %num% GTR 7 goto eneattack
if %num% LSS 0 goto eneattack
set /a num= %num% - %def%
if %num% LSS 0 set num=0
cls
echo The enemy takes %num% health
echo from you.
pause >nul
set /a health= %health% - %num%
goto fight
:spell
set num=%spl%
cls
echo You cast a spell and take %num% health from
echo the enemy.
echo.
pause >nul
set /a enehealth= %enehealth% - %num%
set /a exp= %exp% + %num% * 2
goto enattack


Tell me if this is not what you want :D

j0y
Posts: 26
Joined: 10 Oct 2015 08:22

Re: Broken Health Potion and Enemy on Batch Rpg

#35 Post by j0y » 10 Oct 2015 16:41

Shadow THief
sorry no. I'm looking to fix the health of the enemy, because it successfully says it increases each time i level up. but when i fight the enemy, he dies in one hit! it says he has 88 health and that i managed to steal 30 health (i caused 30 damage). But no matter how much damage i cause or how much health he has, he always dies in one hit!

ShadowThief
Expert
Posts: 1167
Joined: 06 Sep 2013 21:28
Location: Virginia, United States

Re: Broken Health Potion and Enemy on Batch Rpg

#36 Post by ShadowThief » 10 Oct 2015 16:44

You're gonna kick yourself...

When you're removing health from the enemy during the fight, you're subtracting from the enhealth variable. However, when you initially set the enemy health variable, you're setting the enehealth variable, so the enhealth variable technically doesn't exist. When you use non-existent variables with set /a, it assumes that those variables should be 0. You always win the battle because you're checking against the wrong variable.

CTRL-H and change all instances of enhealth to enehealth (or the other way around).

j0y
Posts: 26
Joined: 10 Oct 2015 08:22

Re: Broken Health Potion and Enemy on Batch Rpg

#37 Post by j0y » 10 Oct 2015 17:07

shadow thief
everything is fixed now. But now everytime i cast a spell it sops at pause >nul and doesn't let me do anything. it just freezes.
here is my spell script:

Code: Select all

:spell

set num=%spl%
if %num% GTR %str% goto attack
if %num% LSS 0 goto attack
if %num% == 00 set num=0
if %num% == 01 set num=1
if %num% == 02 set num=2
if %num% == 03 set num=3
if %num% == 04 set num=4
if %num% == 05 set num=5
if %num% == 06 set num=6
if %num% == 07 set num=7
if %num% == 08 set num=0
if %num% == 09 set num=7
cls
echo You cast a spell and steal %num% health from
echo the enemy.
echo.
pause >nul
set /a enehealth= %enehealth% - %num%
set /a exp= %exp% + %num% * 2
goto eneattack

Squashman
Expert
Posts: 4488
Joined: 23 Dec 2011 13:59

Re: Broken Health Potion and Enemy on Batch Rpg

#38 Post by Squashman » 10 Oct 2015 17:16

Remove the pause>nul or just hit any key. It certainly will not freeze the batch file without doing anything. All you have to do is type a key. You can test that at the cmd prompt!

j0y
Posts: 26
Joined: 10 Oct 2015 08:22

Re: Broken Health Potion and Enemy on Batch Rpg

#39 Post by j0y » 10 Oct 2015 17:24

just removed pause >nul and the same things. even if i press any key nothing happens! it just freezes and doesn't respond to anything i do!

ShadowThief
Expert
Posts: 1167
Joined: 06 Sep 2013 21:28
Location: Virginia, United States

Re: Broken Health Potion and Enemy on Batch Rpg

#40 Post by ShadowThief » 10 Oct 2015 17:58

The only thing in batch that would cause that behavior that I can think of is an infinite goto loop, which all of your code that I've seen up to this point doesn't have.

I can't believe we haven't told you to do this by now, but your first step while debugging should always be to remove @echo off from the beginning of your code and see what commands are being run when the script is giving you issues.

j0y
Posts: 26
Joined: 10 Oct 2015 08:22

Re: Broken Health Potion and Enemy on Batch Rpg

#41 Post by j0y » 11 Oct 2015 01:39

Here is all my code:

Code: Select all

title AWB
color a
:menu
color a
cls
echo =========================
echo Arena of the White Bear
echo =========================
echo.
echo 1) Start
echo 2) Load
echo 3) Exit
echo.
set /p input=Enter:

if %input% == 1 goto start
if %input% == 2 goto load
if %input% == 3 exit
goto menu

:start
set level=1
set health=100
set money=50
set exp=0
set expmax=100
set str=10
set def=0
set wep=0
set wepdis=None
set arm=0
set armdis=None
set hpots=2
set spl=0
set spldis=None
cls
echo Your name is Rosanna. You are a slave, but the Jarl of the North's End has
echo offered you a chance to gain freedom, in exchange you make an interesting and
echo gruesome display in the Arena of the White Bear. Go on, it is your chance,
echo and nothing is going to wrench this away from you.

pause >nul

cls

goto main

:main
if %exp% GEQ %expmax% goto levelup
if %money% LSS 0 set money=0
if %wep% == 1 set wepdis=Whip   
if %wep% == 2 set wepdis=Axe
if %wep% == 3 set wepdis=Greatsword
if %wep% == 4 set wepdis=Bow
if %wep% == 5 set wepdis=Flintlock Pistol
if %wep% == 6 set wepdis=Hunter's Rifle
if %wep% == 1 set str=13
if %wep% == 2 set str=16
if %wep% == 3 set str=19
if %wep% == 4 set str=21
if %wep% == 5 set str=25
if %wep% == 6 set str=30
if %arm% == 1 set armdis=Leather
if %arm% == 2 set armdis=Iron
if %arm% == 3 set armdis=Titanium
if %arm% == 4 set armdis=Werewolf Silver
if %arm% == 5 set armdis=Cursed Armor
if %arm% == 1 set def=1
if %arm% == 2 set def=2
if %arm% == 3 set def=3
if %arm% == 4 set def=4
if %arm% == 5 set def=12
if %arm% == 5 set health=1
if %spl% == 1 set spldis=Fireball
if %spl% == 2 set spldis=Thunder Bolt
if %spl% == 1 set spl=5
if %spl% == 2 set spl=10
cls
echo AWB
echo -----------------------------------------------
echo Rosanna  Level:%level%   Money:$%money%
echo Hp:%health%/100  Xp:%exp%/%expmax%
echo Weapon:%wepdis% Armour:%armdis% Spell:%spldis%
echo -----------------------------------------------
echo 1) Fight
echo 2) Shop
echo 3) Drink Potion
echo 4) Save
echo 5) Exit
echo.
set /p input=Enter:

if %input% == 1 goto fight1
if %input% == 2 goto shop
if %input% == 3 goto DP
if %input% == 4 goto save
if %input% == 5 goto exit
goto main

:DP
cls
echo AWB
echo -----------------------------------------------
echo Rosanna  Level:%level%   Money:$%money%
echo Hp:%health%/100  Xp:%exp%/%expmax%
echo Weapon:%wepdis% Armour:%armdis% Spell:%spldis%
echo -----------------------------------------------
echo 1)Drink Potion
echo 2)Back
echo.
set /p input=Enter:

if %input% == 1 set /a hpots=%hpots%-1
if %input% == 1 set /a health=%health%+35
if %input% == 1 goto DP
if %input% == 2 goto main
:load
if not exist Save.ini goto loaderror
< Save.ini (
set /p enehealth=
set /p level=
set /p health=
set /p money=
set /p exp=
set /p expmax=
set /p str=
set /p def=
set /p wep=
set /p wepdis=
set /p arm=
set /p armdis=
set /p hpots=
set /p spl=
set /p spldis=
)
goto main

:loaderror
cls
echo No save file found...
pause >nul
goto menu

:fight1
if %level% == 2 set enehealth=82
if %level% == 3 set enehealth=83
if %level% == 4 set enehealth=84
if %level% == 5 set enehealth=85
if %level% == 6 set enehealth=86
if %level% == 7 set enehealth=87
if %level% == 8 set enehealth=88
if %level% == 9 set enehealth=99
if %level% GTR 9 set enehealth=100

:fight
if %health% GTR 100 set health=100
if %health% LSS 1 goto lose
cls
echo FIGHT
echo -------------------------------------------------
echo Rosanna's Hp:%health%/100 Level:%level%
echo Weapon:%wepdis%  Armour:%armdis% Spell:%spldis%
echo -------------------------------------------------
echo Enemy
echo Hp:%enehealth%/100
echo.
echo 1) Attack
echo 2) Drink Potion
echo 3) Spell
echo 4) Flee
echo.
set /p input=Enter:

if %input% == 1 goto attack
if %input% == 2 goto potion
if %input% == 3 goto spell
if %input% == 4 goto flee
goto fight

:attack
set num=%random:~-2%
if %num% GTR %str% goto attack
if %num% LSS 0 goto attack
if %num% == 00 set num=0
if %num% == 01 set num=1
if %num% == 02 set num=2
if %num% == 03 set num=3
if %num% == 04 set num=4
if %num% == 05 set num=5
if %num% == 06 set num=6
if %num% == 07 set num=7
if %num% == 08 set num=0
if %num% == 09 set num=7
cls
echo You take %num% health from
echo the enemy.
pause >nul
set /a enehealth= %enehealth% - %num%
set /a exp= %exp% + %num% * 2
goto eneattack

:eneattack

if %enehealth% LSS 1 goto win
set /a num=%random% %%10 +1 + %level%*2+1
if %num% GTR 7 goto eneattack
if %num% LSS 0 goto eneattack
set /a num= %num% - %def%
if %num% LSS 0 set num=0
cls
echo The enemy takes %num% health
echo from you.
pause >nul
set /a health= %health% - %num%
goto fight

:spell

set num=%spl%
if %num% GTR %str% goto attack
if %num% LSS 0 goto attack
if %num% == 00 set num=0
if %num% == 01 set num=1
if %num% == 02 set num=2
if %num% == 03 set num=3
if %num% == 04 set num=4
if %num% == 05 set num=5
if %num% == 06 set num=6
if %num% == 07 set num=7
if %num% == 08 set num=0
if %num% == 09 set num=7
cls
echo You cast a spell and steal %num% health from
echo the enemy.
echo.
set /a enehealth= %enehealth% - %num%
set /a exp= %exp% + %num% * 2
goto eneattack

:win
set num=%random:~-2%
if %num% GTR 35 goto win
if %num% LSS 15 goto win
cls
echo Congratulations, you killed
echo the enemy!
echo.
echo You found $%num%
pause >nul
set /a money= %money% + %num%
goto main

:lose
cls
color c
echo Oh no, you died!
echo.
echo You will have to start again! Your save file has been deleted!
del save
pause >nul
goto menu

:potion
cls
echo 1)Drink Potion
echo 2)Back
echo.
set /p input=Enter:

if %input% == 1 set /a hpots=%hpots%-1
if %input% == 1 set /a health=%health%+35
if %input% == 1 goto fight
if %input% == 2 goto fight

:nopots
cls
echo You have no potions left!
pause >nul
goto fight

:flee
cls
echo You run away!
echo.
echo -$30
pause >nul
set /a money= %money% - 30
goto main

:shop
cls
echo SHOP
echo --------------------------------------
echo Rosanna
echo Money:$%money% Level:%level%
echo --------------------------------------
echo [a)Weapons]b)Armor]c)Potions]d)Spells
echo.
echo WARNING: Cursed objects require sacrifices!
echo.
echo 1) Whip             $30     Lvl: 1
echo 2) Axe              $70     Lvl: 3
echo 3) Greatsword       $150    Lvl: 6
echo 4) Bow              $200    Lvl: 7
echo 5) Flintlock Pistol $250    Lvl: 7
echo 6) Hunter's Rifle   $300    Lvl: 8
echo 7) Back
echo.
set /p input=Enter:

if %input% == 7 goto main
if %input% == a goto shop
if %input% == b goto shop2
if %input% == c goto shop3
if %input% == d goto shop4
if %money% LSS 30 goto nofunds
if %input% == 1 set /a money= %money% - 30
if %input% == 1 set wep=1
if %input% == 1 goto shop
if %level% LSS 3 goto nolev
if %money% LSS 70 goto nofunds
if %input% == 2 set /a money= %money% - 70
if %input% == 2 set wep=2
if %input% == 2 goto main
if %level% LSS 6 goto nolev
if %money% LSS 150 goto nofunds
if %input% == 3 set /a money= %money% - 150
if %input% == 3 set wep=3
if %input% == 3 goto shop
if %input% == 4 set /a money= %money% - 200
if %input% == 4 set wep=4
if %input% == 4 goto shop
if %level% LSS 7 goto nolev
if %money% LSS 200 goto nofunds
if %input% == 5 set /a money= %money% - 250
if %input% == 5 set wep=5
if %input% == 5 goto shop
if %level% LSS 7 goto nolev
if %money% LSS 250 goto nofunds
if %input% == 6 set /a money= %money% - 300
if %input% == 6 set wep=6
if %input% == 6 goto shop
if %level% LSS 8 goto nolev
if %money% LSS 300 goto nofunds
goto shop

:shop2
cls
echo SHOP
echo --------------------------------------
echo Rosanna
echo Money:$%money% Level:%level%
echo --------------------------------------
echo [a)Weapons]b)Armor]c)Potions]d)Spells
echo.
echo WARNING: Cursed objects require sacrifices!
echo.
echo 1) Leather          $50     Lvl: 1
echo 2) Iron             $90     Lvl: 3
echo 3) Titanium         $200    Lvl: 6
echo 4) Werewolf Silver  $275    Lvl: 8
echo 5) Cursed Armor     $350    Lvl: 1
echo 6) Back
echo.
set /p input=Enter:

if %input% == 6 goto main
if %input% == a goto shop
if %input% == b goto shop2
if %input% == c goto shop3
if %input% == d goto shop4
if %money% LSS 50 goto nofunds
if %input% == 1 set /a money= %money% - 50
if %input% == 1 set arm=1
if %input% == 1 goto shop2
if %level% LSS 3 goto nolev
if %money% LSS 90 goto nofunds
if %input% == 2 set /a money= %money% - 90
if %input% == 2 set arm=2
if %input% == 2 goto shop2
if %level% LSS 6 goto nolev
if %money% LSS 200 goto nofunds
if %input% == 3 set /a money= %money% - 200
if %input% == 3 set arm=3
if %input% == 3 goto shop2
if %input% == 4 set /a money= %money% - 275
if %input% == 4 set arm=4
if %input% == 4 goto shop2
if %level% LSS 8 goto nolev
if %money% LSS 275 goto nofunds
if %input% == 5 set /a money= %money% - 350
if %input% == 5 set arm=5
if %input% == 5 goto shop2
if %level% LSS 1 goto nolev
if %money% LSS 350 goto nofunds
goto shop2

:shop3
cls
echo SHOP
echo --------------------------------------
echo Rosanna
echo Money:$%money% Level:%level%
echo --------------------------------------
echo [a)Weapons[b)Armour[c)Potions]d)Spells
echo.
echo 1) Health Potion    $30
echo 2) Level Potion     $1000
echo 3) Back
echo.
echo.
set /p input=Enter:

if %input% == 3 goto main
if %input% == a goto shop
if %input% == b goto shop2
if %input% == c goto shop3
if %input% == d goto shop4
if %money% LSS 30 goto nofunds
if %input% == 1 set /a money= %money% - 30
if %input% == 1 set hpots= %hpots% + 1
if %input% == 1 goto shop3
if %money% LSS 1000 goto nofunds
if %input% == 2 set /a money= %money% - 1000
if %input% == 2 goto shop3
goto shop3

:shop4
cls
echo SHOP
echo --------------------------------------
echo Rosanna
echo Money:$%money% Level:%level%
echo --------------------------------------
echo [a)Weapons[b)Armour[c)Potions]d)Spells
echo.
echo 1) Fireball     $50     Lvl: 1
echo 2) Thunder Bolt $150    Lvl: 2
echo 3) Back
echo.
echo.
set /p input=Enter:
if %input% == 3 goto main
if %input% == a goto shop
if %input% == b goto shop2
if %input% == c goto shop3
if %input% == d goto shop4
if %money% LSS 50 goto nofunds
if %input% == 1 set /a money= %money% - 50
if %input% == 1 set spl=5
if %input% == 1 set spldis=Fireball
if %input% == 1 goto shop4
if %level% LSS 1 goto nolev
if %money% LSS 150 goto nofunds
if %input% == 2 set /a money= %money% - 150
if %input% == 2 set spl=10
if %input% == 2 set spldis=Thunder Bolt
if %input% == 2 goto shop4
if %level% LSS 2 goto nolev
goto shop4

:nofunds
cls
echo You don't have enough money
echo to purchase this item.
pause >nul
goto main

:nolev
cls
echo Your level isn't high enough
echo to purchase this item.
pause >nul
goto main

:save
(
echo %enehealth%
echo %level%
echo %health%
echo %money%
echo %exp%
echo %expmax%
echo %str%
echo %def%
echo %wep%
echo %wepdis%
echo %arm%
echo %armdis%
echo %hpots%
echo %spl%
echo %spldis%) >Save.ini
cls
echo Game Saved!
pause >nul
goto main

:exit
cls
echo All unsaved progress will be
echo lost, are you sure? (Y/N)
set /p input=

if %input% == y exit
if %input% == n goto main
if %input% == Y exit
if %input% == N goto main
goto exit
pause >nul
exit

:levelup
set /a level= %level% + 1
set exp=0
set /a expmax= %expmax% * 150 / 100
cls
echo Congratulations!
echo.
echo You are now level %level%!
echo.
pause >nul
goto main

I did what yo said and I found an infinite loop. I don't know why, nut it keeps going to :eneattack

ShadowThief
Expert
Posts: 1167
Joined: 06 Sep 2013 21:28
Location: Virginia, United States

Re: Broken Health Potion and Enemy on Batch Rpg

#42 Post by ShadowThief » 11 Oct 2015 01:45

Probably because when

Code: Select all

set /a num=%random% %%10 +1 + %level%*2+1
runs and you are over level 1, %num% is guaranteed to be greater than 7, so you will get caught in an infinite loop.

j0y
Posts: 26
Joined: 10 Oct 2015 08:22

Re: Broken Health Potion and Enemy on Batch Rpg

#43 Post by j0y » 11 Oct 2015 01:49

Shadow thief
So how do I fix it?

ShadowThief
Expert
Posts: 1167
Joined: 06 Sep 2013 21:28
Location: Virginia, United States

Re: Broken Health Potion and Enemy on Batch Rpg

#44 Post by ShadowThief » 11 Oct 2015 02:06

At the risk of sounding like a smart aleck... don't do that. Just delete the line that checks that %num% is greater than 7; I don't see why you would want that line to be there anyway.

And if you absolutely insist on maxing out num at 7, replace

Code: Select all

if %num% GTR 7 goto eneattack
with

Code: Select all

set /a num=%num%%%8
and the value of num will be guaranteed to be between 0 and 7.

j0y
Posts: 26
Joined: 10 Oct 2015 08:22

Re: Broken Health Potion and Enemy on Batch Rpg

#45 Post by j0y » 11 Oct 2015 02:16

I have fixed the infinte loop. But now everytime I attack or cast a spell, it says 1 was not expected at this time. THis is how my code looks now.

Code: Select all

title AWB
color a
@echo off
:menu
color a
cls
echo =========================
echo Arena of the White Bear
echo =========================
echo.
echo 1) Start
echo 2) Load
echo 3) Exit
echo.
set /p input=Enter:

if %input% == 1 goto start
if %input% == 2 goto load
if %input% == 3 exit
goto menu

:start
set level=1
set health=100
set money=50
set exp=0
set expmax=100
set str=10
set def=0
set wep=0
set wepdis=None
set arm=0
set armdis=None
set hpots=2
set spl=0
set spldis=None
cls
echo Your name is Rosanna. You are a slave, but the Jarl of the North's End has
echo offered you a chance to gain freedom, in exchange you make an interesting and
echo gruesome display in the Arena of the White Bear. Go on, it is your chance,
echo and nothing is going to wrench this away from you.

pause >nul

cls

goto main

:main
if %exp% GEQ %expmax% goto levelup
if %money% LSS 0 set money=0
if %wep% == 1 set wepdis=Whip   
if %wep% == 2 set wepdis=Axe
if %wep% == 3 set wepdis=Greatsword
if %wep% == 4 set wepdis=Bow
if %wep% == 5 set wepdis=Flintlock Pistol
if %wep% == 6 set wepdis=Hunter's Rifle
if %wep% == 1 set str=13
if %wep% == 2 set str=16
if %wep% == 3 set str=19
if %wep% == 4 set str=21
if %wep% == 5 set str=25
if %wep% == 6 set str=30
if %arm% == 1 set armdis=Leather
if %arm% == 2 set armdis=Iron
if %arm% == 3 set armdis=Titanium
if %arm% == 4 set armdis=Werewolf Silver
if %arm% == 5 set armdis=Cursed Armor
if %arm% == 1 set def=1
if %arm% == 2 set def=2
if %arm% == 3 set def=3
if %arm% == 4 set def=4
if %arm% == 5 set def=12
if %arm% == 5 set health=1
if %spl% == 1 set spldis=Fireball
if %spl% == 2 set spldis=Thunder Bolt
if %spl% == 1 set spl=5
if %spl% == 2 set spl=10
cls
echo AWB
echo -----------------------------------------------
echo Rosanna  Level:%level%   Money:$%money%
echo Hp:%health%/100  Xp:%exp%/%expmax%
echo Weapon:%wepdis% Armour:%armdis% Spell:%spldis%
echo -----------------------------------------------
echo 1) Fight
echo 2) Shop
echo 3) Drink Potion
echo 4) Save
echo 5) Exit
echo.
set /p input=Enter:

if %input% == 1 goto fight1
if %input% == 2 goto shop
if %input% == 3 goto DP
if %input% == 4 goto save
if %input% == 5 goto exit
goto main

:DP
cls
echo AWB
echo -----------------------------------------------
echo Rosanna  Level:%level%   Money:$%money%
echo Hp:%health%/100  Xp:%exp%/%expmax%
echo Weapon:%wepdis% Armour:%armdis% Spell:%spldis%
echo -----------------------------------------------
echo 1)Drink Potion
echo 2)Back
echo.
set /p input=Enter:

if %input% == 1 set /a hpots=%hpots%-1
if %input% == 1 set /a health=%health%+35
if %input% == 1 goto DP
if %input% == 2 goto main
:load
if not exist Save.ini goto loaderror
< Save.ini (
set /p enehealth=
set /p level=
set /p health=
set /p money=
set /p exp=
set /p expmax=
set /p str=
set /p def=
set /p wep=
set /p wepdis=
set /p arm=
set /p armdis=
set /p hpots=
set /p spl=
set /p spldis=
)
goto main

:loaderror
cls
echo No save file found...
pause >nul
goto menu

:fight1
if %level% == 2 set enehealth=82
if %level% == 3 set enehealth=83
if %level% == 4 set enehealth=84
if %level% == 5 set enehealth=85
if %level% == 6 set enehealth=86
if %level% == 7 set enehealth=87
if %level% == 8 set enehealth=88
if %level% == 9 set enehealth=99
if %level% GTR 9 set enehealth=100

:fight
if %health% GTR 100 set health=100
if %health% LSS 1 goto lose
cls
echo FIGHT
echo -------------------------------------------------
echo Rosanna's Hp:%health%/100 Level:%level%
echo Weapon:%wepdis%  Armour:%armdis% Spell:%spldis%
echo -------------------------------------------------
echo Enemy
echo Hp:%enehealth%/100
echo.
echo 1) Attack
echo 2) Drink Potion
echo 3) Spell
echo 4) Flee
echo.
set /p input=Enter:

if %input% == 1 goto attack
if %input% == 2 goto potion
if %input% == 3 goto spell
if %input% == 4 goto flee
goto fight

:attack
set num=%random:~-2%
if %num% GTR %str% goto attack
if %num% LSS 0 goto attack
if %num% == 00 set num=0
if %num% == 01 set num=1
if %num% == 02 set num=2
if %num% == 03 set num=3
if %num% == 04 set num=4
if %num% == 05 set num=5
if %num% == 06 set num=6
if %num% == 07 set num=7
if %num% == 08 set num=0
if %num% == 09 set num=7
cls
echo You take %num% health from
echo the enemy.
pause >nul
set /a enehealth= %enehealth% - %num%
set /a exp= %exp% + %num% * 2
goto eneattack

:eneattack
if %enhealth% LSS 1 goto win
set num=%random:~-1%
if %num% GTR 7 goto enattack
if %num% LSS 0 goto enattack
set /a num= %num% - %def%
if %num% LSS 0 set num=0
cls
echo The enemy takes %num% health
echo from you.
pause >nul
set /a health= %health% - %num%
goto fight

:spell

set num=%spl%
if %num% GTR %str% goto attack
if %num% LSS 0 goto attack
if %num% == 00 set num=0
if %num% == 01 set num=1
if %num% == 02 set num=2
if %num% == 03 set num=3
if %num% == 04 set num=4
if %num% == 05 set num=5
if %num% == 06 set num=6
if %num% == 07 set num=7
if %num% == 08 set num=0
if %num% == 09 set num=7
cls
echo You cast a spell and steal %num% health from
echo the enemy.
echo.
pause >nul
set /a enehealth= %enehealth% - %num%
set /a exp= %exp% + %num% * 2
goto eneattack

:win
set num=%random:~-2%
if %num% GTR 35 goto win
if %num% LSS 15 goto win
cls
echo Congratulations, you killed
echo the enemy!
echo.
echo You found $%num%
pause >nul
set /a money= %money% + %num%
goto main

:lose
cls
color c
echo Oh no, you died!
echo.
echo You will have to start again! Your save file has been deleted!
del save
pause >nul
goto menu

:potion
cls
echo 1)Drink Potion
echo 2)Back
echo.
set /p input=Enter:

if %input% == 1 set /a hpots=%hpots%-1
if %input% == 1 set /a health=%health%+35
if %input% == 1 goto fight
if %input% == 2 goto fight

:nopots
cls
echo You have no potions left!
pause >nul
goto fight

:flee
cls
echo You run away!
echo.
echo -$30
pause >nul
set /a money= %money% - 30
goto main

:shop
cls
echo SHOP
echo --------------------------------------
echo Rosanna
echo Money:$%money% Level:%level%
echo --------------------------------------
echo [a)Weapons]b)Armor]c)Potions]d)Spells
echo.
echo WARNING: Cursed objects require sacrifices!
echo.
echo 1) Whip             $30     Lvl: 1
echo 2) Axe              $70     Lvl: 3
echo 3) Greatsword       $150    Lvl: 6
echo 4) Bow              $200    Lvl: 7
echo 5) Flintlock Pistol $250    Lvl: 7
echo 6) Hunter's Rifle   $300    Lvl: 8
echo 7) Back
echo.
set /p input=Enter:

if %input% == 7 goto main
if %input% == a goto shop
if %input% == b goto shop2
if %input% == c goto shop3
if %input% == d goto shop4
if %money% LSS 30 goto nofunds
if %input% == 1 set /a money= %money% - 30
if %input% == 1 set wep=1
if %input% == 1 goto shop
if %level% LSS 3 goto nolev
if %money% LSS 70 goto nofunds
if %input% == 2 set /a money= %money% - 70
if %input% == 2 set wep=2
if %input% == 2 goto main
if %level% LSS 6 goto nolev
if %money% LSS 150 goto nofunds
if %input% == 3 set /a money= %money% - 150
if %input% == 3 set wep=3
if %input% == 3 goto shop
if %input% == 4 set /a money= %money% - 200
if %input% == 4 set wep=4
if %input% == 4 goto shop
if %level% LSS 7 goto nolev
if %money% LSS 200 goto nofunds
if %input% == 5 set /a money= %money% - 250
if %input% == 5 set wep=5
if %input% == 5 goto shop
if %level% LSS 7 goto nolev
if %money% LSS 250 goto nofunds
if %input% == 6 set /a money= %money% - 300
if %input% == 6 set wep=6
if %input% == 6 goto shop
if %level% LSS 8 goto nolev
if %money% LSS 300 goto nofunds
goto shop

:shop2
cls
echo SHOP
echo --------------------------------------
echo Rosanna
echo Money:$%money% Level:%level%
echo --------------------------------------
echo [a)Weapons]b)Armor]c)Potions]d)Spells
echo.
echo WARNING: Cursed objects require sacrifices!
echo.
echo 1) Leather          $50     Lvl: 1
echo 2) Iron             $90     Lvl: 3
echo 3) Titanium         $200    Lvl: 6
echo 4) Werewolf Silver  $275    Lvl: 8
echo 5) Cursed Armor     $350    Lvl: 1
echo 6) Back
echo.
set /p input=Enter:

if %input% == 6 goto main
if %input% == a goto shop
if %input% == b goto shop2
if %input% == c goto shop3
if %input% == d goto shop4
if %money% LSS 50 goto nofunds
if %input% == 1 set /a money= %money% - 50
if %input% == 1 set arm=1
if %input% == 1 goto shop2
if %level% LSS 3 goto nolev
if %money% LSS 90 goto nofunds
if %input% == 2 set /a money= %money% - 90
if %input% == 2 set arm=2
if %input% == 2 goto shop2
if %level% LSS 6 goto nolev
if %money% LSS 200 goto nofunds
if %input% == 3 set /a money= %money% - 200
if %input% == 3 set arm=3
if %input% == 3 goto shop2
if %input% == 4 set /a money= %money% - 275
if %input% == 4 set arm=4
if %input% == 4 goto shop2
if %level% LSS 8 goto nolev
if %money% LSS 275 goto nofunds
if %input% == 5 set /a money= %money% - 350
if %input% == 5 set arm=5
if %input% == 5 goto shop2
if %level% LSS 1 goto nolev
if %money% LSS 350 goto nofunds
goto shop2

:shop3
cls
echo SHOP
echo --------------------------------------
echo Rosanna
echo Money:$%money% Level:%level%
echo --------------------------------------
echo [a)Weapons[b)Armour[c)Potions]d)Spells
echo.
echo 1) Health Potion    $30
echo 2) Level Potion     $1000
echo 3) Back
echo.
echo.
set /p input=Enter:

if %input% == 3 goto main
if %input% == a goto shop
if %input% == b goto shop2
if %input% == c goto shop3
if %input% == d goto shop4
if %money% LSS 30 goto nofunds
if %input% == 1 set /a money= %money% - 30
if %input% == 1 set hpots= %hpots% + 1
if %input% == 1 goto shop3
if %money% LSS 1000 goto nofunds
if %input% == 2 set /a money= %money% - 1000
if %input% == 2 goto shop3
goto shop3

:shop4
cls
echo SHOP
echo --------------------------------------
echo Rosanna
echo Money:$%money% Level:%level%
echo --------------------------------------
echo [a)Weapons[b)Armour[c)Potions]d)Spells
echo.
echo 1) Fireball     $50     Lvl: 1
echo 2) Thunder Bolt $150    Lvl: 2
echo 3) Back
echo.
echo.
set /p input=Enter:
if %input% == 3 goto main
if %input% == a goto shop
if %input% == b goto shop2
if %input% == c goto shop3
if %input% == d goto shop4
if %money% LSS 50 goto nofunds
if %input% == 1 set /a money= %money% - 50
if %input% == 1 set spl=5
if %input% == 1 set spldis=Fireball
if %input% == 1 goto shop4
if %level% LSS 1 goto nolev
if %money% LSS 150 goto nofunds
if %input% == 2 set /a money= %money% - 150
if %input% == 2 set spl=10
if %input% == 2 set spldis=Thunder Bolt
if %input% == 2 goto shop4
if %level% LSS 2 goto nolev
goto shop4

:nofunds
cls
echo You don't have enough money
echo to purchase this item.
pause >nul
goto main

:nolev
cls
echo Your level isn't high enough
echo to purchase this item.
pause >nul
goto main

:save
(
echo %enehealth%
echo %level%
echo %health%
echo %money%
echo %exp%
echo %expmax%
echo %str%
echo %def%
echo %wep%
echo %wepdis%
echo %arm%
echo %armdis%
echo %hpots%
echo %spl%
echo %spldis%) >Save.ini
cls
echo Game Saved!
pause >nul
goto main

:exit
cls
echo All unsaved progress will be
echo lost, are you sure? (Y/N)
set /p input=

if %input% == y exit
if %input% == n goto main
if %input% == Y exit
if %input% == N goto main
goto exit
pause >nul
exit

:levelup
set /a level= %level% + 1
set exp=0
set /a expmax= %expmax% * 150 / 100
cls
echo Congratulations!
echo.
echo You are now level %level%!
echo.
pause >nul
goto main

Locked