Wooh, that took several hours to write, any how I hope this helps.
I may not have answered everything, if so just contact me again on here or smileitsjimmy@aol.com (im not always avaliable tho...). Also if you have specific questions you cant ask or find on the forums, feel free to email me.
do
sync rate 0
cls
set cursor 100,100
PRINT "Please press Space Key to start"
if spacekey()
Goto BS
endif
loop
BS:
SYNC ON
SYNC RATE 0
sync
HP#=100
EHP#=100
`load music "Final Fantasy 7 - Main Theme (Fully Orchestrated).mp3",7
`play music 7
DO
cls
`Print the Enemies health
PRINT "ENEMY HP ",EHP#
SET CURSOR 400,0
`Print your health
PRINT "YOUR HP ",HP#
Rem calculate speed
`See *3
SPEED#=speedquality#
speedquality#=level#/2
`reset move$
MOVE$=""
If playerwaittime=<timer()
INPUT "A TO ATTACK OR H TO HEAL ", MOVE$
Playerwaittime=timer()+RND(1500)
Endif
Rem character level handeler
`See *2
level#=6
expn#=400
exp#=0
if expn#=exp#
level#=level#+1
expn#=level#*expn#
Endif
rem monster level
mlevel#= 5
rem experiance gained
expgained#=mlevel#*32
Rem physcial damage and protection
Damage#= strenght#*attack#
Protection#= vitality*Defense/3
Rem Magical Damage and protection
MDamage#=mattack*spelldamage#
MProtection#= Mdefense#*spirit#
Rem Elemental halve, immune, absorb
rem fire: halve
If Hfire#=1
Enemymfattack#=Enemymfattack#/2
endif
rem fire null
If Nfire#=1
Enemymfattack#=Enemymfattack#-(Enemymfattack#)
Endif
rem fire absorb
If Afire#=1
Enemymfattack#=Enemymfattack#-(Enemymfattack#*2)
Endif
rem lightning: halve
If Hlightning#=1
Enemymlattack#=Enemymlattack#/2
endif
rem lightning: null
If Nlightning#=1
Enemymlattack#=Enemymlattack#-(Enemymlattack#)
Endif
rem lightning: absorb
If Alightning#=1
Enemymlattack#=Enemymlattack#-(Enemymlattack#*2)
Endif
rem ice: halve
If Hice#=1
Enemymlattack#=Enemymlattack#/2
endif
rem ice: null
If Nice#=1
Enemymlattack#=Enemymlattack#-(Enemymlattack#)
Endif
rem lightning: absorb
If Aice#=1
Enemymlattack#=Enemymlattack#-(Enemymlattack#*2)
Endif
Rem choice of moves
IF upper$(MOVE$)="A"
EHP#=EHP#-50
ENDIF
IF upper$(MOVE$)="H"
HP#=HP#+1000
ENDIF
Rem Fire attack strenght(fire1,2,3) for enemy
if EMove#=<timer()
HP#=HP#-Enemymfattack#
EMove#=timer()+Rnd(1500)
endif
Enemymfattack#= Rnd(30)+90*Emattack/4
If FIRE2#=1
Enemymfattack#=Enemymfattack#*2
endif
If FIRE3#=1
Enemymfattack#=Enemymfattack#*3
endif
Rem lightning attack strenght(bolt 1,2,3) for enemy
Enemymiattack#= Rnd(30)+120*Emattack/4
If Bolt2#=1
Enemymiattack#=Enemymiattack#*2
endif
If Bolt3#=1
Enemymiattack#=Enemymiattack#*3
endif
Rem If monster is dead
IF EHP#<1
GOTO WIN
ENDIF
If HP#<1
Goto LOOSE
Endif
rem Ninja (first enemy)
Rem attack
rem Ninja (first enemy)
Rem attack
if Ninjawaittime#=<timer()
EMove#=EMove#+rnd(1)+1
print "Enemy strikes"
endif
Ninjawaittime#=timer()+41
SYNC
LOOP
WIN:
` Clear the screen before informing user they defeated the monster
CLS
` Print the winning message, alternativally replace this code with a gosub return value (see *1)
PRINT "Congratulations you have defeated the monster!"
` Phyisically update the screen to show the message
Sync
` Wait for a key to be pressed before ending
WAIT KEY
END
LOOSE:
` Clear the screen before informing user they defeated the monster
CLS
` Print the loosing message, alternativally replace this code with a gosub return value (see *1)
PRINT "Arrrg, you have been defeated =("
` Phyisically update the screen to show the message
Sync
` Wait for a key to be pressed before ending
WAIT KEY
END
remstart
The reason it does not seem like you ever attack is due to the input being CASE sensitive, meaning the following
are not the same - a : A
The way to overcome this is by checking if Upper$(MOVE$)="A", what this will do is change every character in the
MOVE$ string to uppercase, so in essence a = A, b = B, C = C, 1 = 1.
That way, it is irrleavant if the user has the caps lock on.
Also as explaing previously, I modified the timer() section as this caused the player to NEVER attack after the
first loop.
For the enemy however, I have no problem with him attacking, but the amount will always been random due to the line
Enemymiattack#= Rnd(30)+120*Emattack/4
and the likes place all over the loop...
I have changed the EMOVE command slighty to introduce a timer() which acts the same as the player timer, this creates
a timer.
A random timer of up to 1.5seconds has also being introduced by adding +RND(1500) on the end of the timer value. I felt
this was better than allowing the enemy to attack every loop.
HOWEVER, you should change this to the speed variable's. I have not yet experimented with them
* - the star!
*1
If you were to place a subroutine lable (affectivly the same as a goto command) at the top of your main battle,
rather than the BS: then after the print and sync command in the WIN and LOOSE goto, add the command RETURN will
allow you to create a function which you can call when ever you want to access the battle system, then return to
the exact same place you called it.
gosub BS
...
...
BS:
...
...
Return
Where the [...] is code.
*2
level#=6
expn#=400
exp#=0
As the above code is not inside any conditional commands such as IF, WHILE or FOR it gets called EVERY loop, resulting
in level# ALWAYS equalling 6, expn# = 400 and exp# = 0, even after being changed later on, expn# WILL NEVER = exp# -
or in math
400 DOES NOT EQUAL 0
*3
SPEED#=speedquality#
speedquality#=level#/2
In the VERY first loop, as speequality# has not been designated a number, it automatically equals 0, so SPEED# also
equals 0, once SPEED#=speedquality has been read, ONLY THEN will it update speedquality# to level#/2 but wont take
affect until the next time you set the SPEED# value, in this case the next loop.
remend
The reason it does not seem like you ever attack is due to the input being CASE sensitive, meaning the following
are not the same - a : A
The way to overcome this is by checking if Upper$(MOVE$)="A", what this will do is change every character in the
MOVE$ string to uppercase, so in essence a = A, b = B, C = C, 1 = 1.
That way, it is irrleavant if the user has the caps lock on.
Also as explaing previously, I modified the timer() section as this caused the player to NEVER attack after the
first loop.
For the enemy however, I have no problem with him attacking, but the amount will always been random due to the line
Enemymiattack#= Rnd(30)+120*Emattack/4
and the likes place all over the loop...
I have changed the EMOVE command slighty to introduce a timer() which acts the same as the player timer, this creates
a timer.
A random timer of up to 1.5seconds has also being introduced by adding +RND(1500) on the end of the timer value. I felt
this was better than allowing the enemy to attack every loop.
HOWEVER, you should change this to the speed variable's. I have not yet experimented with them
Note - HAHA, I didnt see your second source code and used your old one, dont worry tho, Ill do a revised post tonight or tommorow
Hello!