Author Topic: (no subject)  (Read 1808 times)

Trent

  • Member
  • *
  • Posts: 908
    • View Profile
(no subject)
« on: October 22, 2003, 08:44:55 PM »
Ok, here's my problem. I am trying to make a BS. Again. <_< The problem(s) are this: 6 safety nets appear right before the battle, the main character's in two places, and DrawText does not seem to be working at all (I found the error of this one while putting in the comments here). I am using G's Misc Plugin, Triuken's Plugin, and Juicy. Here is the code, commented to the best of my ability. As you may or may not be able to tell, it is not finished. I am just trying to make sure everything works right.

Code: [Select]
*FightBattle - Includes needed files, and calls
*all the pretty methods that we need to run.
*
*CacheScreens:
*
*0-Initial state; board is only drawn
*1-Characters and enemies have been drawn
*2-Info stat command display mabobers have been drawn
*3-Text has been placed into the stat boxes.
#Method FightBattle(en[1]$, en[2]$, en[3]$, bkg$, canrun!)
{
#include("enemylib.prg")
#GetVariables
#SetStats
#Send(bkg$, 19, 5)
#forceredraw
#CacheScreen(0)
#DrawScreen(0)
#system.pause
}

*GetVariables - stores the important info that we need
*once the battle is over.
#Method GetVariables
{
#playerx[0]! = originalx!
#playery[0]! = originaly!
#playerlayer[0]! = originall!
#GetBoardName(originalboard$)
#FontProperties("Arial", 10)
}

*SetPlayerStats - Puts the player stats into variables that
*will be used in the BS. Yes, I know experience is wrong.
*I changed its variable in the player editor. Enemy var's
*are the same, but with e's instead of p's.
#Method SetPlayerStats(playernum!)
{
#If(playerhandle[playernum!]$ ~= "")
{
  #p_handle[playernum!]$ = playerhandle[playernum!]$
  #GetHP(p_handle[playernum!]$, p_hp[playernum!]!)
  #GetMaxHP(p_handle[playernum!]$, p_mhp[playernum!]!)
  #GetSMP(p_handle[playernum!]$, p_mp[playernum!]!)
  #GetMaxSMP(p_handle[playernum!]$, p_mmp[playernum!]!)
  #GetFP(p_handle[playernum!]$, p_fp[playernum!]!)
  #GetDP(p_handle[playernum!]$, p_dp[playernum!]!)
  #GetLevel(p_handle[playernum!]$, p_level[playernum!]!)
  #GetGP(gold!)
  #p_exp[playernum!]! = exp[p_handle[playernum!]$]!
}
}

*CheckPlayerDead - Checks to see if a player's dead. Duh.
#Method CheckPlayerDead(playernum!)
{
#p_dead[playernum!]! = 0
#if(p_hp[playernum!]! < 1)
{
  #p_dead[playernum!]! = 1
}
#if(p_handle[playernum!]$ = "")
{
  #p_dead[playernum!]! = 1
}
}

*CheckEnemyDead - Take a guess.
#Method CheckEnemyDead(enemynum!)
{
#if(e_hp[enemynum!]! < 1)
{
  #p_handle[enemynum!]$ = ""
}
}

*CheckBattleOver - Checks to see if the battle's over,
*returns 1 if the good guys win, returns 2 if the bad
*guys win.
#Method CheckBattleOver(battleover!)
{
#pdeadall! = p_dead[0]! + p_dead[1]! + p_dead[2]!
#if(pdeadall! = 3)
{
  #battleover! = 2
  #Return(battleover!)
}
#if(e_handle[1]$ = "")
{
  #if(e_handle[2]$ = "")
  {
   #if(e_handle[3]$ = "")
   {
    #battleover! = 1
    #Return(battleover!)
   }
  }
}
}

*SetEnemyStats - Calls a method that sets the stats
*for an enemy.
#Method SetEnemyStats(enemynum!)
{
#If(en[enemynum!]$ ~= "")
{
  #code$ = "#e_" + en[enemynum!]$
  #RPGCode(code$)
  #Kill(code$)
}
}

*SetStats - Take a look.
#Method SetStats
{
#SetPlayerStats(0)
#SetPlayerStats(1)
#SetPlayerStats(2)
#SetEnemyStats(1)
#SetEnemyStats(2)
#SetEnemyStats(3)
#CheckPlayerDead(0)
#CheckPlayerDead(1)
#CheckPlayerDead(2)
#CheckEnemyDead(1)
#CheckEnemyDead(2)
#CheckEnemyDead(3)
}

*DrawPlayerStats - Houston, we have a problem here.
*The plugin refuses to draw anything, and... Whoops!
*Well, anyways, it draws the stats in a little box thingy.
#Method DrawPlayerStats(playernum!)
{
#if(p_handle[playernum!]$ ~= 0) <~~~ Rofl. Found it.
{
  #color(15)
  #hori! = playernum! * 100 + 307
  #DrawText(p_handle[playernum!]$, hori!, 389)
  #DrawText("HP: <p_hp[playernum!]!>/<p_mhp[playernum!]!>", hori!, 409)
  #DrawText("MP: <p_mp[playernum!]!>/<p_mmp[playernum!]!>", hori!, 420)
  #hori2! = hori! + 80
  #fdraw! = p_fury[playernum!]! / 260 * 80
  #color(13)
  #fillrect(hori!, 440, fdraw!, 460)
  #drawrect(hori!, 440, hori2!, 460)
  #kill(hori!)
  #kill(hori2!)
  #kill(fdraw!)
}
}

*DrawScreen - This pretty thingy draws the players, enemies,
*And stat info display command selector thingies.
*
*Modes:
*
*0 - Draw Everything.
*1 - Draw Players and enemies
*2 - Draw Stat indicator info command display selector thingy-mabobbies.
#Method DrawScreen(mode!)
{
#If(mode! = 0)
{  
  #flipscreen(0)
  #for(temp! = 0; temp! < 4; temp! = temp! + 1)
  {
   #If(p_handle[temp!]$ ~= "")
   {
    #vert! = temp! * 2 + 5
    #eraseplayer(p_handle[temp!]$)
    #putplayer(p_handle[temp!]$, 19, vert!)
    #if(p_dead[temp!]! = 0)
    {
     #stance(43, p_handle[temp!]$)
    }
    #if(p_dead[temp!]! = 1)
    {
     #stance(30, p_handle[temp!]$)
    }
    #kill(vert!)
   }
  }
  #for(temp! = 1; temp! < 4; temp! = temp! + 1)
  {
   #if(en[temp!]$ ~= "")
   {
    #if(e_handle[temp!]$ ~= "")
    {
     #hori! = 2
     #vert! = temp! -1 * 4 + 4
     #if(vert! = 12)
     {
      #hori! = 7
      #vert! = 10
     }
     #drawenemy(e_file[temp!]$, hori!, vert!)
     #kill(hori!)
     #kill(vert!)
    }
   }
  }
  #CacheScreen(1)
  #setimagetranslucent("mwin.jpg", 0, 379, 100, 100)
  #setimagetranslucent("mwin.jpg", 307, 379, 300, 100)
  #color(15)
  #drawrect(0, 379, 100, 479)
  #drawrect(307, 379, 407, 479)
  #drawrect(407, 379, 507, 479)
  #drawrect(507, 379, 607, 479)
  #CacheScreen(2)
  #DrawPlayerStats(0)
  #DrawPlayerStats(1)
  #DrawPlayerStats(2)
  #CacheScreen(3)
  #kill(temp!)
}
#if(mode! = 1)
{
  #FlipScreen(0, 0, 0, 640, 379)
  #for(temp! = 0; temp! = 2; temp! = temp! + 1)
  {
   #If(p_handle[temp!]$ ~= "")
   {
    #vert! = temp! * 2 + 5
    #eraseplayer(p_handle[temp!]$)
    #putplayer(p_handle[temp!]$, 8, vert!)
    #if(p_dead[temp!]! = 0)
    {
     #stance(43, p_handle[temp!]$)
    }
    #if(p_dead[temp!]! = 1)
    {
     #stance(30, p_handle[temp!]$)
    }
    #kill(vert!)
   }
  }
  #for(temp! = 1; temp! = 3; temp! = temp! + 1)
  {
   #if(en[temp!]$ ~= "")
   {
    #if(e_handle[temp!]$ ~= "")
    {
     #hori! = 2
     #vert! = temp! * 4 + 4
     #if(vert! = 16)
     {
      #hori! = 7
      #vert! = 10
     }
     #drawenemy(e_file[temp!]$, hori!, vert!)
     #kill(hori!)
     #kill(vert!)
    }
   }
  }
  #CacheScreen(1)
  #kill(temp!)
}
#if(mode! = 2)
{
  #FlipScreen(2, 380, 640, 480)
  #DrawPlayerStats(0)
  #DrawPlayerStats(1)
  #DrawPlayerStats(2)
  #CacheScreen(3)
}
}
« Last Edit: October 22, 2003, 08:45:32 PM by Trent »
--- Trent McPheron, Twilight in Zero

Avatar by Sophia Y. Hsu.

Dont_Think_So

  • Member
  • *
  • Posts: 76
    • View Profile
(no subject)
« Reply #1 on: October 22, 2003, 11:36:06 PM »
First of all, I'll assume that #setstats is in enemylib.prg, so I'll guess that the safety nets are somewhere in there, cause I dont see a problem elsewhere in your code.



The two players issue is probably because you have sent the character to one place, and then drawn him yet again in the other, using #send and #drawscreen(0), respectively.


Of course, this may not be accurate as I merely skimmed the code, but... yeah. Hope that fixes it Smile
« Last Edit: December 31, 1969, 06:00:00 PM by Dont_Think_So »

AlienDude

  • Member
  • *
  • Posts: 605
    • View Profile
    • http://www.taralax.com
(no subject)
« Reply #2 on: October 23, 2003, 10:34:34 AM »
All I can see right now is in the CheckEnemyDead method: It should have e_handle, not p_handle.

I may be getting the source code for TK2 soon, so I could do some cool BS stuff (and learn more VB).

Give me a while, though.  I'm trying ti work on my own BS right now and it's going to be great. Also i am helping quoaz and -Matthew- with theirs (all VERY challenging, believe me).  I will try.
« Last Edit: December 31, 1969, 06:00:00 PM by AlienDude »
Quote
May your star always be good to you and may your travels be swift.
 
- Traveller Farewell
(adapted from the Necroscope series by Brian Lumley)

Taralax Studios BEING REBUILT GENOME BY GENOME! \n\t\t\t\t\t\t\t\t\t
<' + '/div>\n\t\t\t\t\t\t\t\t\t