Help im making am RPG Test Batch game and...

Discussion forum for all Windows batch related topics.

Moderator: DosItHelp

Post Reply
Message
Author
Gr4yson0306
Posts: 1
Joined: 26 May 2018 07:34

Help im making am RPG Test Batch game and...

#1 Post by Gr4yson0306 » 26 May 2018 07:41

Help I'm making an RPG Test Batch game and need to be able to take health away from the set Vars here's the code:
P.S Im just trying to learn/relearn and idk what I need to do at :attack to remove health from %hp% based on %mdmg%


@echo off
title RPG Game
Echo.
color a


:tutorial
echo Hello Their Welcome to the tutorial of the Game!
echo.
echo My Name Is Grayson
echo.
echo whenever you find a monster you have a few choices
echo 1 You can Fight To the Death!
echo.
echo 2 You may sometimes have the choice to block against their attack
echo.
echo 3 You can run away if your little low on HP
echo Do you understand?
echo.
echo 1) Yes!
echo 2) exit
set /p c=C:/

if "!c!" == "1" goto tutorial2
if "!c!" == "2" exit

:tutorial2
cls
echo.
echo This Game is a Battling Simulation
echo.
echo when You find a monster you will probably fight
echo.
echo How it works is you always go first, after you move the monster moves
echo.
echo the math going on in the background is: Your Hp - Monster Dmg = outcome
echo.
echo You always have a max of 100 hp but you can upgrade you Attack damage by buying new weapons
echo.
echo you start with $50
goto startstats

:startstats
set hp=100
set dmg=10
goto monster1

:monster1
set mhp=15
set mdmg=3
goto fighttutorial

:fighttutorial
cls
echo Your HP:%hp%
echo Your Damage:%dmg%
echo ------------------
echo Monster HP:%mhp%
echo Monster DMG:%mdmg%
echo.
echo Hello This is a battle
echo.
echo I'm here to help you win your first fight!
echo.
echo You can see your HP and DMG up at the top
echo.
echo You can see the monster Hp and Dmg right under your Hp and Dmg
echo.
echo 1) Hit Monster For %dmg% Dmg
echo 2) Exit The Game
set /p c=C:/

if "!c!" == "1" goto attack
if "!c!" == "2" exit

:attack

penpen
Expert
Posts: 2009
Joined: 23 Jun 2013 06:15
Location: Germany

Re: Help im making am RPG Test Batch game and...

#2 Post by penpen » 26 May 2018 14:32

This might help you:

Code: Select all

set "hp=100"
set "mdmg=3"
set "hp"
set /a "hp-=mdmg"
set hp
penpen

Post Reply