Dark Age Games
Home Dark Age EX Dark Age 2 Message Board Fan Art FAQ Kelzar Mage DALpedia MS Forum
Board Index Dark Age General Bug Report Website Off Topic Register User Edit User User List Search

Xorlak, problems with bs..
Posted by: William
15:07:42 12-14-2004

You see, you said to me to use this:


#for(i!=0;i!<3;i!=i!+1)
{
  #enemyturn(i!)
}

And sure it's a good idea. But in the #enemyturn method, I have some other methods and so. And one of those methods in th #enemyturn method is a part where you check if the character is dead, and atfer that the program runs from the top by a branch.

And then it won't go back to the for loop location.
So I have to recode a large part if I want to use that way, so I'm thinking of having "as many enemy turn parts as enemy".

So I will "maybe" have it where the first enemy move:

1. Enemy 1 checks if he can attack
2. Enemy 1 moves if he can't attack
3. Enemy 2 checks if he can attack
2. Enemy 2 moves if he can't attack

But will it be very slow if I do this?

So I will have two programs for two enemies, I know this will be long but it's pretty difficult to have a for loop here. This is the whole code if you like to see it:


#Random(3,enestats!)
#If(enestats!=1)
{
#enex[slot!]!=441
#eney[slot!]!=67
#eneHP[slot!]!=30
#eneHPmax[slot!]!=30
#enefp[slot!]!=12
#enename[slot!]$="Slime"
}
#If(enestats!=2)
{
#enex[slot!]!=606
#eney[slot!]!=166
#eneHP[slot!]!=25
#eneHPmax[slot!]!=25
#enefp[slot!]!=13
#enename[slot!]$="Slime"
}
#If(enestats!=3)
{
#enex[slot!]!=441
#eney[slot!]!=265
#eneHP[slot!]!=20
#eneHPmax[slot!]!=20
#enefp[slot!]!=14
#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}


#Random(2,ene!)
#If(ene!=1){#enetst[slot!]$="enemy.bmp"}
#If(ene!=2){#enetst[slot!]$="enemy1.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)

#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)
#PixelText(542, 342, "<enename[slot!]$>")
#PixelText(542, 355, "<enehp[slot!]!>/<eneHPmax[slot!]!>")
#PixelText(552, 370, "<enefp[slot!]!>")

*#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!]!>")



#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)}
#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$)}

#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}

#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()
{
#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 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 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()
{

#Random(4,Random!)
#If(Random!=1){#Branch(:top)}

#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 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)
}

#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 EnemyTurn End*



#Method EnemyAttack()
{
#attack!=1
*#GetStats()
#enefp!=eneFP[slot!]!
#eneFP!=eneFP!-dp!
#If(enefp!<2){#eneFP!=2}
#HP!=HP!-enefp!
#CheckCharDead()
}*Method EnemyAttack End*


#Method FinishAttack()
{
#attack!=1
#eneHP[slot!]!=eneHP[slot!]!-fp!
#CheckEnemyDead()
}*Method FinishAttack 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()
}
#Branch(:top)
}*Method CheckCharDead End*



#Method CheckEnemyDead()
{
#If(eneHP[slot!]!<1)
{
#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("")
}
#EnemyTurn()
}*Method CheckEnemyDead End*


#Method LittleDelay()
{
}*Method LittleDelay End*





_______________
Fan of DA. Keep it going.

Working on other things now. Trying to get my life to pieces.
That was a long time ago I wrote this:
Project: Marovia
Finished: 32%
Edit Post