Here is a completely unexplained, unoptomized, 100% hardcoded RPG Battle Engine (the camera swing gosub still doesnt work right...) I think I have a few things remmed out because of testing the camera, but you should be able to learn a little bit from the source. Oh well here goes (Im working a full blown RPG Tutorial. This code will be explained and optomized + 100% working
)
Rem Project: RPGTut_BattleSys
Rem Created: 3/17/2004 3:42:50 PM
Rem ***** Main Source File *****
`battle system
`john h
`variables
#Include "function_itemSort.txt"
#Include "function_itemCount.txt"
#Include "function_itemAdd.txt"
#Include "function_itemPrint.txt"
#Include "function_itemDelete.txt"
#Include "function_itemClass.txt"
#Include "function_itemSelected.txt"
Type MainCharStats
Name as String
Class as String
HP as Integer
MaxHP as Integer
Spd as Integer
MP as Integer
MaxMP as Integer
Wisdom as Integer
Vigor as Integer
Str as Integer
Spd as Integer
Level as Integer
`No need for max level, as it will be 99
Experience as Integer
LvlUpMultiply as Integer
Weapon as String
Shield as String
Armor as String
Helmet as String
Relic as String
Endtype
`battle pow = 11
`vig2 = 76
`attack = 87
Dim MainCharStats(1) as MainCharStats
MainCharStats(1).Name = "Tutty"
MainCharStats(1).Class = "Fighter"
MainCharStats(1).HP = 50
MainCharStats(1).MaxHP = 50
MainCharStats(1).Spd = 12
MainCharStats(1).MP = 12
MainCharStats(1).MaxMP = 12
MainCharStats(1).Wisdom = 5
MainCharStats(1).Vigor = 23
MainCharStats(1).Str = 9
MainCharStats(1).Level = 1
MainCharStats(1).Experience = 5
MainCharStats(1).Weapon = "Stick"
MainCharStats(1).Shield = "Empty"
MainCharStats(1).Armor = "Cloth"
MainCharStats(1).Helmet = "Empty"
MainCharStats(1).Relic = "Empty"
Type CharacterClass
ClassName as String
TotalMaxHP as Integer
TotalMaxMP as Integer
TotalMaxSpd as Integer
TotalMaxStr as Integer
DevelopeRate as Integer
Weakness as String
EndType
Dim CharacterClass(2) as CharacterClass
CharacterClass(1).Classname = "Fighter"
CharacterClass(1).TotalMaxHp = 9999
CharacterClass(1).TotalMaxMP = 600
CharacterClass(1).TotalMaxSpd = 255
CharacterClass(1).TotalMaxStr = 255
CharacterClass(1).DevelopeRate = 1.25
CharacterClass(1).Weakness = ""
CharacterClass(2).Classname = "Rodent"
CharacterClass(2).TotalMaxHp = 0
CharacterClass(2).TotalMaxMP = 0
CharacterClass(2).TotalMaxSpd = 0
CharacterClass(2).TotalMaxStr = 0
CharacterClass(2).DevelopeRate = 0
CharacterClass(2).Weakness = "Fire"
Type Monster
Name as String
Classname as String
AreaIn as String
Lvl as Integer
HP as Integer
MaxHP as Integer
MP as Integer
MaxMP as Integer
Str as Integer
Spd as Integer
Wisdom as Integer
SpellOne as String
SpellTwo as String
SpellThree as String
CommonItem as String
RareItem as String
UltraItem as String
ExpGained as Integer
GoldGained as Integer
Accuracy as Integer
Criticle as Integer
Spell1Tendancy as Integer
Spell2Tendancy as Integer
DropRegularTendancy as Integer
DropRareTendancy as Integer
DropUltraTendancy as Integer
Weakness as String
Endtype
Dim Monster(1) as Monster
Monster(1).Name = "Bone Crusher"
Monster(1).ClassName = "Mutant"
Monster(1).AreaIn = "Tutorial Island Battle Arena"
Monster(1).Lvl = 4
Monster(1).HP = 150
Monster(1).MaxHP = 150
Monster(1).MP = 30
Monster(1).MaxMP = 30
Monster(1).Str = 20
Monster(1).Spd = 10
Monster(1).Wisdom = 4
Monster(1).SpellOne = "Slash"
Monster(1).SpellTwo = "Double Slash"
Monster(1).SpellThree = ""
Monster(1).CommonItem = "Potion"
Monster(1).RareItem = "Super Potion"
Monster(1).UltraItem = "Blade"
Monster(1).ExpGained = 5
Monster(1).GoldGained = 15
Monster(1).Accuracy = 85
Monster(1).Criticle = 8
Monster(1).Spell1Tendancy = 2 :` Out of 10 attacks this is how many they will use 1 magic
Monster(1).Spell2Tendancy = 1 :` Out of 20 attacks this is how many they will use 2 magic
Monster(1).DropRegularTendancy = 7 : `Out of 10 times this is how many the common item will drop
Monster(1).DropRareTendancy = 1 :`out of 20 times this is how many the rare item will drop
Monster(1).DropUltraTendancy = 1 : `Out of 30 Times this is how many the ultra rare item will drop
Monster(1).Weakness = "Fire"
Type Spells
SpellType as String
Element as String
Name as String
MPReg as Integer
Damage as Integer
MPUse as Integer
Endtype
Dim Spells(6) as Spells
Spells(1).Spelltype = "Physical"
Spells(1).Element = "Physical"
Spells(1).Name = "Slash"
Spells(1).MpReg = 10
Spells(1).Damage = 5
Spells(1).Mpuse = 10
Spells(2).Spelltype = "Physical"
Spells(2).Element = "Physical"
Spells(2).Name = "Double Slash"
Spells(2).MpReg = 10
Spells(2).Damage = 6
Spells(2).Mpuse = 10
Spells(3).Spelltype = "Elemental"
Spells(3).Element = "Fire"
Spells(3).Name = "Fire"
Spells(3).MpReg = 10
Spells(3).Damage = 3
Spells(3).Mpuse = 2
Spells(4).Spelltype = "Elemental"
Spells(4).Element = "Ice"
Spells(4).Name = "Ice"
Spells(4).MpReg = 10
Spells(4).Damage = 3
Spells(4).Mpuse = 2
Spells(5).Spelltype = "Elemental"
Spells(5).Element = "Lightning"
Spells(5).Name = "Lightning"
Spells(5).MpReg = 10
Spells(5).Damage = 3
Spells(5).Mpuse = 2
Spells(6).Spelltype = "Physical"
Spells(6).Element = "Physical"
Spells(6).Name = "Rage of Blades"
Spells(6).MpReg = 5
Spells(6).Damage = 6
Spells(6).Mpuse = 5
Type Inventory
SlotHolding as String
Gold as Integer
Endtype
Type Item
Name as String
Class as Integer
HPGain as Integer
MPGain as Integer
Cost as Integer
Resell as Integer
Endtype
Remstart
Classes Explanation
Class1 = Item
Class2 = Weapon
Class3 = Shield
Class4 = Armor
Remend
Global MaxItems = 14 `Item Amount carrying
Global ItemVarSize = 50 `Array Size for items
Global DifferentItems = 6
Global YPos = 50
Global XPos = 150
Global DifferentItemArraySize = 50
Global NumberOfItems = 5
Global NavigationVar = 0
Global WaitVar = 50
Global ReturnWaitVar = 50
Global MaxItemsOnScreen = 5
Global AvailableItemCount
Global ItemWaitVar = 8
Global MonstersDmg$ = ""
Global PlayersDmg$ = ""
Global MissSring$ = ""
Global CriticleHit$ = ""
Global ItemGain$ = ""
Global ItemGainDisplay = 10
Global NumberOFSprites = 38
Global SprRed#
Global SprGreen#
Global SprBlue#
Global SpriteWaitVar = 5
Global Dim AvailableItems$(DifferentItems)
Dim Inventory(ItemVarSize) as Inventory
Inventory(0).SlotHolding = "Stick"
Inventory(1).SlotHolding = "Cloth"
Inventory(2).SlotHolding = "Potion"
Inventory(3).SlotHolding = "Cloth"
Inventory(4).SlotHolding = "Potion"
Inventory(5).SlotHolding = "Stick"
Inventory(6).SlotHolding = "Potion"
Inventory(7).SlotHolding = "Potion"
Inventory(8).SlotHolding = "Super Potion"
Inventory(9).SlotHolding = "Ether"
Inventory(10).SlotHolding = "Super Potion"
Inventory(11).SlotHolding = "Stick"
Inventory(12).SlotHolding = "Potion"
Inventory(13).SlotHolding = "Leather Armor"
Global Dim Item(NumberOfItems) as Item
Item(0).Name = "Potion"
Item(0).Class = 1
Item(0).HPGain = 25
Item(0).MPGain = 0
Item(0).Cost = 20
Item(0).Resell = 10
Item(1).Name = "Super Potion"
Item(1).Class = 1
Item(1).HPGain = 100
Item(1).MPGain = 0
Item(1).Cost = 75
Item(1).Resell = 40
Item(2).Name = "Ether"
Item(2).Class = 1
Item(2).HPGain = 0
Item(2).MPGain = 20
Item(2).Cost = 150
Item(2).Resell = 70
Item(3).Name = "Stick"
Item(3)Class = 2
Item(3).HPGain = 0
Item(3).MPGain = 0
Item(3).Cost = 10
Item(3).Resell = 5
Item(4).Name = "Cloth"
Item(4).Class = 4
Item(4).HPGain = 0
Item(4).MPGain = 0
Item(4).Cost = 20
Item(4).Resell = 10
Item(5).Name = "Leather Armor"
Item(5).Class = 4
Item(5).HPGain = 0
Item(5).MPGain = 0
Item(5).Cost = 50
Item(5).Resell = 20
Dim DifferentItems$(DifferentItemArraySize)
DifferentItems$(0) = "Potion"
DifferentItems$(1) = "Super Potion"
DifferentItems$(2) = "Ether"
DifferentItems$(3) = "Stick"
DifferentItems$(4) = "Cloth"
DifferentItems$(5) = "Leather Armor"
DifferentItems$(6) = ""
Global Dim ItemTypeAmount(DifferentItemArraySize)
Item_Sort()
Item_Count()
Type Equipment
Class as String
Name as String
UsedBy as String
AtkChng as Integer
DefChng as Integer
SpdChng as Integer
StrChng as Integer
HPChng as Integer
MPChng as Integer
Price as Integer
Resell as Integer
Criticle as Integer
Accuracy as Integer
Endtype
Dim Equipment(8) as Equipment
`The Empty 'Item'
Equipment(1).Class = ""
Equipment(1).Name = "Empty"
Equipment(1).UsedBy = "All"
Equipment(1).AtkChng = 0
Equipment(1).DefChng = 0
Equipment(1).SpdChng = 0
Equipment(1).StrChng = 0
Equipment(1).HPChng = 0
Equipment(1).MPChng = 0
Equipment(1).Price = 0
Equipment(1).Criticle = 0
Equipment(1).Accuracy = 0
`The Stick Sword
Equipment(2).Class = "Sword"
Equipment(2).Name = "Stick"
Equipment(2).UsedBy = "All"
Equipment(2).AtkChng = 2
Equipment(2).DefChng = 0
Equipment(2).SpdChng = 0
Equipment(2).StrChng = 0
Equipment(2).HPChng = 0
Equipment(2).MPChng = 0
Equipment(2).Price = 10
Equipment(2).Resell = 5
Equipment(2).Criticle = 10
Equipment(2).Accuracy = 85
`The Stick Sword
Equipment(3).Class = "Sword"
Equipment(3).Name = "Blade"
Equipment(3).UsedBy = "Warrior"
Equipment(3).AtkChng = 3
Equipment(3).DefChng = 0
Equipment(3).SpdChng = 0
Equipment(3).StrChng = 0
Equipment(3).HPChng = 100
Equipment(3).MPChng = 40
Equipment(3).Criticle = 15
Equipment(3).Accuracy = 95
`The Plank Shiled
Equipment(4).Class = "Shield"
Equipment(4).Name = "Plank"
Equipment(4).UsedBy = "Warrior"
Equipment(4).AtkChng = 0
Equipment(4).DefChng = 1
Equipment(4).SpdChng = 0
Equipment(4).StrChng = 0
Equipment(4).HPChng = 0
Equipment(4).MPChng = 0
Equipment(4).Price = 80
Equipment(4).Resell = 35
Equipment(4).Criticle = 0
Equipment(4).Accuracy = 0
`The Cloth Armor
Equipment(5).Class = "Armor"
Equipment(5).Name = "Cloth"
Equipment(5).UsedBy = "All"
Equipment(5).AtkChng = 0
Equipment(5).DefChng = 2
Equipment(5).SpdChng = 0
Equipment(5).StrChng = 0
Equipment(5).HPChng = 0
Equipment(5).MPChng = 0
Equipment(5).Price = 20
Equipment(5).Resell = 10
Equipment(5).Criticle = 0
Equipment(5).Accuracy = 0
`The Leather Mail
Equipment(6).Class = "Armor"
Equipment(6).Name = "Leather Mail"
Equipment(6).UsedBy = "Warrior"
Equipment(6).AtkChng = 0
Equipment(6).DefChng = 4
Equipment(6).SpdChng = 0
Equipment(6).StrChng = 0
Equipment(6).HPChng = 0
Equipment(6).MPChng = 0
Equipment(6).Price = 120
Equipment(6).Resell = 50
Equipment(6).Criticle = 0
Equipment(6).Accuracy = 0
`The Cap
Equipment(7).Class = "Helmet"
Equipment(7).Name = "Cap"
Equipment(7).UsedBy = "All"
Equipment(7).AtkChng = 0
Equipment(7).DefChng = 1
Equipment(7).SpdChng = 0
Equipment(7).StrChng = 0
Equipment(7).HPChng = 0
Equipment(7).MPChng = 0
Equipment(7).Price = 40
Equipment(7).Resell = 20
Equipment(7).Criticle = 0
Equipment(7).Accuracy = 0
`The Power Band
Equipment(8).Class = "Relic"
Equipment(8).Name = "Power Band"
Equipment(8).UsedBy = "All"
Equipment(8).AtkChng = 0
Equipment(8).DefChng = 0
Equipment(8).SpdChng = 0
Equipment(8).StrChng = 2
Equipment(8).HPChng = 5
Equipment(8).MPChng = 0
Equipment(8).Price = 200
Equipment(8).Resell = 90
Equipment(8).Criticle = 0
Equipment(8).Accuracy = 0
Type SpriteSheet
Value as Integer
Name as String
EndType
Dim SpriteSheetValues(38) as SpriteSheet
SpriteSheetValues(1).Value = 6
SpriteSheetValues(1).Name = " "
SpriteSheetValues(2).Value = 17
SpriteSheetValues(2).Name = "+"
SpriteSheetValues(3).Value = 20
SpriteSheetValues(3).Name = "."
SpriteSheetValues(4).Value = 21
SpriteSheetValues(4).Name = "/"
SpriteSheetValues(5).Value = 22
SpriteSheetValues(5).Name = "0"
SpriteSheetValues(6).Value = 23
SpriteSheetValues(6).Name = "1"
SpriteSheetValues(7).Value = 24
SpriteSheetValues(7).Name = "2"
SpriteSheetValues(8).Value = 25
SpriteSheetValues(8).Name = "3"
SpriteSheetValues(9).Value = 26
SpriteSheetValues(9).Name = "4"
SpriteSheetValues(10).Value = 27
SpriteSheetValues(10).Name = "5"
SpriteSheetValues(11).Value = 28
SpriteSheetValues(11).Name = "6"
SpriteSheetValues(12).Value = 29
SpriteSheetValues(12).Name = "7"
SpriteSheetValues(13).Value = 30
SpriteSheetValues(13).Name = "8"
SpriteSheetValues(14).Value = 31
SpriteSheetValues(14).Name = "9"
SpriteSheetValues(15).Value = 46
SpriteSheetValues(15).Name = "H"
SpriteSheetValues(16).Value = 51
SpriteSheetValues(16).Name = "M"
SpriteSheetValues(17).Value = 54
SpriteSheetValues(17).Name = "P"
SpriteSheetValues(18).Value = 57
SpriteSheetValues(18).Name = "S"
SpriteSheetValues(19).Value = 60
SpriteSheetValues(19).Name = "V"
SpriteSheetValues(20).Value = 71
SpriteSheetValues(20).Name = "a"
SpriteSheetValues(21).Value = 73
SpriteSheetValues(21).Name = "c"
SpriteSheetValues(22).Value = 79
SpriteSheetValues(22).Name = "i"
SpriteSheetValues(23).Value = 82
SpriteSheetValues(23).Name = "l"
SpriteSheetValues(24).Value = 84
SpriteSheetValues(24).Name = "n"
SpriteSheetValues(25).Value = 85
SpriteSheetValues(25).Name = "o"
SpriteSheetValues(26).Value = 88
SpriteSheetValues(26).Name = "r"
SpriteSheetValues(27).Value = 90
SpriteSheetValues(27).Name = "t"
SpriteSheetValues(28).Value = 95
SpriteSheetValues(28).Name = "y"
SpriteSheetValues(29).Value = 7
SpriteSheetValues(29).Name = "!"
SpriteSheetValues(30).Value = 41
SpriteSheetValues(30).Name = "C"
SpriteSheetValues(31).Value = 43
SpriteSheetValues(31).Name = "E"
SpriteSheetValues(32).Value = 47
SpriteSheetValues(32).Name = "I"
SpriteSheetValues(33).Value = 50
SpriteSheetValues(33).Name = "L"
SpriteSheetValues(34).Value = 56
SpriteSheetValues(34).Name = "R"
SpriteSheetValues(35).Value = 58
SpriteSheetValues(35).Name = "T"
SpriteSheetValues(36).Value = 74
SpriteSheetValues(36).Name = "d"
SpriteSheetValues(37).Value = 75
SpriteSheetValues(37).Name = "e"
SpriteSheetValues(38).Value = 89
SpriteSheetValues(38).Name = "s"
global selnum
global waitvar
global battle_waitvar
global playertimer
global monstertimer
global game#
global animation_timer#
Global M1SpriteX = 20
Global M2SpriteY = 469
battle_waitvar=5
waitvar=5
selnum=1
move_timer=3
game#=0
Animation_Timer#=40
`system settings
backdrop on
Set Normalization On
color backdrop rgb(0,0,0)
sync on : sync rate 60
Randomize Timer()
Set Camera Range 10,30000
remstart
Make Object Sphere 7,10000
Position Object 7,0,0,3000
Load Image "skytexutre.bmp",400
Texture Object 7,400
Yrotate Object 7,90
Set Object Cull 7,0
remend
Load Object "ArenaGround.x",7
Scale Object 7,1300,1300,1300
Position Object 7,0,-5,0
Load Image "ArenaGroundTextureTest1.bmp",402
Texture Object 7,402
Load Object "BattleArena.x",8
Scale Object 8,600,600,600
Load Image "BattleUV3.bmp",401
Texture Object 8,401
Position Object 8,0,-1.8,0
Set Object Cull 8,0
Set Object Light 8,1
Load Image "PillarTexture5.bmp",403
For LoadPillars = 9 to 11
Load Object "Pillar.x",LoadPillars
Set Object Light LoadPillars,1
Set Object Fog LoadPillars,1
Set Object Diffuse LoadPillars,RGB(20,20,20)
Set Shadow Shading On LoadPillars
Texture Object LoadPillars,403
Scale Object LoadPillars,250,250,250
next LoadPillars
Position Object 9,-23,-5,40
Position Object 10,35,-5,16
Position Object 11,-25,-5,0
`set up good guy (viking)
Load Object "Viking.X",1
Set Object Speed 1,10000
Yrotate Object 1,90
XRotate Object 1,270
Scale Object 1,5,5,5
Set Object Light 1,0
`set up the BAD guy (mutant)
Load Object "H-Alien Mutant-Attack1.x",2
Load Object "H-Alien Mutant-Die.x",3
Load Object "H-Alien Mutant-Idle.x",4
Load object "H-Alien Mutant-Impact.x",5
Load Object "H-Alien Mutant-Move.x",6
For MonsterObjects = 2 to 6
Set Object Speed MonsterObjects,50
YRotate Object MonsterObjects,90
Scale Object MonsterObjects,200,200,200
hide object MonsterObjects
position object MonsterObjects,5,0.1,0
set object smoothing MonsterObjects,1
set object light MonsterObjects,0
Next MonsterObjects
position object 1,-5,0,0
show object 4
loop object 4
position camera 0,10,-10
point camera 0,0,0
`Battle Menu Image
Load Image "battle_menu.bmp",2,1
Paste Image 2,0,448
`Sprite 2,0,448,2
`Set Sprite 2,0,0
Load Image "energybar.bmp",3,1
Sprite 3,656,499,3
Set Sprite 3,0,1
Scale Sprite 3,0
Load Image "item_menu.bmp",4,1
Paste Image 4,0,4480
Load Image "characterset2.bmp",5,1
TileImage("characterset2.bmp",16,16,6,2)
Load Image "hu_choose.bmp",263,1
Load Image "hu_doubleslash.bmp",264,1
Load Image "hu_fire.bmp",265,1
Load Image "hu_ice.bmp",266,1
Load Image "hu_lightning.bmp",267,1
Load Image "hu_slash.bmp",268,1
Load Image "hu_rob.bmp",269,1
Load Image "hu_victory.bmp",270,1
Load Image "hu_slain.bmp",271,1
Load Image "hu_wait.bmp",272,1
Load Image "hu_attack.bmp",273,1
Load IMage "hu_monster.bmp",274,1
Load IMage "hu_criticle.bmp",275,1
Load IMage "hu_miss.bmp",276,1
For SpritePositions = 263 to 276
Sprite SpritePositions,0,0,SpritePositions
Set Sprite SpritePositions,0,0
Paste Sprite SpritePositions,Screen Width()/2 - Sprite Width(263)/2,0
Hide Sprite SpritePositions
Next SpritePositions
Load Image "Hand.bmp",1,1
`Sprite 1,15,495+(CursorPlace*13),1
Sprite 1,20,469,1
Set Sprite 1,0,1
Load Sound "Select.wav",1
monstnum=1
Load Music "battle.mid",1
Load Music "defeat.mid",2
Load Music "victory.mid",3
Load Sound "Hit wall.wav",2
Load Sound "swordecho.wav",3
Set Sound Speed 3,30000
TileImage("lightning_effect.bmp",5,1,277,3)
For X = 277 to 281
Scale Sprite X,230
Set Sprite X,0,1
Paste Sprite X,290,-30
Hide Sprite X
Next X
TileImage("fire_effect.bmp",3,1,282,4)
For X = 282 to 284
Set Sprite X,0,1
Paste Sprite X,500,200
Next X
TileImage("ice_effect4.bmp",4,1,285,5)
For X = 285 to 288
Set Sprite X,0,1
Paste Sprite X,500,200
Next X
SpriteFrame = 285
Repeated = 0
Position Camera 0,9,-27
Point Camera 0,0,25
b# = 50
c# = -10
`Position Camera 0,30,-27
`Point Camera 0,0,0
`Loop Music 1
load sound "fire.wav",4
load sound "lightning.wav",5
load sound "ice.wav",6
set sound speed 5,20000
Set Sound Speed 6,20000
`Fog Effects
Fog ON
Fog Color RGB(0,0,0)
Fog Distance 80
Position Light 0,0,10,0
Color Light 0,RGB(252,255,213)
Point Light 0,0,0,0
Set Spot Light 0,0,60
gosub _begin_swing
start:
do
Set Cursor 0,0
Print "Camera X: ";Camera Position X()
Print "Camera Y: ";Camera Position Y()
Print "Camera Z: ";Camera Position Z()
Print " "
Print "Camera Angle X: ";Camera Angle X()
Print "Camera Angle Y: ";Camera Angle Y()
Print "Camera Angle Z: ";Camera Angle Z()
If DisableAll < 1
CX#=Camera Angle X(): CY#=Camera Angle Y(): CZ#=Camera Angle Z()
CX#=Wrapvalue(CX#-mousemovey()): CY#=Wrapvalue(CY#+mousemovex())
Rotate Camera CX#,CY#,CZ#
Rem Use left mouse button to move forwards
If MouseClick()=1 then Move Camera 1
Rem Use right mouse button to move backwards
If MouseClick()=2 then Move Camera -1
Loop Object 1,0,12800
ply_x#=object position x(1)
ply_y#=object position y(1)
ply_z#=object position z(1)
mon_x#=object position x(2)
mon_y#=object position y(2)
mon_z#=object position z(2)
Paste Image 2,0,448
Display_Sprite_Text(513,495,str$(MainCharStats(1).HP)+" / "+str$(MainCharStats(1).MaxHP),SprRed#,SprGreen#,SprBlue#)
`Show Sprite 8
dec SpriteWaitVar,1
dec battle_waitvar,1
dec waitvar,1
remstart
`increase player timer
if battle_waitvar<1
Inc MonsterTimer,(Monster(MonstNum).Spd)/5
Inc PlayerTimer,(MainCharStats(1).Spd)/5
Battle_WaitVar=5
Endif
remend
if battle_waitvar<1
Inc PlayerTimer,(MainCharStats(1).Spd)/5
Battle_Waitvar = 5
endif
`the timer control
If PlayerTimer>100
PlayerTimer=100
EnableAttack=1
Endif
If EnableAttack = 0 then Hide Sprite 263 : Show Sprite 272
If EnableAttack = 1 then Hide Sprite 272 : Show Sprite 263
`Make sure player aint dead
If MainCharStats(1).HP < 1
MainCharStats(1).HP = 0
YourDEAD=1
Endif
`Make sure monster isnt dead
If Monster(1).HP < 1
Monster(1).HP = 0
MonsterDEAD=1
Endif
remstart
If game#=0
If MonsterTimer>100
game#=1
FirstTrip=1
SecondTrip=0
hide object 4
show object 2
CastSpell = 0
`Magic
If Monster(1).MP > 9
MonstCast1 = Rnd(10)
MonstCast2 = Rnd(20)
If MonstCast1 < Monster(1).Spell1Tendancy+1 and MonstCast1 > 0 then CastSpell1 = 1
If MonstCast2 < Monster(1).Spell2Tendancy+1 and MonstCast2 > 0 then CastSpell2 = 1 : CastSpell1 = 0
If CastSpell1 = 1 then gosub _CastSpell1
If CastSpell2 = 1 then gosub _CastSpell2
Endif
If CastSpell = 0
gosub _monster_attack
Endif
Endif
Endif
remend
`Draw Waitsprite
STRETCH SPRITE 3, PlayerTimer, 100
`Position Cursor
Paste Sprite 1,M1SpriteX,M2SpriteY
`Display Health in color o_O
If MainCharStats(1).HP > MainCharStats(1).MaxHP / 2 or MainCharStats(1).HP = MainCharStats(1).MaxHP / 2
SprRed# = 230
SprGreen# = 230
SprBlue# = 230
Endif
If MainCharStats(1).HP < MainCharStats(1).MaxHP / 2 or MainCharStats(1).HP = MainCharStats(1).MaxHP / 2
SprRed# = 255
SprGreen# = 255
SprBlue# = 0
Endif
If MainCharStats(1).HP < MainCharStats(1).MaxHP / 3 or MainCharStats(1).HP = MainCharStats(1).MaxHP / 3
SprRed# = 255
SprGreen# = 0
SprBlue# = 0
Endif
`menu navigation
remstart
if waitvar<1
If Upkey()=1
Dec SelNum,1
Play Sound 1
Waitvar=8
Endif
If Downkey()=1
Inc Selnum,1
Play Sound 1
Waitvar=8
Endif
Endif
remend
If Selnum>4 then Selnum=1
If Selnum<1 then Selnum=4
If Selnum=1 then attack=1 : else attack=0
If Selnum=2 then magic=1 : else magic=0
If Selnum=3 then special=1 : else special=0
If Selnum=4 then item=1 : else item=0
If attack=1
M2SpriteY = 469
If Game#=0
If EnableAttack=1
if returnkey()=1
game#=1
FirstTrip=1
SecondTrip=0
monstersdmg$ = ""
gosub _cam_swing
gosub _plyatk
Endif
Endif
Endif
endif
If magic=1
M2SpriteY = 499
If Game#=0
If EnableAttack=1
if returnkey()=1
game#=1
Hide Sprite 3
Show Sprite 1
Paste Image 2,0,4480
Paste Image 4,0,448
SpellMenuTimer = 12
gosub _magicmenu
Endif
Endif
Endif
endif
If special=1
M2SpriteY = 529
If Game#=0
If EnableAttack=1
if returnkey()=1
game#=1
Hide Sprite 3
Show Sprite 1
Paste Image 2,0,4480
Paste Image 4,0,448
gosub _SpecialAttack
Endif
Endif
Endif
endif
If item=1
M2SpriteY = 559
If Game#=0
If EnableAttack=1
if returnkey()=1
game#=1
ItemUsed = 0
ItemWaitVar = 8
Show Sprite 1
Hide Sprite 3
Paste Image 2,0,4480
Paste Image 4,0,448
gosub _displayitems
Endif
Endif
Endif
endif
Position Object 1,ply_x#,ply_y#,ply_z#
Position Object 2,mon_x#,mon_y#,mon_z#
Endif
If MonsterDEAD=1
Stop Music 1
Loop Music 3
hide object 4
show object 3
play object 3
hide all sprites
Show Sprite 270
DisableAll = 1
if scancode()> 0 and DisableAll = 1
end
endif
Endif
If YourDEAD=1
Stop Music 1
Loop Music 2
hide all sprites
Show Sprite 271
If PlayedDead = 0
Play Object 1,55000,64000 : PlayedDead = 1
Endif
DisableAll = 1
if scancode()> 0 and DisableAll = 1
end
endif
Endif
sync
loop
_plyatk:
Set Object Speed 1,35000
hide sprite 272
show sprite 273
do
Paste Image 2,0,448
If MainCharStats(1).HP > MainCharStats(1).MaxHP / 2
SprRed# = 230
SprGreen# = 230
SprBlue# = 230
Endif
If MainCharStats(1).HP < MainCharStats(1).MaxHP / 2
SprRed# = 255
SprGreen# = 255
SprBlue# = 0
Endif
If MainCharStats(1).HP < MainCharStats(1).MaxHP / 3
SprRed# = 255
SprGreen# = 0
SprBlue# = 0
Endif
Display_Sprite_Text(513,495,str$(MainCharStats(1).HP)+" / "+str$(MainCharStats(1).MaxHP),SprRed#,SprGreen#,SprBlue#)
Display_Sprite_Text(Screen Width() - Screen Width()/4-20-(Sprite Width(7)*Len(MonstersDmg$)/2),Screen Height()/3-Sprite Height(7)/2,MonstersDmg$,255,255,255)
dec move_timer,1
If FirstTrip=1
If DoneLooping = 0
Loop Object 1,93000,101500
Endif
if move_timer<0
if ply_x#<3
inc ply_x#,1 : move_timer=3
endif
endif
Endif
If Ply_X#>0 then TimeToAttack=1
If TimeToAttack=1
If Animation_Timer#>-30
If AttackedMonster=0
`Do Criticle and Miss Calculations
Randomize Timer()
CritHit = Rnd(100)
Acc = Rnd(100)
Vigor2 = MainCharStats(1).Vigor*2
BattlePower = MainCharStats(1).Str + Equipment(2).AtkChng
Attack = BattlePower + Vigor2
DmgVary = Rnd2(224,255)
If CritHit > -1 and CritHit < Equipment(2).Criticle then DoCriticleHit = 1
If Acc > -1 and Acc < Equipment(2).Accuracy then SuccessAttack = 1
`Make sure its not both a criticle hit and a miss!
If SuccessAttack = 0 then DoCriticleHit = 0
If SuccessAttack = 1
If DoCriticleHit = 0
Damage# = RndUp((BattlePower + ((((MainCharStats(1).Level * MainCharStats(1).Level) * Attack) / 256))) * 3) / 2
Damage# = RndUp(((Damage# * DmgVary) / 256) + 1) : AttackDone = 1
Dec Monster(monstnum).HP,Damage#
AttackedMonster=1
endif
If DoCriticleHit = 1
Damage# = RndUp((BattlePower + ((((MainCharStats(1).Level * MainCharStats(1).Level) * Attack) / 256))) * 3) / 2
Damage# = RndUp(((Damage# * DmgVary) / 256) + 1)
Damage# = RndUp(Damage# * 2) : AttackDone = 1
Dec Monster(monstnum).HP,Damage#
AttackedMonster=1
Endif
else
Damage# = 0 : AttackDone = 1
AttackedMonster = 1
Endif
Endif
if Object Frame(1) > 29000
If DoCriticleHit = 1 and Flashed = 0 then Hide Sprite 273 : Show Sprite 275 : CLS RGB(255,255,255) : Flashed = 1
If SuccessAttack = 0 then Hide Sprite 273 : Show Sprite 276
MonstersDmg$ = str$(Damage#)
endif
If BeenPlayed=0
DoneLooping = 1
Set Object Speed 1,10000
Stop Object 1
Play Object 1,25000,32000
BeenPlayed=1
Endif
If Object Frame(1) > 26500 and PlayedSlash = 0 and SuccessAttack = 1
If PlayedMonster = 0
Play Object 5 : PlayedMonster = 1
Endif
Play Sound 3 : PlayedSlash = 1
Hide Object 4
Show Object 5
Endif
Endif
If Animation_Timer#>-30
Dec Animation_Timer#,1
Endif
If Animation_Timer#<-29
FirstTrip=0
SecondTrip=1
DoneLoopingReturn = 0
Set Object Speed 1,35000
Hide Object 5
Show Object 4
Loop Object 4
Endif
Endif
If SecondTrip=1
If RotatedOb = 0
YRotate Object 1,270 : RotatedOb = 1
endif
If DoneLoopingReturn = 0
Loop Object 1,93000,101500
Endif
RotatedOb = 1
FirstTrip=0
if move_timer<0
if ply_x#>-5
dec ply_x#,1 : move_timer=3
endif
endif
Endif
position object 1,ply_x#,ply_y#,ply_z#
If SecondTrip=1 and ply_x#=-5
RotatedOb = 0
Yrotate Object 1,90
DoneLoopingReturn = 1
Set Object Speed 1,10000
FirstTrip=0
SecondTrip=0
DoneLooping = 0
PlayedMonster = 0
TimeToAttack=0
Animation_Timer#=40
PlayerTimer=0
EnableAttack=0
Game#=0
BeenPlayed=0
AttackedMonster=0
MonstersDmg$ = ""
CriticleHit$ = ""
MissString$ = ""
DoCriticleHit = 0
SuccessAttack = 0
PlayedSlash = 0
Hide Sprite 273
Hide Sprite 275
Hide Sprite 276
Show Sprite 272
return
Endif
sync
loop
MonstersDmg$ = ""
CriticleHit$ = ""
MissString$ = ""
return
_monster_attack:
Hide Object 4
Show Object 6
Hide Sprite 263
Hide Sprite 272
Show Sprite 274
do
Paste Image 2,0,448
If MainCharStats(1).HP > MainCharStats(1).MaxHP / 2
SprRed# = 230
SprGreen# = 230
SprBlue# = 230
Endif
If MainCharStats(1).HP < MainCharStats(1).MaxHP / 2
SprRed# = 255
SprGreen# = 255
SprBlue# = 0
Endif
If MainCharStats(1).HP < MainCharStats(1).MaxHP / 3
SprRed# = 255
SprGreen# = 0
SprBlue# = 0
Endif
Display_Sprite_Text(513,495,str$(MainCharStats(1).HP)+" / "+str$(MainCharStats(1).MaxHP),SprRed#,SprGreen#,SprBlue#)
Display_Sprite_Text(Screen Width()/4 - Sprite Width(7)*Len(PlayersDmg$)/2 ,Screen Height()/4 + Sprite Height(7),PlayersDmg$,255,255,255)
dec move_timer,1
If FirstTrip=1
If DoneMonsterLooping = 0
Loop Object 6
Endif
if move_timer<0
if mon_x#>-3
dec mon_x#,1 : move_timer=3
endif
endif
Endif
If Mon_X#<0 then TimeToAttack=1
If TimeToAttack=1
If Animation_Timer#>-30
If AttackedMonster=0
Randomize Timer()
MonstVig = rnd2(58,65)
MonstLvl2 = Monster(1).Lvl * Monster(1).Lvl
MonstPow = Monster(1).Str * 4
BattlePower = MonstPow + MonstVig
DmgVary = Rnd2(224,255)
CritHit = Rnd(100)
Acc = Rnd(100)
If CritHit > 0 and CritHit < Monster(1).Criticle then DoCriticleHit = 1
If Acc > 0 and Acc < Monster(1).Accuracy then SuccessAttack = 1
`Make sure its not both a criticle hit and a miss!
If SuccessAttack = 0 then DoCriticleHit = 0
If SuccessAttack = 1
If DoCriticleHit = 0
Dmg# = RndUp((MonstLvl2 * BattlePower) / 256)
Dmg# = RndUp((Dmg# * DmgVary)/256)+1
Dmg# = RndUp(((Dmg# * (255 - Equipment(5).DefChng)) / 256) + 1)
Dec MainCharStats(1).HP,Dmg# : AttackDone=1
AttackedMonster=1
Endif
If DoCriticleHit = 1
Dmg# = RndUp((MonstLvl2 * BattlePower) / 256)
Dmg# = RndUp((Dmg# * DmgVary)/256)+1
Dmg# = RndUp(((Dmg# * (255 - Equipment(5).DefChng)) / 256) + 1)
Dmg# = RndUp(Dmg#*2)
Dec MainCharStats(1).HP,Dmg# : AttackDone=1
AttackedMonster=1
Endif
else
Dmg# = 0 : AttackDone = 1
AttackedMonster = 1
Endif
Endif
Endif
If BeenPlayed=0
hide object 6 : show object 2
Set Object Frame 2,0
Play Object 2
Play Object 1,40000,48500
If SuccessAttack = 1
Play Sound 2
Endif
BeenPlayed=1
DoneMonsterLooping = 1
Endif
if Object Frame(2) > 10
If DoCriticleHit = 1 and Flashed = 0 then Hide Sprite 274 : Show Sprite 275 : CLS RGB(255,255,255) : Flashed = 1
If SuccessAttack = 0 then Hide Sprite 274 : Show Sprite 276
PlayersDmg$ = str$(Dmg#)
endif
If Animation_Timer#>-30
Dec Animation_Timer#,1
Endif
If Animation_Timer#<-29
FirstTrip=0
SecondTrip=1
DoneMonsterLoopingReturn = 0
hide object 2
show object 6
Endif
Endif
If SecondTrip=1
FirstTrip=0
If RotatedMonsterOb = 0
YRotate Object 6,270 : RotatedMonsterOb = 1
endif
If DoneMonsterLoopingReturn = 0
Loop Object 6
Endif
if move_timer<0
if mon_x#<5
inc mon_x#,1 : move_timer=3
endif
endif
Endif
position object 2,mon_x#,mon_y#,mon_z#
If SecondTrip=1 and mon_x#=5
RotatedMonsterOb = 0
Yrotate Object 6,90
DoneMonsterLoopingReturn = 1
DoneMonsterLooping = 0
FirstTrip=0
SecondTrip=0
TimeToAttack=0
Animation_Timer#=40
MonsterTimer=0
EnableAttack=0
Game#=0
BeenPlayed=0
AttackedMonster=0
PlayersDmg$ = ""
CriticleHit$ = ""
MissString$ = ""
DoCriticleHit = 0
SuccessAttack = 0
MonstVig = 0
Hide Sprite 274
Hide Sprite 275
Hide Sprite 276
If PlayerTimer = 100 then Show Sprite 263
If PlayerTimer < 100 then Show Sprite 272
hide object 6
show object 4
return
Endif
sync
loop
PlayersDmg$ = ""
CriticleHit$ = ""
MissString$ = ""
return
return
_displayitems:
Do
Set Cursor 0,0
Print CursorPlace
Print NavigationVar
If ItemUsed$ = "HP"
SprRed# = 0
SprGreen# = 255
SprBlue# = 0
Endif
If ItemUsed$ = "MP"
SprRed# = 113
SprGreen# = 31
SprBlue# = 224
Endif
Display_Sprite_Text(Screen Width()/4 - Sprite Width(7)*Len(ItemGain$)/2 ,Screen Height()/4 + Sprite Height(7),ItemGain$,SprRed#,SprGreen#,SprBlue#)
Paste Image 4,0,448
Dec ItemWaitVar,1
`Navigation
If ItemWaitVar < 1
If Upkey() = 1 then Dec CursorPlace,1 : ItemWaitVar = 5 : Play Sound 1
If Downkey() = 1 then Inc CursorPlace,1 : ItemWaitVar = 5 : Play Sound 1
Gosub wrap
If ReturnKey() = 1 then ItemWaitVar = 5 : Gosub ItemUse
Endif
Ink RGB(255,255,255),1
Item_Print(50,475,NavigationVar,NavigationVar+MaxItemsOnScreen)
Paste Sprite 1,15,470+(CursorPlace*13)
Item_Sort()
Item_Count()
If ItemUsed = 1
PlayerTimer=0
EnableAttack=0
Game#=0
ItemWaitVar = 5
WaitVar = 8
Paste Image 4,0,4480
Show Sprite 3
Paste Image 2,0,448
dec ItemGainDisplay,1
If ItemGainDisplay < 0
ItemGain$ = ""
ItemGainDisplay = 10
ItemUsed$ = ""
Item_Sort()
Item_Count()
Return
Endif
Endif
`going back
if keystate(14) = 1
game#=0
WaitVar = 8
Paste Image 4,0,4480
Show Sprite 3
Paste Image 2,0,448
return
endif
SYNC
Loop
Wrap:
If CursorPlace < 0 Then CursorPlace = MaxItemsOnScreen : Dec NavigationVar,1
If CursorPlace > MaxItemsOnScreen Or CursorPlace > AvailableItemCount-2 Then CursorPlace = 0 : Inc NavigationVar,1
If NavigationVar < 0 Then NavigationVar = DifferentItems-(MaxItemsOnScreen+1)
If NavigationVar > DifferentItems-(MaxItemsOnScreen+1) then NavigationVar = 0
Return
ItemUse:
do
`Actually Use the item
MainCharStats(1).HP = MainCharStats(1).HP + Item(CursorPlace).HPGain
If MainCharStats(1).HP > MainCharStats(1).MaxHP then MainCharStats(1).HP = MainCharStats(1).MaxHP
MainCharStats(1).MP = MainCharStats(1).MP + Item(CursorPlace).MPGain
If MainCharStats(1).MP > MainCharStats(1).MaxMP then MainCharStats(1).MP = MainCharStats(1).MaxMP
For X = 0 to NumberOfItems
If Item_Selected$(CursorPlace) = Item(X).Name and Item(X).HPGain > 0
ItemUsed$ = "HP"
ItemGain$ = "+"+Str$(Item(X).HPGain)+" HP"
Endif
If Item_Selected$(CursorPlace) = Item(X).Name and Item(X).MPGain > 0
ItemUsed$ = "MP"
ItemGain$ = "+"+Str$(Item(X).MPGain)+ " MP"
Endif
Next X
ItemSelect$ = Item_Selected$(CursorPlace)
If Item_Class(ItemSelect$) = 1 Then Item_Delete(CursorPlace) : WaitVar = TIMER()
Item_Sort()
Item_Count()
ItemUsed = 1
Gosub Wrap
Return
sync
loop
return
_CastSpell1:
Hide Sprite 263
Hide Sprite 272
Show Sprite 268
Hide Object 4
Show Object 6
do
Paste Image 2,0,448
If MainCharStats(1).HP > MainCharStats(1).MaxHP / 2
SprRed# = 230
SprGreen# = 230
SprBlue# = 230
Endif
If MainCharStats(1).HP < MainCharStats(1).MaxHP / 2
SprRed# = 255
SprGreen# = 255
SprBlue# = 0
Endif
If MainCharStats(1).HP < MainCharStats(1).MaxHP / 3
SprRed# = 255
SprGreen# = 0
SprBlue# = 0
Endif
Display_Sprite_Text(513,495,str$(MainCharStats(1).HP)+" / "+str$(MainCharStats(1).MaxHP),SprRed#,SprGreen#,SprBlue#)
Display_Sprite_Text(Screen Width()/4 - Sprite Width(7)*Len(PlayersDmg$)/2 ,Screen Height()/4 + Sprite Height(7),PlayersDmg$,255,255,255)
dec move_timer,1
If FirstTrip=1
If DoneMonsterLooping = 0
Loop Object 6
Endif
if move_timer<0
if mon_x#>-3
dec mon_x#,1 : move_timer=3
endif
endif
Endif
If Mon_X#<0 then TimeToAttack=1
If TimeToAttack=1
If Animation_Timer#>-30
If AttackedMonster=0
SpellAttack = Spells(1).Damage * 4
MagicPower = (Monster(1).Lvl * Monster(1).Wisdom) * Spells(1).Damage
SpellVary = Rnd2(224,255)
Dmg# = RndUp(SpellAttack + (MagicPower / 32))
Dmg# = RndUp(((Dmg# * SpellVary) / 256) + 1)
Dec MainCharStats(1).HP,Dmg# : AttackDone=1
Dec Monster(1).MP,10
If Monster(1).MP < 0 then Monster(1).MP = 0
AttackedMonster=1
Endif
Endif
Endif
If BeenPlayed=0
hide object 6 : show object 2
Set Object Frame 2,0
Set Object Speed 2,20
Play Object 2
Play Object 1,40000,48500
BeenPlayed=1
Endif
if Object Frame(2) > 10
PlayersDmg$ = str$(Dmg#)
endif
If Animation_Timer#>-30
Dec Animation_Timer#,1
Endif
If Animation_Timer#<-29
FirstTrip=0
SecondTrip=1
hide object 2
show object 6
Endif
If SecondTrip=1
FirstTrip=0
Stop Object 2
if move_timer<0
if mon_x#<5
loop object 6
inc mon_x#,1 : move_timer=3
endif
endif
Endif
position object 2,mon_x#,mon_y#,mon_z#
If SecondTrip=1 and mon_x#=5
FirstTrip=0
SecondTrip=0
TimeToAttack=0
Animation_Timer#=40
MonsterTimer=0
EnableAttack=0
Game#=0
BeenPlayed=0
AttackedMonster=0
PlayersDmg$ = ""
CriticleHit$ = ""
MissString$ = ""
DoCriticleHit = 0
SuccessAttack = 0
Hide Sprite 268
If PlayerTimer = 100 then Show Sprite 263
If PlayerTimer < 100 then Show Sprite 272
hide object 6
show object 4
Set Object Speed 2,50
Set Object Frame 2,0
CastSpell = 1
CastSpell1 = 0
return
Endif
sync
loop
PlayersDmg$ = ""
CriticleHit$ = ""
MissString$ = ""
return
_CastSpell2:
Hide Sprite 263
Hide Sprite 272
Show Sprite 264
Hide Object 4
Show Object 6
do
Paste Image 2,0,448
If MainCharStats(1).HP > MainCharStats(1).MaxHP / 2
SprRed# = 230
SprGreen# = 230
SprBlue# = 230
Endif
If MainCharStats(1).HP < MainCharStats(1).MaxHP / 2
SprRed# = 255
SprGreen# = 255
SprBlue# = 0
Endif
If MainCharStats(1).HP < MainCharStats(1).MaxHP / 3
SprRed# = 255
SprGreen# = 0
SprBlue# = 0
Endif
Display_Sprite_Text(513,495,str$(MainCharStats(1).HP)+" / "+str$(MainCharStats(1).MaxHP),SprRed#,SprGreen#,SprBlue#)
Display_Sprite_Text(Screen Width()/4 - Sprite Width(7)*Len(PlayersDmg$)/2 ,Screen Height()/4 + Sprite Height(7),PlayersDmg$,255,255,255)
dec move_timer,1
If FirstTrip=1
if move_timer<0
if mon_x#>-3
dec mon_x#,1 : move_timer=3
endif
endif
Endif
If Mon_X#<0 then TimeToAttack=1
If TimeToAttack=1
If Animation_Timer#>-30
If AttackedMonster=0
SpellAttack = Spells(2).Damage * 4
MagicPower = (Monster(1).Lvl * Monster(1).Wisdom) * Spells(2).Damage
SpellVary = Rnd2(224,255)
Dmg# = RndUp(SpellAttack + (MagicPower / 32))
Dmg# = RndUp(((Dmg# * SpellVary) / 256) + 1)
Dec MainCharStats(1).HP,Dmg# : AttackDone=1
Dec Monster(1).MP,10
If Monster(1).MP < 0 then Monster(1).MP = 0
AttackedMonster=1
Endif
Endif
Endif
If Mon_X# < 0
If BeenPlayedFirst=0
hide object 6 : show object 2
Set Object Frame 2,0
Set Object Speed 2,80
Play Object 2
DoneMonsterLooping = 0
BeenPlayedFirst=1
Endif
If BeenPlayedFirst = 1 and BeenPlayedSecond = 0
hide object 6 : show object 2
Set Object Frame 2,0
Set Object Speed 2,80
Loop Object 2
Play Object 1,40000,48500
BeenPlayedSecond = 1
Endif
Endif
if Object Frame(2) > 10
PlayersDmg$ = str$(Dmg#)
endif
If Animation_Timer#>-50
Dec Animation_Timer#,1
Endif
If Animation_Timer#<-49 and BeenPlayedSecond=1
FirstTrip=0
SecondTrip=1
DoneMonsterLoopingReturn = 0
hide object 2
show object 6
Endif
If SecondTrip=1
FirstTrip=0
If RotatedMonsterOb = 0
YRotate Object 6,270 : RotatedMonsterOb = 1
endif
If DoneMonsterLoopingReturn = 0
Loop Object 6
Endif
Stop Object 2
if move_timer<0
if mon_x#<5
loop object 6
inc mon_x#,1 : move_timer=3
endif
endif
Endif
position object 2,mon_x#,mon_y#,mon_z#
If SecondTrip=1 and mon_x#=5
RotatedMonsterOb = 0
Yrotate Object 6,90
DoneMonsterLoopingReturn = 1
DoneMonsterLooping = 0
FirstTrip=0
SecondTrip=0
TimeToAttack=0
Animation_Timer#=40
MonsterTimer=0
EnableAttack=0
Game#=0
BeenPlayedFirst=0
BeenPlayedSecond=0
BeenPlayed = 0
AttackedMonster=0
PlayersDmg$ = ""
CriticleHit$ = ""
MissString$ = ""
DoCriticleHit = 0
SuccessAttack = 0
Hide Sprite 264
If PlayerTimer = 100 then Show Sprite 263
If PlayerTimer < 100 then Show Sprite 272
hide object 6
show object 4
Set Object Speed 2,50
Set Object Frame 2,0
Stop Object 2
CastSpell = 1
CastSpell2 = 0
return
Endif
sync
loop
PlayersDmg$ = ""
CriticleHit$ = ""
MissString$ = ""
return
_SpecialAttack:
SpecialWaitVar = 5
SpecialCursor = 0
do
Dec SpecialWaitVar,1
`Navigation
If SpecialWaitVar < 1
If MainCharStats(1).MP > Spells(6).Mpuse
If ReturnKey() = 1 then SpecialWaitVar = 5 : Gosub RageOfBlades
Endif
Endif
Paste Image 4,0,448
If MainCharStats(1).MP > Spells(6).Mpuse then Ink RGB(255,255,255),1
If MainCharStats(1).MP < Spells(6).Mpuse then Ink RGB(128,128,128),1
Set cursor 50,475
Print "Rage of Blades"
Paste Sprite 1,15,470+(SpecialCursor*13)
If RoBExecuted = 1
PlayerTimer=0
EnableAttack=0
Game#=0
SpecialWaitVar = 5
WaitVar = 8
Dec MainCharStats(1).MP,Spells(6).Mpuse
Paste Image 4,0,4480
Show Sprite 3
Paste Image 2,0,448
RoBExecuted = 0
return
Endif
`going back
if keystate(14) = 1
game#=0
WaitVar = 8
Paste Image 4,0,4480
Show Sprite 3
Paste Image 2,0,448
return
endif
sync
loop
RageOfBlades:
FirstTrip=1
SecondTrip=0
monstersdmg$ = ""
Hide Sprite 263
Show Sprite 269
SEt Object Speed 1,35000
do
Display_Sprite_Text(Screen Width() - Screen Width()/4-20-(Sprite Width(7)*Len(MonstersDmg$)/2),Screen Height()/3-Sprite Height(7)/2,MonstersDmg$,255,255,255)
Paste Image 4,0,448
Set cursor 50,475
Print "Rage of Blades"
dec move_timer,1
If FirstTrip=1
If DoneLooping = 0
Loop Object 1,93000,101500
Endif
if move_timer<0
if ply_x#<3
inc ply_x#,1 : move_timer=3
endif
endif
Endif
If Ply_X#>0 then TimeToAttack=1
If TimeToAttack=1
If Animation_Timer#>-30
If AttackedMonster=0
SpellAttack = Spells(6).Damage * 4
MagicPower = (MainCharStats(1).Level * MainCharStats(1).Wisdom) * Spells(6).Damage
SpellVary = Rnd2(224,255)
Damage# = RndUp(SpellAttack + (MagicPower / 32))
Damage# = RndUp(((Damage# * SpellVary) / 256) + 1)
Dec Monster(monstnum).HP,Damage#
AttackedMonster=1
Endif
Endif
if Object Frame(1) > 29000
MonstersDmg$ = str$(Damage#)
endif
If BeenPlayed=0
Set Object Speed 1,35000
Loop Object 1,25000,32000
BeenPlayed=1
DoneLooping = 1
Endif
If Object Frame(1) > 26500 and PlayedSlash < 7
Set Sound Speed 3,30000
Loop Sound 3 : Inc PlayedSlash,1
Hide Object 4
Show Object 5
Play Object 5
Endif
Endif
If Animation_Timer#>-150
Dec Animation_Timer#,1
Endif
If Animation_Timer#<-149
FirstTrip=0
SecondTrip=1
DoneLoopingReturn = 0
Hide Object 5
Show Object 4
Loop Object 4
Endif
If SecondTrip=1
FirstTrip=0
Stop Object 1
If RotatedOb = 0
YRotate Object 1,270 : RotatedOb = 1
endif
If DoneLoopingReturn = 0
Loop Object 1,93000,101500
Endif
Stop Sound 3
if move_timer<0
if ply_x#>-5
dec ply_x#,1 : move_timer=3
endif
endif
Endif
position object 1,ply_x#,ply_y#,ply_z#
If SecondTrip=1 and ply_x#=-5
RotatedOb = 0
Yrotate Object 1,90
DoneLoopingReturn = 1
Set Object Speed 1,10000
DoneLooping = 0
FirstTrip=0
SecondTrip=0
TimeToAttack=0
Animation_Timer#=40
PlayerTimer=0
EnableAttack=0
Game#=0
BeenPlayed=0
AttackedMonster=0
MonstersDmg$ = ""
CriticleHit$ = ""
MissString$ = ""
DoCriticleHit = 0
SuccessAttack = 0
PlayedSlash = 0
Set Object Speed 1,10000
Stop Object 1
Hide Sprite 269
Show Sprite 272
RoBExecuted = 1
return
Endif
sync
loop
MonstersDmg$ = ""
CriticleHit$ = ""
MissString$ = ""
RoBExecuted = 1
return
_magicmenu:
SpellMenuTimer = 8
SpellCursor = 0
SpellsLearned = 3
do
Dec SpellMenuTimer,1
Paste Image 4,0,448
If SpellCursor < 0 then SpellCursor = 0
If SpellCursor > (SpellsLearned - 1) then SpellCursor = SpellsLearned - 1
Paste Sprite 1,15,470+(SpellCursor*13)
If SpellCursor = 0 then Fire_Selected = 1 else Fire_Selected = 0
If SpellCursor = 1 then Ice_Selected = 1 else Ice_Selected = 0
If SpellCursor = 2 then Lightning_Selected = 1 else Lightning_Selected = 0
If SpellMenuTimer < 1
If Fire_Selected = 1
If MainCharStats(1).MP > Spells(3).Mpuse
If ReturnKey() = 1 then SpellMenuTimer = 5 : Gosub _UseFireSpell
Endif
Endif
If Ice_Selected = 1
If MainCharStats(1).MP > Spells(4).Mpuse
If ReturnKey() = 1 then SpellMenuTimer = 5 : Gosub _UseIceSpell
Endif
Endif
If Lightning_Selected = 1
If MainCharStats(1).MP > Spells(5).Mpuse
If ReturnKey() = 1 then SpellMenuTimer = 5 : Gosub _UseLightningSpell
Endif
Endif
If Upkey() = 1 then Dec SpellCursor,1 : SpellMenuTimer = 5 : Play Sound 1
If Downkey() = 1 then Inc SpellCursor,1 : SpellMenuTimer = 5 : Play Sound 1
Endif
If MainCharStats(1).MP >= Spells(3).Mpuse then Ink RGB(255,255,255),1
If MainCharStats(1).MP < Spells(3).Mpuse then Ink RGB(128,128,128),1
Set cursor 50,475
Print "Fire"
Set cursor 50,488
Print "Ice"
Set cursor 50,501
Print "Lightning"
if SpellExecuted = 1
PlayerTimer=0
EnableAttack=0
Game#=0
SpellMenuTimer = 5
WaitVar = 8
Dec MainCharStats(1).MP,Spells(3).Mpuse
Paste Image 4,0,4480
Show Sprite 3
Paste Image 2,0,448
SpellExecuted = 0
return
Endif
`going back
if keystate(14) = 1
game#=0
WaitVar = 8
Paste Image 4,0,4480
Show Sprite 3
Paste Image 2,0,448
return
endif
sync
loop
return
Function TileImage(filename$,across,down,imagenumber,bitmap)
load bitmap filename$, bitmap
set current bitmap bitmap
ScaleX = bitmap width(bitmap) / across
ScaleY = bitmap height(bitmap) / down
for y = 0 to down-1
for x = 0 to across-1
get image imagenumber,x * ScaleX,y * ScaleY,x * ScaleX + ScaleX,y * ScaleY + ScaleY, 1
sprite imagenumber,0,0,imagenumber
set sprite imagenumber,0,1
hide sprite imagenumber
inc imagenumber
next x
next y
delete bitmap bitmap
set current bitmap 0
endfunction
Function Display_Sprite_Text(x,y,msg$,r,g,b)
length = len(msg$)
`spriteno = 300
for i = 1 to length
for sprcheck = 1 to NumberOFSprites
if mid$(msg$,i) = SpriteSheetValues(sprcheck).Name
Set Sprite Diffuse SpriteSheetValues(sprcheck).Value,r,g,b
Paste Sprite SpriteSheetValues(sprcheck).Value,x,y
Show Sprite SpriteSheetValues(sprcheck).Value
Inc X,Sprite Width(6)
Hide Sprite SpriteSheetValues(sprcheck).Value
Endif
NExt SprCheck
Next i
endfunction
function rnd2(IntA,IntB)
Randomize Timer()
Diff = IntB - IntA
Answer = (Rnd(Diff)) + IntA
endfunction Answer
function RndUp(IntA#)
Randomize Timer()
Answer = Int(IntA# + .5)
endfunction answer
_UseFireSpell:
hide sprite 263
show sprite 265
SpriteFrame = 282
do
dec SpriteWaitVar,1
set cursor 0,0
print object frame(1)
Display_Sprite_Text(Screen Width() - Screen Width()/4-20-(Sprite Width(7)*Len(MonstersDmg$)/2),Screen Height()/3-Sprite Height(7)/2,MonstersDmg$,255,255,255)
Paste Image 4,0,448
Set cursor 50,475
Print "Fire"
Set cursor 50,488
Print "Ice"
Set cursor 50,501
Print "Lightning"
If AttackedMonster=0
Randomize Timer()
SpellAttack = Spells(3).Damage * 4
MagicPower = (MainCharStats(1).Level * MainCharStats(1).Wisdom) * Spells(3).Damage
SpellVary = Rnd2(224,255)
Damage# = RndUp(SpellAttack + (MagicPower / 32))
Damage# = RndUp(((Damage# * SpellVary) / 256) + 1)
If Spells(3).Element = Monster(1).Weakness then Damage# = Damage# * 2
Dec Monster(monstnum).HP,Damage#
AttackedMonster=1
Endif
If BeenPlayed=0
Set Object Speed 1,3000
Play Object 1,25000,32000
BeenPlayed=1
Endif
If Animation_Timer#>-76
Dec Animation_Timer#,1
Endif
If Object Frame(1) > 27180
Stop Object 1
Set Object Frame 1,27180
PlaySpell = 1
Endif
If Repeated > 0 then MonstersDmg$ = Str$(Damage#)
If PlaySpell = 1
If PlayedSound = 0
Play Sound 4 : PlayedSound = 1
Endif
If Repeated < 3
If SpriteFrame = 284 then SpriteFrame = 282 : Inc Repeated,1
If SpriteWaitVar < 0
Hide Sprite SpriteFrame
Inc SpriteFrame,1
Show Sprite SpriteFrame
SpriteWaitVar = 5
Endif
Else
Hide Sprite 282
Hide Sprite 283
Hide Sprite 284
PlaySpell = 0
Endif
Endif
If BeenPlayed = 1 and Animation_Timer# <-75
stop sound 4
Weak = 0
PlayedSound = 0
FirstTrip=0
SecondTrip=0
TimeToAttack=0
Animation_Timer#=40
SpriteWaitVar = 0
Repeated = 0
PlayerTimer=0
EnableAttack=0
Game#=0
BeenPlayed=0
AttackedMonster=0
MonstersDmg$ = ""
CriticleHit$ = ""
MissString$ = ""
DoCriticleHit = 0
SuccessAttack = 0
PlayedSlash = 0
Set Object Speed 1,10000
Set Object Frame 1,0
Stop Object 1
Hide Sprite 278
Hide Sprite 269
hide sprite 265
Show Sprite 272
PlaySpell = 0
SpellExecuted = 1
return
Endif
sync
loop
Return
_UseIceSpell:
SpriteFrame = 285
show sprite 266
do
set cursor 0,0
print object frame(1)
dec SpriteWaitVar,1
Display_Sprite_Text(Screen Width() - Screen Width()/4-20-(Sprite Width(7)*Len(MonstersDmg$)/2),Screen Height()/3-Sprite Height(7)/2,MonstersDmg$,255,255,255)
Paste Image 4,0,448
Set cursor 50,475
Print "Fire"
Set cursor 50,488
Print "Ice"
Set cursor 50,501
Print "Lightning"
If AttackedMonster=0
Randomize Timer()
SpellAttack = Spells(4).Damage * 4
MagicPower = (MainCharStats(1).Level * MainCharStats(1).Wisdom) * Spells(4).Damage
SpellVary = Rnd2(224,255)
Damage# = RndUp(SpellAttack + (MagicPower / 32))
Damage# = RndUp(((Damage# * SpellVary) / 256) + 1)
If Spells(4).Element = Monster(1).Weakness then Damage# = Damage# * 2
Dec Monster(monstnum).HP,Damage#
AttackedMonster=1
Endif
If BeenPlayed=0
Set Object Speed 1,3000
Play Object 1,25000,32000
BeenPlayed=1
Endif
If Animation_Timer#>-60
Dec Animation_Timer#,1
Endif
If Object Frame(1) > 27180
Stop Object 1
Set Object Frame 1,27180
PlaySpell = 1
If SoundPlayed = 0
Play Sound 6 : SoundPlayed = 1
Endif
MonstersDmg$ = Str$(Damage#)
Endif
If PlaySpell = 1
If Done < 1
If SpriteFrame = 288 then Done = 1
If SpriteWaitVar < 0
Hide Sprite SpriteFrame
Inc SpriteFrame,1
Show Sprite SpriteFrame
SpriteWaitVar = 8
Endif
endif
Endif
If Done = 1
Hide Sprite 285
Hide Sprite 286
Hide Sprite 287
Hide Sprite 288
Endif
If BeenPlayed = 1 and Animation_Timer# <-58
stop sound 6
FirstTrip=0
SecondTrip=0
TimeToAttack=0
Animation_Timer#=40
PlayerTimer=0
EnableAttack=0
Game#=0
BeenPlayed=0
AttackedMonster=0
MonstersDmg$ = ""
CriticleHit$ = ""
MissString$ = ""
DoCriticleHit = 0
SuccessAttack = 0
PlayedSlash = 0
Set Object Speed 1,10000
Set Object Frame 1,0
Stop Object 1
Hide Sprite 278
Hide Sprite 266
Show Sprite 272
PlaySpell = 0
SpellExecuted = 1
return
Endif
sync
loop
Return
_UseLightningSpell:
hide sprite 263
show sprite 267
SpriteFrame = 277
do
dec SpriteWaitVar,1
set cursor 0,0
print object frame(1)
Display_Sprite_Text(Screen Width() - Screen Width()/4-20-(Sprite Width(7)*Len(MonstersDmg$)/2),Screen Height()/3-Sprite Height(7)/2-10,MonstersDmg$,255,255,255)
Paste Image 4,0,448
Set cursor 50,475
Print "Fire"
Set cursor 50,488
Print "Ice"
Set cursor 50,501
Print "Lightning"
If AttackedMonster=0
Randomize Timer()
SpellAttack = Spells(5).Damage * 4
MagicPower = (MainCharStats(1).Level * MainCharStats(1).Wisdom) * Spells(5).Damage
SpellVary = Rnd2(224,255)
Damage# = RndUp(SpellAttack + (MagicPower / 32))
Damage# = RndUp(((Damage# * SpellVary) / 256) + 1)
If Spells(5).Element = Monster(1).Weakness then Damage# = Damage# * 2
Dec Monster(monstnum).HP,Damage#
AttackedMonster=1
Endif
If BeenPlayed=0
Set Object Speed 1,3000
Play Object 1,25000,32000
BeenPlayed=1
Endif
If Animation_Timer#>-60
Dec Animation_Timer#,1
Endif
If Object Frame(1) > 27180
Stop Object 1
Set Object Frame 1,27180
PlaySpell = 1
If SoundPlayed = 0
Play Sound 5 : SoundPlayed = 1
Endif
MonstersDmg$ = Str$(Damage#)
Endif
If PlaySpell = 1
If Done < 1
If SpriteFrame = 281 then Done = 1
If SpriteWaitVar < 0
Hide Sprite SpriteFrame
Inc SpriteFrame,1
Show Sprite SpriteFrame
SpriteWaitVar = 3
Endif
endif
Endif
If Done = 1
Hide Sprite 277
Hide SPrite 278
Hide Sprite 279
HIde Sprite 280
Hide Sprite 281
Endif
If BeenPlayed = 1 and Animation_Timer# <-58
Stop Sound 5
PlayedSound = 0
FirstTrip=0
SecondTrip=0
TimeToAttack=0
Animation_Timer#=40
PlayerTimer=0
EnableAttack=0
Game#=0
BeenPlayed=0
AttackedMonster=0
MonstersDmg$ = ""
CriticleHit$ = ""
MissString$ = ""
DoCriticleHit = 0
SuccessAttack = 0
PlayedSlash = 0
Set Object Speed 1,10000
Set Object Frame 1,0
Stop Object 1
Hide Sprite 278
Hide Sprite 269
hide sprite 267
Show Sprite 272
PlaySpell = 0
SpellExecuted = 1
return
Endif
sync
loop
Return
_begin_swing:
do
sync
position camera 0, b#, -27
point camera 0,0,c#
b# = b# - 1
if b# <= 9 then b# = 9
c# = c# + 1
if c# >= 25 and b# <= 9 then gosub start
gosub start
loop
_cam_swing:
cpX# = 0
cpY# = 9
cpZ# = -27
PointX# = 0
PointY# = 0
PointZ# = 25
do
CameraSwingVar = 5
Set Cursor 0,0
Print cpX#
Print cpY#
Print cpZ#
Print caY#
`sync
position camera cpX#,cpY#,cpZ#
Point camera PointX#,PointY#,PointZ#
If AllDone <1
If cpXDone <1 then cpX# = cpX# - 1
if cpYDone <1 then cpY# = cpY# - 1
if cpZDone <1 then cpZ# = cpZ# + 1
if PointXDone <1 then PointX# = PointX# + 5
if PointZDOne <1 then PointY# = PointY# + 1
if PointYDone <1 then PointZ# = PointZ# - 1
if cpX# <= -5 then cpX# = -19 : cpXDone = 1
if cpY# <= 3.7 then cpY# = 3.7 : cpYDone = 1
if cpZ# >= 2.9 then cpZ# = 2.9 : cpZDone = 1
if PointX# >= 518.9 then PointX# = 518.9 : PointXDone = 1
if PointY# >= 3.7 then PointY# = 3.7 : PointYDone = 1
If PointZ# <= -2.9 then PointZ# = -2.9 : PointZDone = 1
endif
If AllDone = 1 then return
sync
loop
We need help! Email us! join@eternaldestinyonline.com