Page 1 of 1

RPG game

Posted: 04 Nov 2012 08:27
by marshall123
Kinda works Kinda not!!!!
///////////////////////////


@echo off
title RPG
:main
cls
echo Welcome to the game...
echo (C) CopyRight Marshall Ward
echo.
echo 1.start
echo 2.exit
set /p $=enter:

if %$% equ 1 goto start
if %$% equ 2 exit
goto main

:start
cls
setlocal enabledelayedexpansion
set /p name =Enter you name:
if exist QE%name%sav.dll set load=1
goto new

:new
set hp=100
set exp=0
set exptill=60
set gold=50
set lvl=1
set power=4
set powergain=3
set weappower=2
set weapprice=120
set pots=1
set armor=0
goto home

:load
for /f %%a in (QE%name%SAV.dll) do set %%a
set /a temp2=(%hp% * %lvl% + %exp% * %exptill% + %weapprice% + %power% * %weappower%)/(%gold% + %pots% * %powergain%)
if not %temp1% equ %temp2% set temp3=1
goto home

:death
cls
echo You Died!
echo You Lost some stuff...
set /a exp=%exp% - (%exp% * 65/100)
set hp=1
pause >nul
goto home

:runaway
cls
echo You successfully ran away!
set hp=1
pause >nul
goto home

:levelup
cls
echo Congrats! LEVEL UP!
pause >nul
set /a lvl=%lvl% + 1
set /a exp=%exp - %exptill%
set /a exptill=%exptill% + %exptill% * 66 / 100
set /a power=%power% + %powergain%
set /a powergain=%powergain% + 1
set hp =100
goto save

::# HOME ##############################################

:home
set en1hp=40
set en2hp=80
set en3hp=160
if %exp% geq %exptill% goto levelup
cls
if "%temp3%" equ "1" echo you are a cheater...
echo level %lvl%/ experience %exp%/%exptill% armor %armor%
echo health %hp%/100 gold %gold% potions %potions%
echo.
echo Where do you want to go?
echo.
echo 1.Outside the village
echo 2.shop
echo 3.healer
echo 4.save game
echo 5.exit
echo.
set input=5
set /p input=Enter:
if %input% equ 1 goto out
if %input% equ 2 goto shop
if %input% equ 3 goto healer
if %input% equ 4 goto save
if %input% equ 5 goto exit
goto home

:: # Enemy1 ############################################

:out
set en1hp=40
cls
echo You were attacked by a goblin!
pause >nul
goto fightgoblin

:fightgoblin
cls
echo You have %hp% health
echo Goblin has %en1hp%
echo.
echo 1.Attack
echo 2.Drink potion
echo 3. RUN AWAY!
set input=5
set /p input= Enter:
if %input% equ 1 goto attackgoblin
if %input% equ 2 goto drinkpotgoblin
if %input% equ 3 goto runaway

:attackgoblin
cls
set /a en1hp=%en1hp% - (%power% + %weappower%)
if %en1hp% leq 0 goto killedgoblin
set /a hp-%hp% - (7 - %armor%)
if %hp% leq 0 goto death
goto fightgoblin

:drinkpotgoblin
if %pots% 1ss 1 (
echo You don't have any potions
pause >nul
goto fightgoblin
)
set /a hp = %hp% + 50
set /a pots=%pots% - 1
goto fightgoblin

:killedgoblin
cls
echo YOU KILLED HIM!
echo You gained 7 exp and 6 gold
set /a exp=%exp% + 7
set gold=%gold% + 6
pause >nul
goto out2


:: # enemy 2 ########################################
:out2
cls
echo 1.Go further
echo 2.wait Here
echo 3.go home
set input=5
set /p input=Enter:
if %input% equ 1 goto out3
if %input% equ 2 goto out2
if %input% equ 3 goto home
goto out2

:out3
set en2hp=80
cls
echo You have %hp% health
echo skeleton has %en2hp%
echo.
echo 1.attack
echo 2.Drink potion
echo 3. Run Away
set input=5
set /p input=Enter:
if %input% equ 1 goto attackskeleton
if %input% equ 2 goto drinkpotskeleton
if %input% equ 3 goto runaway
goto fightskeleton

:attackskeleton
cls
set /a en2hp=%en2hp% - (%power% + %weappower%)
if %en1hp% leq 0 goto killedskeleton
set /a hp-%hp% - (7 - %armor%)
if %hp% leq 0 goto death
goto fightskeleton

:fightskeleton
cls
echo You have %hp% health
echo skeleton has %en2hp%
echo.
echo 1.Attack
echo 2.Drink potion
echo 3. RUN AWAY!
set input=5
set /p input= Enter:
if %input% equ 1 goto attackskeleton
if %input% equ 2 goto drinkpotskeleton
if %input% equ 3 goto runaway




:: # save ############################################

:save
if "%temp3%" equ"1"(
cls
echo You're a cheater, YOU NO SAVE!
pause >nul
goto stats
)
echo saving...
set /a temp2=(%hp% * %lvl% + %exp% * %exptill% + %weapprice% + %power% * %weappower%)/(%gold% + %pots% * %powergain%)
(echo hp=%hp%)> QE%name%SAV.dll
(echo exp=%exp%)>> QE%name%SAV.dll
(echo exptill=%exptill%)>> QE%name%SAV.dll
(echo gold=%gold%)>> QE%name%SAV.dll
(echo lvl=%lvl%)>> QE%name%SAV.dll
(echo power=%power%)>> QE%name%SAV.dll
(echo powergain=%powergain%)>> QE%name%SAV.dll
(echo weappower=%weappower%)>> QE%name%SAV.dll
(echo weapprice=%weapprice%)>> QE%name%SAV.dll
(echo pots=%pots%)>> QE%name%SAV.dll
(echo armor=%armor%)>>QE%name%SAV.dll
(echo temp1=%temp1%)>>E%name%SAV.dll

:stats
cls
echo %name% %lvl%
echo %exp%/%exptill% expierience
echo.
echo %hp%/100 health
echo %gold% gold
echo %pots% potions
echo.
echo Your power is %power%
echo Your weapon power is %weappower%
echo.
echo PRESS ANY KEY
pause >nul
goto home

Re: RPG game

Posted: 04 Nov 2012 08:32
by foxidrive
I had a quick glance.

This line
if "%temp3%" equ"1"(
needs a space
if "%temp3%" equ"1" (