Solved How to fix batch battle system skill bug

March 12, 2015 at 12:01:56
Specs: Windows XP
So I've been recently working hard on a batch file text based rpg, faced several problems and solved them decently, so I got stuck with this problem:

I have got a combat skill that does a constant damage, and I want it to only be activated when enemy is equal or below 25% health, but I can't.

I tried to write it but it's not working. Like, totally ignoring the command, so I want to know what's wrong and how to fix it


echo Wolf Hp: %WolfHp%\30
echo %name% Hp: %hp%\100
echo 1)Attack Wolf
echo 2)Swift Cut
set /p input=)
if %input%==1 goto HitWolf
if %input%==2 goto CutWolf
goto Wolf
:: I skipped to the skill directly VVV

set num=%random:~-2%
if %num% gtr %dmg% goto CutWolf
if %num% lss 01 goto CutWolf
if %num%== 00 goto WolfMiss
if %num%== 01 goto WolfMiss
if %num%== 02 set num=%cut%
if %num%== 03 set num=%cut%
if %num%== 04 set num=%cut%
if %num%== 05 set num=%cut%
if %num%== 06 set num=%cut%
if %num%== 07 set num=%cut%
if %num%== 08 set num=%cut%
if %num%== 09 set num=%cut%
if %WolfHp% gtr %WolfHp%*25/100 goto Wolf
echo Swift Cut Success
echo You swiftly cut the wolf, damage dealt: %cut%
pause >nul
if %WolfHp% gtr %WolfHp%*25/100 goto Wolf
set /a WolfHp= %WolfHp%-%num%
goto WolfAttack

See More: How to fix batch battle system skill bug

Report •

March 12, 2015 at 22:38:47
✔ Best Answer
A structure like this may save some clutter and be easier to debug.

:: wolf.bat 2015-03-13 12:26:47.71
@echo off & setLocal enableDELAYedeXpansioN

set/a N=!random:~-2! & echo !N!
if !N! lss 33 call :lo
if !N! geq 33 if !N! leq 66 call :mid
if !N! gtr 66 call :hi

goto :eof

echo.!N! is lo & goto :eof

echo.!N! is mid & goto :eof

echo.!N! is hi & goto :eof
::====== script ends here =================


M2 Get custom script or take private lessons

Report •
Related Solutions

Ask Question