In reply to: Okay... -- Xorlak 16:55:00 12-14-2004
hm.. Posted by: William 19:33:46 12-14-2004 |
I can have many commands at the same line since I'm using tk3.. =)
it works well, but the enemy (secound I think) don't move very often.. That wierd because I can't find anything wrong with it..
I added a for loop to it:
#Method EnemyTurn()
{
#For(slot!=0;slot!<2;slot!=slot!+1)
{
#If(eneHP[slot!]!>0)
{
#maybe!=0
#Random(4,Random!)
#If(Random!=1){#Branch(:PastEnemyWalkStillInSaMeMethod)}
#check()
#Method check()
{
#xplusone()
#If(enexx[slot!]!=x!){#If(eney[slot!]!=y!){#EnemyAttack()}}
#xminusone()
#If(enexx[slot!]!=x!){#If(eney[slot!]!=y!){#EnemyAttack()}}
#yplusone()
#If(eneyy[slot!]!=y!){#If(enex[slot!]!=x!){#EnemyAttack()}}
#yminusone()
#If(eneyy[slot!]!=y!){#If(enex[slot!]!=x!){#EnemyAttack()}}
}
#Method xplusone()
{
#enexx[slot!]!=enex[slot!]!
#enexx[slot!]!=enexx[slot!]!+33
}
#Method xminusone()
{
#enexx[slot!]!=enex[slot!]!
#enexx[slot!]!=enexx[slot!]!-33
}
#Method yplusone()
{
#eneyy[slot!]!=eney[slot!]!
#eneyy[slot!]!=eneyy[slot!]!+33
}
#Method yminusone()
{
#eneyy[slot!]!=eney[slot!]!
#eneyy[slot!]!=eneyy[slot!]!-33
}
#Method EnemyEqualStoneLocation()
{
#If(enedir[slot!]$="UP"){#If(enex[slot!]!=stonex1!){#If(eney[slot!]!=stoney1!){#eney[slot!]!=eney[slot!]!+33}}}
#If(enedir[slot!]$="DOWN"){#If(enex[slot!]!=stonex1!){#If(eney[slot!]!=stoney1!){#eney[slot!]!=eney[slot!]!-33}}}
#If(enedir[slot!]$="LEFT"){#If(enex[slot!]!=stonex1!){#If(eney[slot!]!=stoney1!){#enex[slot!]!=enex[slot!]!+33}}}
#If(enedir[slot!]$="RIGHT"){#If(enex[slot!]!=stonex1!){#If(eney[slot!]!=stoney1!){#enex[slot!]!=enex[slot!]!-33}}}
#If(enedir[slot!]$="UP"){#If(enex[slot!]!=stonex2!){#If(eney[slot!]!=stoney2!){#eney[slot!]!=eney[slot!]!+33}}}
#If(enedir[slot!]$="DOWN"){#If(enex[slot!]!=stonex2!){#If(eney[slot!]!=stoney2!){#eney[slot!]!=eney[slot!]!-33}}}
#If(enedir[slot!]$="LEFT"){#If(enex[slot!]!=stonex2!){#If(eney[slot!]!=stoney2!){#enex[slot!]!=enex[slot!]!+33}}}
#If(enedir[slot!]$="RIGHT"){#If(enex[slot!]!=stonex2!){#If(eney[slot!]!=stoney2!){#enex[slot!]!=enex[slot!]!-33}}}
}
#Method EnemyEqualCharacterLocation()
{
#If(enedir[slot!]$="LEFT"){#If(enex[slot!]!=x!){#If(eney[slot!]!=y!){#enex[slot!]!=enex[slot!]!+33#If(enex[slot!]!<175)
{#enex[slot!]!=210}}}}
#If(enedir[slot!]$="RIGHT"){#If(enex[slot!]!=x!){#If(eney[slot!]!=y!){#enex[slot!]!=enex[slot!]!-33#If(enex[slot!]!>610)
{#enex[slot!]!=606}}}}
#If(enedir[slot!]$="UP"){#If(enex[slot!]!=x!){#If(eney[slot!]!=y!){#eney[slot!]!=eney[slot!]!+33#If(eney[slot!]!<60)
{#eney[slot!]!=67}}}}
#If(enedir[slot!]$="DOWN"){#If(enex[slot!]!=x!){#If(eney[slot!]!=y!){#eney[slot!]!=eney[slot!]!-33#If(eney[slot!]!>300)
{#eney[slot!]!=298}}}}
#SetImageTransparent(enetst[slot!]$,enex[slot!]!,eney[slot!]!,32,32,255,255,255)
#Branch(:top)
}
#Method EnemyAttack()
{
#attack!=1
*#GetStats()
#enefp!=eneFP[slot!]!
#eneFP!=eneFP!-dp!
#If(enefp!<2){#eneFP!=2}
#HP!=HP!-enefp!
#CheckCharDead()
}*Method EnemyAttack End*
#Method CheckCharDead()
{
#If(HP!<0)
{
#Clear()
#SetImage("mwin.bmp",0,0,640,144)
#SetImageTransparent("gravestone.bmp",50,30,32,64,255,255,255)
#PixelText(150,30,"<name$>:")
#PixelText(150,46,"You was killed by the enemy. Please try again")
#PixelText(150,46,"or visit my website: www.rpgstudio.mysticsoftware.net")
#Wait()
#Dos()
}
#maybe!=1
}*MethodCheckCharDead End*
#If(maybe!=1)
{
#maybe!=0
#Branch(:PastEnemyWalkStillInSaMeMethod)
}
#EnemyWalk()
#Method EnemyWalk()
{
#SetImage("grass.bmp",enex[slot!]!,eney[slot!]!,32,32)
#If(eney[slot!]!>y!){#eney[slot!]!=eney[slot!]!-33 #enedir[slot!]$="UP" #EnemyEqualStoneLocation() #EnemyEqualCharacterLocation()}
#If(enex[slot!]!>x!){#enex[slot!]!=enex[slot!]!-33 #enedir[slot!]$="LEFT" #EnemyEqualStoneLocation() #EnemyEqualCharacterLocation()}
#If(eney[slot!]!<y!){#eney[slot!]!=eney[slot!]!+33 #enedir[slot!]$="DOWN" #EnemyEqualStoneLocation() #EnemyEqualCharacterLocation()}
#If(enex[slot!]!<x!){#enex[slot!]!=enex[slot!]!+33 #enedir[slot!]$="RIGHT" #EnemyEqualStoneLocation() #EnemyEqualCharacterLocation()}
}*Method EnemyWalk End*
:PastEnemyWalkStillInSaMeMethod
}
}
}*Method EnemyTurn End*
And this the whole program:
*Current Problem: Enemies don't move correctly
#attack!=1
#realtime!=2
#profile$="male.bmp"
#slot!=0
#enex[slot!]!=441
#eney[slot!]!=67
#eneHP[slot!]!=30
#eneHPmax[slot!]!=30
#enefp[slot!]!=12
#enename[slot!]$="Slime"
#slot!=1
#enex[slot!]!=606
#eney[slot!]!=166
#eneHP[slot!]!=25
#eneHPmax[slot!]!=25
#enefp[slot!]!=13
#enename[slot!]$="Slime"
#grassx1!=210
#grassy1!=100
#grassx2!=309
#grassy2!=133
#grassx3!=243
#grassy3!=232
#grassx4!=474
#grassy4!=133
#grassx5!=573
#grassy5!=265
#If(grid!=0){#SetImage("BattleBoard-nogrid.bmp",0,0,640,480)}
#If(grid!=1){#SetImage("BattleBoard.bmp",0,0,640,480)}
#Random(2,stone!)
#If(stone!=1){#stonex1!=342}
#If(stone!=2){#stonex1!=507}
#Random(2,stone!)
#If(stone!=1){#stoney1!=199}
#If(stone!=2){#stoney1!=100}
#Random(2,stone!)
#If(stone!=1){#stonex2!=408}
#If(stone!=2){#stonex2!=342}
#Random(2,stone!)
#If(stone!=1){#stoney2!=166}
#If(stone!=2){#stoney2!=265}
#For(slot!=0;slot!<2;slot!=slot!+1)
{
#enetst[slot!]$="enemy.bmp"
}
#If(statsen!=0)
{
#statsen!=1
#HP!=100
#MaxHP!=100
#SMP!=15
#MaxSMP!=15
#fp!=5
#dp!=10
}
#x!=243
#y!=199
:top
#If(attack!=1)
{
#If(grid!=0){#SetImage("BattleBoard-nogrid.bmp",0,0,640,480)}
#If(grid!=1){#SetImage("BattleBoard.bmp",0,0,640,480)}
}
#attack!=0
#FontSize(17)
#ColorRGB( 255, 255, 255 )
#Bold("on")
*#If(grid!=0){#SetImage("BattleBoardCover.bmp",174,0,466,332) #SetImage("arrows.bmp",0,0,145,98)}
*#If(grid!=1){#SetImage("BattleBoardCoverGrid.bmp",174,0,466,332) #SetImage("arrows.bmp",0,0,145,98)}
#SetImage("stone1.bmp",stonex1!,stoney1!,32,32)
#SetImage("stone2.bmp",stonex2!,stoney2!,32,32)
#SetImage("grass1.bmp",grassx1!,grassy1!,32,32)
#SetImage("grass1.bmp",grassx2!,grassy2!,32,32)
#SetImage("grass1.bmp",grassx3!,grassy3!,32,32)
#SetImage("grass1.bmp",grassx4!,grassy4!,32,32)
#SetImage("grass1.bmp",grassx5!,grassy5!,32,32)
#SetImageTransparent(profile$,188,354,100,100,255,255,255)
#For(slot!=0;slot!<2;slot!=slot!+1)
{
#If(eneHP[slot!]!>0)
{
#SetImageTransparent(enetst[slot!]$,460,345,32,32,255,255,255)
}
}
#PixelText(350, 366, "<HP!>/<maxhp!>")
#PixelText(350, 388,"<smp!>/<maxsmp!>")
#PixelText(364, 409,"<fp!>")
#PixelText(364, 430,"<dp!>")
#GetFontSize(size!)
#FontSize(14)
#slot!=0
#PixelText(542, 342, "<enename[slot!]$>")
#PixelText(542, 355, "<enehp[slot!]!>/<eneHPmax[slot!]!>")
#PixelText(552, 370, "<enefp[slot!]!>")
#slot!=1
#PixelText(542, 385, "<enename[slot!]$>")
#PixelText(542, 399, "<enehp[slot!]!>/<eneHPmax[slot!]!>")
#PixelText(552, 413, "<enefp[slot!]!>/<eneHPmax[slot!]!>")
*#PixelText(542, 428, "<enename[slot!]$>")
*#PixelText(542, 442, "<enehp[slot!]!>/<eneHPmax[slot!]!>")
*#PixelText(552, 456, "<enefp[slot!]!>/<eneHPmax[slot!]!>")
#Method setchar()
{
#If(profile$="male.bmp"){#SetImageTransparent("battlechar.bmp",x!,y!,32,32,255,255,255)}
#If(profile$="female.bmp"){#SetImageTransparent("battlechar1.bmp",x!,y!,32,32,255,255,255)}
}
#FontSize(size!)
#If(profile$="male.bmp"){#SetImageTransparent("battlechar.bmp",x!,y!,32,32,255,255,255)}
#If(profile$="female.bmp"){#SetImageTransparent("battlechar1.bmp",x!,y!,32,32,255,255,255)}
#For(slot!=0;slot!<2;slot!=slot!+1)
{
#If(eneHP[slot!]!>0)
{
#SetImageTransparent(enetst[slot!]$,enex[slot!]!,eney[slot!]!,32,32,255,255,255)
}
}
#Done!=0
#While(Done!=0)
{
#If(realtime!=1){#Get(a$)}
#If(realtime!=2){#Wait(a$)}
#SetImage("grass.bmp",x!,y!,32,32)
#If(a$="UP"){ #y!=y!-33 #SetImageTransparent("cursor-north.bmp",74,16,17,17,255,255,255) #LittleDelay()}
#If(a$="DOWN"){ #y!=y!+33 #SetImageTransparent("cursor-south.bmp",74,70,17,17,255,255,255) #LittleDelay()}
#If(realtime!=1){#If(a$="RIGHT"){ #x!=x!-33 #SetImageTransparent("cursor-west.bmp",47,43,17,17,255,255,255) #LittleDelay()}}
#If(realtime!=1){#If(a$="LEFT"){ #x!=x!+33 #SetImageTransparent("cursor-east.bmp",101,43,17,17,255,255,255) #LittleDelay()}}
#If(realtime!=2){#If(a$="LEFT"){ #x!=x!-33 #SetImageTransparent("cursor-west.bmp",47,43,17,17,255,255,255) #LittleDelay()}}
#If(realtime!=2){#If(a$="RIGHT"){ #x!=x!+33 #SetImageTransparent("cursor-east.bmp",101,43,17,17,255,255,255) #LittleDelay()}}
#If(x!<170){#x!=177}
#If(x!>610){#x!=606}
#If(y!<60){#y!=67}
#If(y!>300){#y!=298}
#setchar()
#If(a$="UP"){#If(x!=stonex1!){#If(y!=stoney1!){#y!=y!+33}}}
#If(a$="DOWN"){#If(x!=stonex1!){#If(y!=stoney1!){#y!=y!-33}}}
#If(a$="LEFT"){#If(x!=stonex1!){#If(y!=stoney1!){#x!=x!+33}}}
#If(a$="RIGHT"){#If(x!=stonex1!){#If(y!=stoney1!){#x!=x!-33}}}
#If(a$="UP"){#If(x!=stonex2!){#If(y!=stoney2!){#y!=y!+33}}}
#If(a$="DOWN"){#If(x!=stonex2!){#If(y!=stoney2!){#y!=y!-33}}}
#If(a$="LEFT"){#If(x!=stonex2!){#If(y!=stoney2!){#x!=x!+33}}}
#If(a$="RIGHT"){#If(x!=stonex2!){#If(y!=stoney2!){#x!=x!-33}}}
#If(a$="UP"){#If(enex[slot!]!=x!){#If(eney[slot!]!=y!){#y!=y!+33}}}
#If(a$="DOWN"){#If(enex[slot!]!=x!){#If(eney[slot!]!=y!){#y!=y!-33}}}
#If(a$="LEFT"){#If(enex[slot!]!=x!){#If(eney[slot!]!=y!){#x!=x!+33}}}
#If(a$="RIGHT"){#If(enex[slot!]!=x!){#If(eney[slot!]!=y!){#x!=x!-33}}}
#If(a$="UP"){#chardir$="UP" #EnemyTurn()}
#If(a$="DOWN"){#chardir$="DOWN" #EnemyTurn()}
#If(a$="LEFT"){#chardir$="LEFT" #EnemyTurn()}
#If(a$="RIGHT"){#chardir$="RIGHT" #EnemyTurn()}
#If(a$="ENTER"){#Attack()}
#If(a$="SPACE"){#Magic()}
#If(a$="I"){#Items()}
#If(a$="S"){#EnemyTurn()}
#If(a$="F"){#Flee()}
#If(a$="G")
{
#If(grid!=1){#grid!=0 #Branch(:top)}
#If(grid!=0){#grid!=1 #Branch(:top)}
}
#If(a$="C")
{
}
#If(a$="R")
{
}
#If(realtime!=1){#Enemyturn()}
}*While Loop End*
#Method GetStats()
{
#GetHP(TARGet,HP!)
#GetMaxHP(TARGet,MaxHP!)
#GetFP(TARGet,fp!)
#GetDP(TARGet,dp!)
#GetLevel(TARGet,level!)
#GetSMP(TARGet,SMP!)
#GetMaxSMP(TARGet,MaxSMP!)
}*Method GetStats End*
#Method Attack()
{
#For(slot!=0;slot!<2;slot!=slot!+1)
{
#If(eneHP[slot!]!>0)
{
#charx!=x!
#charx!=charx!+22
#If(chardir$="RIGHT"){#SetImageTransparent("swordright.bmp",charx!,y!,32,32,255,255,255)}
#charx!=x!
#charx!=charx!-22
#If(chardir$="LEFT"){#SetImageTransparent("swordleft.bmp",charx!,y!,32,32,255,255,255)}
#chary!=y!
#chary!=chary!+25
#If(chardir$="DOWN"){#SetImageTransparent("sworddown.bmp",x!,chary!,32,32,255,255,255)}
#chary!=y!
#chary!=chary!-20
#If(chardir$="UP"){#SetImageTransparent("swordup.bmp",x!,chary!,32,32,255,255,255)}
#xplusone()
#If(enexx[slot!]!=x!)
{
#If(eney[slot!]!=y!)
{
#FinishAttack()
}
}
#xminusone()
#If(enexx[slot!]!=x!)
{
#If(eney[slot!]!=y!)
{
#FinishAttack()
}
}
#yplusone()
#If(eneyy[slot!]!=y!)
{
#If(enex[slot!]!=x!)
{
#FinishAttack()
}
}
#yminusone()
#If(eneyy[slot!]!=y!)
{
#If(enex[slot!]!=x!)
{
#FinishAttack()
}
}
}
}
#EnemyTurn()
}*Method Attack End*
#Method FinishBattle()
{
#GetStats()
#eneHP[slot!]!=eneHP[slot!]!-fp!
#If(eneHP[slot!]!<1){#eneHP[slot!]!=0}
}*Method Finish Battle End*
#Method Magic()
{
*For Next Release*
}*Method Magic End*
#Method Items()
{
*For Next Release*
}*Method Items End*
#Method Flee()
{
#Random(4,Run!)
#If(Run!=1)
{
#Done!=1
#Clear()
#Return()
#SetImage("mwin.bmp",0,0,640,144)
#SetImageTransparent("char-south1.bmp",50,30,32,64,255,255,255)
#PixelText(150,30,"William:")
#PixelText(150,46,"I ran away from the enemy.")
#PixelText(150,62,"Press a arrow key to continue.")
#Wait()
#Run("")
}
#EnemyTurn()
}*Method Flee End*
#Method EnemyTurn()
{
#For(slot!=0;slot!<2;slot!=slot!+1)
{
#If(eneHP[slot!]!>0)
{
#maybe!=0
#Random(4,Random!)
#If(Random!=1){#Branch(:PastEnemyWalkStillInSaMeMethod)}
#check()
#Method check()
{
#xplusone()
#If(enexx[slot!]!=x!){#If(eney[slot!]!=y!){#EnemyAttack()}}
#xminusone()
#If(enexx[slot!]!=x!){#If(eney[slot!]!=y!){#EnemyAttack()}}
#yplusone()
#If(eneyy[slot!]!=y!){#If(enex[slot!]!=x!){#EnemyAttack()}}
#yminusone()
#If(eneyy[slot!]!=y!){#If(enex[slot!]!=x!){#EnemyAttack()}}
}
#Method xplusone()
{
#enexx[slot!]!=enex[slot!]!
#enexx[slot!]!=enexx[slot!]!+33
}
#Method xminusone()
{
#enexx[slot!]!=enex[slot!]!
#enexx[slot!]!=enexx[slot!]!-33
}
#Method yplusone()
{
#eneyy[slot!]!=eney[slot!]!
#eneyy[slot!]!=eneyy[slot!]!+33
}
#Method yminusone()
{
#eneyy[slot!]!=eney[slot!]!
#eneyy[slot!]!=eneyy[slot!]!-33
}
#Method EnemyEqualStoneLocation()
{
#If(enedir[slot!]$="UP"){#If(enex[slot!]!=stonex1!){#If(eney[slot!]!=stoney1!){#eney[slot!]!=eney[slot!]!+33}}}
#If(enedir[slot!]$="DOWN"){#If(enex[slot!]!=stonex1!){#If(eney[slot!]!=stoney1!){#eney[slot!]!=eney[slot!]!-33}}}
#If(enedir[slot!]$="LEFT"){#If(enex[slot!]!=stonex1!){#If(eney[slot!]!=stoney1!){#enex[slot!]!=enex[slot!]!+33}}}
#If(enedir[slot!]$="RIGHT"){#If(enex[slot!]!=stonex1!){#If(eney[slot!]!=stoney1!){#enex[slot!]!=enex[slot!]!-33}}}
#If(enedir[slot!]$="UP"){#If(enex[slot!]!=stonex2!){#If(eney[slot!]!=stoney2!){#eney[slot!]!=eney[slot!]!+33}}}
#If(enedir[slot!]$="DOWN"){#If(enex[slot!]!=stonex2!){#If(eney[slot!]!=stoney2!){#eney[slot!]!=eney[slot!]!-33}}}
#If(enedir[slot!]$="LEFT"){#If(enex[slot!]!=stonex2!){#If(eney[slot!]!=stoney2!){#enex[slot!]!=enex[slot!]!+33}}}
#If(enedir[slot!]$="RIGHT"){#If(enex[slot!]!=stonex2!){#If(eney[slot!]!=stoney2!){#enex[slot!]!=enex[slot!]!-33}}}
}
#Method EnemyEqualCharacterLocation()
{
#If(enedir[slot!]$="LEFT"){#If(enex[slot!]!=x!){#If(eney[slot!]!=y!){#enex[slot!]!=enex[slot!]!+33#If(enex[slot!]!<175)
{#enex[slot!]!=210}}}}
#If(enedir[slot!]$="RIGHT"){#If(enex[slot!]!=x!){#If(eney[slot!]!=y!){#enex[slot!]!=enex[slot!]!-33#If(enex[slot!]!>610)
{#enex[slot!]!=606}}}}
#If(enedir[slot!]$="UP"){#If(enex[slot!]!=x!){#If(eney[slot!]!=y!){#eney[slot!]!=eney[slot!]!+33#If(eney[slot!]!<60)
{#eney[slot!]!=67}}}}
#If(enedir[slot!]$="DOWN"){#If(enex[slot!]!=x!){#If(eney[slot!]!=y!){#eney[slot!]!=eney[slot!]!-33#If(eney[slot!]!>300)
{#eney[slot!]!=298}}}}
#SetImageTransparent(enetst[slot!]$,enex[slot!]!,eney[slot!]!,32,32,255,255,255)
#Branch(:top)
}
#Method EnemyAttack()
{
#attack!=1
*#GetStats()
#enefp!=eneFP[slot!]!
#eneFP!=eneFP!-dp!
#If(enefp!<2){#eneFP!=2}
#HP!=HP!-enefp!
#CheckCharDead()
}*Method EnemyAttack End*
#Method CheckCharDead()
{
#If(HP!<0)
{
#Clear()
#SetImage("mwin.bmp",0,0,640,144)
#SetImageTransparent("gravestone.bmp",50,30,32,64,255,255,255)
#PixelText(150,30,"<name$>:")
#PixelText(150,46,"You was killed by the enemy. Please try again")
#PixelText(150,46,"or visit my website: www.rpgstudio.mysticsoftware.net")
#Wait()
#Dos()
}
#maybe!=1
}*MethodCheckCharDead End*
#If(maybe!=1)
{
#maybe!=0
#Branch(:PastEnemyWalkStillInSaMeMethod)
}
#EnemyWalk()
#Method EnemyWalk()
{
#SetImage("grass.bmp",enex[slot!]!,eney[slot!]!,32,32)
#If(eney[slot!]!>y!){#eney[slot!]!=eney[slot!]!-33 #enedir[slot!]$="UP" #EnemyEqualStoneLocation() #EnemyEqualCharacterLocation()}
#If(enex[slot!]!>x!){#enex[slot!]!=enex[slot!]!-33 #enedir[slot!]$="LEFT" #EnemyEqualStoneLocation() #EnemyEqualCharacterLocation()}
#If(eney[slot!]!<y!){#eney[slot!]!=eney[slot!]!+33 #enedir[slot!]$="DOWN" #EnemyEqualStoneLocation() #EnemyEqualCharacterLocation()}
#If(enex[slot!]!<x!){#enex[slot!]!=enex[slot!]!+33 #enedir[slot!]$="RIGHT" #EnemyEqualStoneLocation() #EnemyEqualCharacterLocation()}
}*Method EnemyWalk End*
:PastEnemyWalkStillInSaMeMethod
}
}
}*Method EnemyTurn End*
#Method FinishAttack()
{
#attack!=1
#eneHP[slot!]!=eneHP[slot!]!-fp!
#CheckEnemyDead()
}*Method FinishAttack End*
#Method CheckEnemyDead()
{
#enemydead!=0
#For(slot!=0;slot!<2;slot!=slot!+1)
{
#If(eneHP[slot!]!<1)
{
#enemydead!=enemydead!+1
}
#If(enemydead!=2)
{
#Done!=1
#Clear()
#Return()
#SetImage("mwin.bmp",0,0,640,144)
#PixelText(150,46,"The enemy lost Battle.")
#PixelText(150,62,"Press a 'arrow key' to continue.")
#Wait()
#Run("")
}
}
#If(slot!=1){#EnemyTurn()}
}*Method CheckEnemyDead End*
#Method LittleDelay()
{
}*Method LittleDelay End*