Menu

Show posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.

Show posts Menu

Messages - Ezekiel000

#1
I have 3 mini games that are run from my main game using RunAGSGame(mgX.exe, 0, 0), all three run fine when run in the editor or from the compiled exe but when I run two of them with RunAGSGame I get errors. All the games are created in the same version of AGS (the latest one from the ags home page) with the same resolution and colour depth.
For mg2 one of the buttons on the HUD gui seems to have it's normal graphic set to the wrong sprite every cycle.
For mg3 it crashes with an undefined import for the name of one of the buttons on the HUD gui but if I comment out the line that sets the graphics for that button then it complains about an undefined import for 'player'. But if I set the main game not to exit completely then it crashes when it tries to play a sound embedded in the mini games exe file.

Any ideas on how to figure out what the problem is?

Edit: Nevermind I decided to combine the mini games into the main project.
#2
Ah right thanks.
#3
Is it possible to produce an *.ags file of a game in AGS3?
If not is it possible to strip the engine from the compiled game exe?

I have 3 mini games in my project and which means I have 4 copies of the ags engine that I don't need.
#4
Thank you, I'll do a few tests to see which way I want to go.
Even if I reuse room objects it is always interesting to learn and understand new techniques.
#5
Ah right thanks, I'll try just reusing room objects.
#6
I was wondering how the marbles part of Kweepa's Mega Demo was done?

http://www.kweepa.com/step/ags/games/MegaDemo.zip (5Mb)

I'm trying to create a mini game where objects randomly fall from the top of the screen and the player has to move the character to catch the objects.
#7
I managed to get much closer to the original warp, if anyone else was interested here it is:
Code: AGS
/********************************************
* Background                                *
********************************************/

int displayFrame = 1;
int bufferFrame = 2;

int baseline = 255;
int amplitude = 30;
float frequency = 0.1;

int r = 1;

function bg_warp()
{
  if (r == 0)
  {
    int next_line = baseline;
    int i = 0;
    while (i < 164)
    {
      float x_offset = Maths.Sin(IntToFloat(i) * frequency) * IntToFloat(amplitude);
      int x_offset_i = FloatToInt(x_offset);
      DynamicSprite *s = DynamicSprite.CreateFromBackground(bufferFrame, x_offset_i + amplitude, next_line, 320 - (amplitude * 2), 1);
      RawDrawImageResized(0, 186 - i, s.Graphic, 320, 1);
      s.Delete();
      if (next_line - 1 == -1) next_line = 255;
      else next_line--;
      i++;
    }
    baseline++;
    if (baseline < 0) baseline = 255 + baseline;
    if (baseline > 255) baseline = baseline - 255;
    r = 1;
  }
  else r--;
}
#8
I'm trying to recreate an effect, it is a consistent ripple/wave distortion so.
I started with the LakeModule as a base and modified it to be a single instance in the room script as I only need it once.
I got the ripple to reverse and stopped the ripple from tapering but it doesn't look right and the warped image doesn't scroll up.
I was hoping that someone who is better at maths and ags scripting could help me match the original warp.

The background image is http://s8.postimage.org/ffcydh879/arena_bg.png (tiles vertically)

And an animation of the resulting effect: http://s8.postimage.org/x44p53jyd/10000.gif


I'm running ags 2.72, arena_bg.png is set as background frame 2, my current code looks like this:
Code: AGS
// room script file

/********************************************
* Background                                *
********************************************/

int displayFrame = 1;
int bufferFrame = 2;

int bg_y = 8;
int bg_h = 255; // should be 208
int buf_y = 255;

float bg_speed = 1.0;

float bg_yRipplePhaseScale = 1.0;
float bg_yRippleSize = 0.0;
float bg_yRippleDensity = 3.0;

float bg_xRipplePhaseScale = 1.0;
float bg_xRippleDensity = 0.5;
float bg_xRippleSize = 5.0;

float bg_yPhase = 2.0;
float bg_xPhase = 2.0;

function bg_warp()
{
  float phaseScalar = Maths.Pi/IntToFloat(GetGameSpeed());
  
  bg_yPhase += bg_speed * bg_yRipplePhaseScale * phaseScalar;
  while (bg_yPhase > 2.0 * Maths.Pi) bg_yPhase -= 2.0 * Maths.Pi;
  
  bg_xPhase += bg_speed * bg_xRipplePhaseScale * phaseScalar;
  while (bg_xPhase > 2.0 * Maths.Pi) bg_xPhase -= 2.0 * Maths.Pi;

  float fh = IntToFloat(bg_h);
  
  int i = 0;
  while (i < bg_h)
  {
    float fi = IntToFloat(i);
    float yAngle = (bg_yRippleDensity * (fh - fi)) + bg_yPhase;
    float yoff = bg_yRippleSize * (28.0 / 14.0) * (1.0 + Maths.Sin(yAngle));
    int yoffi = FloatToInt(yoff);
    int yi = i - yoffi;
    if (yi >= 0)
    {
      float xAngle = (bg_xRippleDensity * (fh - fi) ) + bg_xPhase;
      float xoff = bg_xRippleSize * (28.0 / 14.0) * (1.0 + Maths.Sin(xAngle));
      int xoffi = FloatToInt(xoff);

      //an attempt to get the image to scroll
      //if (buf_y - i <= 1) buf_y = 255;
      DynamicSprite *s = DynamicSprite.CreateFromBackground(bufferFrame, xoffi, buf_y - yi, 320 - xoffi, 1);
      RawDrawImageResized(0 + xoffi/2, bg_y + bg_h - i, s.Graphic, 320 - xoffi/2, 1);
      s.Delete();
    }
    i++;
  }
  //an attempt to get the image to scroll
  //buf_y = buf_y - bg_h;
}

#sectionstart room_a  // DO NOT EDIT OR REMOVE THIS LINE
function room_a()
{
  // script for Room: Player enters room (before fadein)
  SetViewport(0, 0);
  SetBackgroundFrame(displayFrame);
}
#sectionend room_a  // DO NOT EDIT OR REMOVE THIS LINE

function repeatedly_execute_always()
{
  bg_warp();
}
#9
Never mind I found out what was going wrong, I was saving in the same script function as loading the mini game so as the save function executes last it was saving in the mini game.
I instead save, fade out and set variable run_game in the interaction script and in repeatedly execute I run the mini game depending on if the variable run_game is > 0 and the room has faded out other wise it is reset to 0.

Thank you for replying anyway and I'll remember to include the relevant code in the future when I need help.
#10
I have a mini game in one of my rooms which when started saves in slot 7 and runs mg3.ags, that works fine.
When I exit mg3.ags it starts the main exe and the main game before the title screen checks for a save game in slot 7 if it exists then it loads it.
But when it tries to load the save game in slot 7 ags crashes and gives me this error:
Error: Restore_Game: Game has changed (inv), unable to restore position

What does this error mean?
I'm running AGS 2.72
#11
I
Quote from: Crimson Wizard on Fri 07/09/2012 14:00:59
The problem here is that at the moment when the driver is being set the program has yet no idea of the game contents. Again, in theory, that would be possible, but... checking all game scripts to know if certain functions are present... hmm... If the graphics driver could be updated to draw 8-bit bitmaps it would be better, I guess.

Well if getting the Direct3D driver to upscale 8bit graphics on the fly isn't possible then when compiling the game it could disable the Direct3D driver if 8bit graphics are used.
#12
Ah right thanks I hadn't realised that I'd not tested it with the Software renderer.
Because when I tested the software renderer the first time, it skipped the videos. To get it to play the videos I had to move the flc files from the compiled folder to the main project folder.
But now the video files are included in the compiled exe which I don't want, is there a different way to tell ags 3 to not pack the flc in with the exe?

Also this might be a stupid question but why can't 8bit flc be displayed in the Direct3D driver by blanking the rest of the pallet?
And if it's not possible at all shouldn't the Direct3D driver be disabled for games that use 8bit only functions like the flic player?
#13
I finally got ags 3.2.1 working on linux with wine so I tried upgrading my project from 2.72 to 3.2.1 but I ran into a problem.
When my flc animations try to play I get, "Error: Mismatched colour depths"
My game is 16bit colour and the flc are 256 but afaik that's the limit for the format.
How can I fix this?
#14
Thank you that fixed it.
#15
I created my own custom gui for saving/loading but when I restore a saved game the save/load gui is still visible.
How can I get it to save but not hide the gui, but when I load the saved game have the gui not visible?

I'm currently saving with:
Code: AGS
function SaveGame(int slot)
{
  String slot_name;
  slot_name = slot_name.Append(RoomName);
  slot_name = slot_name.Append(", ");
  slot_name = slot_name.Append(Progress);
  
  gSaveload.Visible = false;
  gLabel.Visible = false;
  mouse.Mode = old_mouse_mode;
  SaveGameSlot(slot, slot_name);
  if(slot == 1) sl_slot1_label.Text = slot_name;
  if(slot == 2) sl_slot2_label.Text = slot_name;
  if(slot == 3) sl_slot3_label.Text = slot_name;
  if(slot == 4) sl_slot4_label.Text = slot_name;
  if(slot == 5) sl_slot5_label.Text = slot_name;
  if(slot == 6) sl_slot6_label.Text = slot_name;
  gSaveload.Visible = true;
  old_mouse_mode = mouse.Mode;
  mouse.Mode = eModePointer;
}


And loading with:
Code: AGS
function LoadGame(int slot)
{
  RestoreGameSlot(slot);
  gLabel.Visible = false;
  gSaveload.Visible = false;
}
#16
Really it is two problems one the cursor on top of the label and the label disappearing when under the cursor.
I hadn't even considered using a gui for the labels up to now but I'll go through the help file to find the functions I need.
First I'll try to get the labels to always appear when they should with a gui then I'll worry about trying to fake the cursor under the label.

I would move to 3.2.1 but it doesn't work in linux (under wine) none of the 3 series do.

Edit:
I tried to replace my label objects with a gui but when the gui is visible clicking on the exit has no effect, it doesn't change room.
If I set up everything except making the gui visible the exits work.

Code: AGS
function exit_label(int text_sprite, int object_exit, int x_pos, int y_pos)
{
  if (gLabel.Visible == false)
  {
    if (Object.GetAtScreenXY(mouse.x, mouse.y) == object[object_exit])
    {
      gLabel.Clickable = false;
      gLabel.Height = Game.SpriteHeight[text_sprite];
      gLabel.Width = Game.SpriteWidth[text_sprite];
      gLabel.BackgroundGraphic = text_sprite;
      gLabel.SetPosition(x_pos, y_pos-12);
      gLabel.Visible = true;
      Object *o = Object.GetAtScreenXY(mouse.x, mouse.y);
      if (mouse.Mode != eModeWalk && o.GetProperty("WALK_A") == 1)
      {
        old_mouse_mode = mouse.Mode;
        mouse.Mode = eModeWalk;
      }
    }
  }
  if (gLabel.Visible == true && gLabel.BackgroundGraphic == text_sprite)
  {
    if (Object.GetAtScreenXY(mouse.x, mouse.y) != object[object_exit])
    {
      gLabel.Visible = false;
      if (mouse.Mode == eModeWalk) mouse.Mode = old_mouse_mode;
    }
  }
}


And this in the room script:
Code: AGS
function room_d()
{
  // script for Room: Repeatedly execute
  exit_label(99, 1, 256, 123);
}


Edit: The problem I had was that the label gui was set to popup modal, I switched it to normal and it works fine.
#17
Thank you for that, I'll try to implement it later.
I'm using 2.72 is there anything in this code that wouldn't work in that.
#18
No each label is a different object as they are in different positions in relation to the exit hotspot/object and different text depending on where the exit goes too.
If I used a gui for the label and a gui for the cursor, how would that affect the normal mouse functions? (changing mode, graphic etc)
#19
Is it possible for the mouse cursor to go under an object?
I have labels that are visible when the mouse hovers over an exit but at the moment if the cursor goes over the label object when it is visible then the label disappears.
I would like to have the cursor go underneath the label.
#20
Well I want to have a few animated portraits, animated dotted line around item that's under the mouse, the first item in the inventory is a link to the save screen. And when hovering over an item take and look modes should be switch able with the right click like in normal rooms.
This is just an idea as I'm still learning scripting in AGS and just wanted to know if this was an option.
SMF spam blocked by CleanTalk