I need help upgrading a battle sytem to work with the newest version of AGS

Started by seraphimdreamer777, Thu 23/07/2009 08:04:40

Previous topic - Next topic

seraphimdreamer777

Yes it is in my current code.

I was thinking I don't know if you'd want to but I thought I could give you a link to the thread that I got this from. It is on this site it's just a real old post. If you don't it's OK I know your busy with a lot more than just me I just thought maybe if you and I both fiddled around with it one of us might find the problem faster.
Victory is my destiny

Gilbert

Just to make sure, was that function declared in the same room script as the "winning" part, or, was it in the global script?

If it was in the global script, put on top of the room script the following line:

import function DrawStatusBars();

seraphimdreamer777

I believe it is in the room script but I could be wrong. Cause I looked through Global script of which is way smaller and couldn't find it this is my global

// Automatically converted interaction variables
int IntVar_Global_1 = 0;
export IntVar_Global_1;
// main global script file

#sectionstart game_start  // DO NOT EDIT OR REMOVE THIS LINE
function game_start() {
  // called when the game starts, before the first room is loaded
 
  Debug(4,1);
 
}
#sectionend game_start  // DO NOT EDIT OR REMOVE THIS LINE


#sectionstart repeatedly_execute  // DO NOT EDIT OR REMOVE THIS LINE
function repeatedly_execute() {
  // put anything you want to happen every game cycle here
}
#sectionend repeatedly_execute  // DO NOT EDIT OR REMOVE THIS LINE


#sectionstart on_key_press  // DO NOT EDIT OR REMOVE THIS LINE
function on_key_press(int keycode) {
  // called when a key is pressed. keycode holds the key's ASCII code
  if (IsGamePaused() == 1) keycode=0;  // game paused, so don't react to keypresses
  if (keycode==17)  QuitGame(1);   // Ctrl-Q
  if (keycode==363) SaveGameDialog();   // F5
  if (keycode==365) RestoreGameDialog();  // F7
  if (keycode==367) RestartGame();  // F9
  if (keycode==434) SaveScreenShot("scrnshot.bmp");  // F12

  if (keycode==19)  Debug(0,0);  // Ctrl-S, give all inventory
  if (keycode==22)  Debug(1,0);  // Ctrl-V, version
  if (keycode==1)   Debug(2,0);  // Ctrl-A, show walkable areas
  if (keycode==24)  Debug(3,0);  // Ctrl-X, teleport to room
}
#sectionend on_key_press  // DO NOT EDIT OR REMOVE THIS LINE


#sectionstart on_mouse_click  // DO NOT EDIT OR REMOVE THIS LINE
function on_mouse_click(MouseButton button) {
  // called when a mouse button is clicked. button is either LEFT or RIGHT
  if (IsGamePaused() == 1) {
    // Game is paused, so do nothing (ie. don't allow mouse click)
  }
  else if (button== eMouseLeft) {
    ProcessClick( mouse.x, mouse.y, mouse.Mode );
   
    if (mouse.Mode == eModeLookat)
    {
      Display("Default Controls for Player 1:[Up arrow - Attack 1[Left arrow - Attack 2[Down arrow - Parry/Block[Right arrow - Dodge");
    }
  }
  else {   // right-click, so cycle cursor
    mouse.SelectNextMode();
  }
}
#sectionend on_mouse_click  // DO NOT EDIT OR REMOVE THIS LINE


#sectionstart interface_click  // DO NOT EDIT OR REMOVE THIS LINE
function interface_click(int interface, int button) {
  if (interface == ICONBAR) {
    if (button == 5) {   // use selected inventory
      if (player.ActiveInventory != null)
        mouse.Mode = eModeUseinv;
    }
    else if (button == 6)    // save game
      SaveGameDialog();
    else if (button == 7)   // load game
      RestoreGameDialog();
    else if (button == 8)   // quit
      QuitGame(1);
    else if (button == 9)    // about
      Display("Adventure Game Studio v2 run-time engine[[Copyright (c) 1999-2003 Chris Jones");
  }  // end if interface ICONBAR
 
}
#sectionend interface_click  // DO NOT EDIT OR REMOVE THIS LINE


function cEgo_Look()
{
DisplayMessage(999);
}

function cEgo_Interact()
{
DisplayMessage(998);
}

function cEgo_Talk()
{
DisplayMessage(997);
}

function dialog_request(int param) {
}
Victory is my destiny

Gilbert

If they are in the same script, check one more thing. If the function ON_ACTION_ACTIVE() is before DrawStatusBars(), move ON_ACTION_ACTIVE() down so it's below DrawStatusBars().

seraphimdreamer777

Sorry that didn't work either. It loaded up but it also did the same thing it always does.

By the way if I ever figure out whats wrong with it do you think Scopiorus would mind me posting a template as long as I give him credit. I mean so other people can use it too.
Victory is my destiny

Gilbert

One last resort. Try adding the following line after the call to DisplayStatusBars() in the winning part and see if it helps.

Wait(1);

seraphimdreamer777

Well I tried it and it didn't work.

How much work do you think it would take to revert the meters in to HP numbers and do you think it would go down to zero if I did put numbers instead.
Victory is my destiny

Gilbert

It's very easy.

For example, you can just hack your original function to add text on it:
Code: ags

function DrawPercentBar(int x, int y, int width, int length, int col, int percent) {  
  percent = AdjustValue(percent, 0, 100);
  int colored_length = (length * percent) / 100;
  RawDrawBar(x, y, x+length, y+width, COLOR_BLACK);
  if (percent > 0) RawDrawBar(x, y, x+colored_length, y+width, col);
  DrawingSurface *surface = Room.GetDrawingSurfaceForBackground();
  surface.DrawingColor = 15;  // <-- Change it to a better colour if not very readible
  surface.DrawString(x, y, Game.NormalFont, "%d", percent);
  surface.Release();
}



seraphimdreamer777

Well I've figured out that it stops at 4 HP if that helps any. Thanks for telling me how to get the HP numbers. Now I guess I can look over my script for the number 4 maybe I'll find the problem that way.
Victory is my destiny

SMF spam blocked by CleanTalk