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 - Khris

#121
I'm pretty sure I found a fix, but it seems the issue is a combination of a scripting and an engine issue.

The first thing I noticed is that after winning the fight, you can still hear the enemy say "ow" even though they're no longer on screen.
Next I turned on the frame counter using Debug(4, 1); and saw that the game keeps running instead of resetting. It's hanging in the sense that it doesn't react to any input, but the frame counter keeps on trucking.

So what seems to happen is:
1) you reduce the enemy's HP to 0
2) repeatedly_execute_always calls the EndCombat() function which sends the NPC to the other room
3) RestartGame() is called, queuing the loading of savegame 999
4) EndCombat ends and AGS now runs the "if (enemyHurt)" block of repeatedly_execute_always (it shouldn't, that's the script issue)
5) the character's getting hit animation plays, triggering the "ow" sound, then they're locked to the first frame of their AttackView, but since the NPC is in another room, we don't actually see the character
6) the game hangs

You can either fix this by not sending the NPC to the other room (set their .Transparency to 100 instead) or by addressing #4, i.e. turning the "if"s into "else if"s.

Still, animating / view frame locking an NPC in another room before queuing a reset a) shouldn't actually play the animation b) shouldn't move the game into a dead state. So there seems to be an engine issue here, too.
#122
@yodabear

Afaik Win 11 shows this box whenever you try to open *any* unsigned exe file. AGS games (and tons of other hobbyist / indie games) are pretty much never signed because nobody bothers to go through the trouble.

Just click on "More Info" then on "Run anyway". In the next box, uncheck "Always ask before opening this file" and click "Run".

It's fine, I'm doing this multiple times a day and have been for years.
#123
Zip the game folder so it's only one file (on Win 11, right-click the game folder and select "Compress to..." -> ZIP file).

Next, upload the resulting zip file somewhere. An easy way without signing up is mediafire: https://www.mediafire.com/
You can also use Google Drive, OneDrive, iCloud, Dropbox etc; you only need to make sure that in the sharing settings you set the option that anybody with the link can download the file.

Finally, paste the link here.
#124
Did a quick test using the same AGS version:

Breakpoints don't cause "Not responding" for me, instead the editor is focused and shows the breakpoint line marked in yellow. I can now step into the script or let it run again.

Sending an NPC to room 0 had no effect; the game just keeps running normally.

RestartGame() works as expected.

Not sure what could be causing this. @EmmaGundersen If you are curious and don't mind putting the source code online, feel tree to do just that and link us to it.
#125
Is it possible their hard drive is full to the brim? Or do the students store their games on flash drives? Maybe they pull out the drive without safely removing it first?

The spriteset file is one of the biggest files in a game, so either explanation seems plausible to me.

Do they bring their own laptops? Or use school owned devices?

Anyway, it's almost certainly either a) a hardware issue with the specific device or b) user error.
#126
2 is an easy fix: you passed -1, so the WaitInput() command blocks script execution and therefore repeatedly_execute / room_RepExec.
Use this instead:

Code: ags
  // after intro has played
  if (WaitInput(eInputKeyboard + eInputMouse, 120) == 0) { // ended by timeout
    // non-blocking animation goes here
    WaitInput(eInputKeyboard + eInputMouse, -1);
  }

If the player does nothing, this will wait for 3 seconds, play the animation, then pause the script until input.
If the player clicks / types during the first 3 seconds, it will skip the animation and the indefinite wait.

Regarding 1, you need to detect the region events yourself. This can be done using repeatedly_execute_always and a variable:

Code: ags
void EnterRegion(int id) {
  if (id == 2) {
    if (diabloProteccion == 0)
    {
      aHumming.Play(eAudioPriorityNormal, eRepeat);
    }
  }
}

void LeaveRegion(int id) {
  if (id == 2) {
    if (haloProtege == 1)
    {
      tiempoHalo = 0;
      aHumming.Stop();
    }
  }
}

Region* prevRegion;

function repeatedly_execute_always() {
  Region* currRegion = Region.GetAtRoomXY(player.x, player.y);
  if (currRegion != prevRegion) {
    // player's region changed
    if (prevRegion.ID > 0) LeaveRegion(prevRegion.ID);
    if (currRegion.ID > 0) EnterRegion(currRegion.ID);
  }
  prevRegion = currRegion;
}
#127
I assume you're seeing the "You won!" message and can click it away? What exactly happens next? Does the game freeze at that exact point? I.e. can you still see the current room? Or does it fade out then freeze?
#128
General Discussion / Re: What to do?
Mon 20/01/2025 09:56:31
You can also watch somebody else playing, this streamer is a favorite of mine and sometimes she draws instead.
https://www.twitch.tv/39daph
#129
Not sure what's causing the first issue but the cursor one is an easy fix: check the sprites you have set for your mouse cursors and you should probably do
  Mouse.Mode = eModeInteract;
in game_start and remove the on_mouse_click parts that switch cursors.
#130
Characters have a setting called AnimationDelay; this number specifies how many frames each walk cycle frame is displayed on screen.
If MovementLinkedToAnimation is true, the character only moves when AGS switches to the next walk cycle frame, which means that an AnimationDelay of 4 causes the character to only move every 4th frame, as opposed to every frame. This means that walking is 4 times slower than movement.

A perfect solution to this discrepancy requires you to 1) have a distinct walk cycle frame for each game frame (i.e. four or five times as many frames for each direction), 2) reducing the AnimationDelay to 1 (or 0?), and reducing the MovementSpeed to 1 (i.e. the number of pixels the character moves per walk cycle frame).
This is only feasible for high-res games though, and obviously a lot of extra work, unless you let Blender render your walk cycle frames or something.
#131
General Discussion / Re: AGS user TheTMD
Fri 17/01/2025 14:31:09
You're right, he was simply linking to the other person's game, sorry :-D  :-[
#132
General Discussion / Re: AGS user TheTMD
Fri 17/01/2025 13:00:46
He's active on Twitter: https://x.com/3DdotBastard
The last post is from 14 hours ago.
#133
Try putting
Game.Camera.Y = 0;
in room_Load()
#134
If this won't work as desired, here's an extender function you can use:

Code: ags
void Move2(this Character*, int x, int y, float pixels_per_second) {
  // this always uses eBlock, eAnywhere
  float pixels_per_frame = pixels_per_second / IntToFloat(GetGameSpeed());
  float dx = IntToFloat(x - this.x);
  float dy = IntToFloat(y - this.y);
  float f = pixels_per_frame / Maths.Sqrt(dx * dx + dy * dy);
  dx *= f;
  dy *= f;
  int steps = FloatToInt(1.0 / f, eRoundNearest);
  float cx = IntToFloat(this.x);
  float cy = IntToFloat(this.y);
  for (int i = 0; i < steps; i++) {
    cx += dx;
    cy += dy;
    this.x = FloatToInt(cx, eRoundNearest);
    this.y = FloatToInt(cy, eRoundNearest);
    Wait(1);
  }
  this.x = x;
  this.y = y;
}

Just do
Code: ags
  player.Move2(1925, 315, 33.3); // moves from a to b at 33.3 pixels per second 
#136
Moving a marble from point1 to point2 within a groove means it moves from angle1 to angle2.
A screenshot / the room background would be a big help with regard to providing the best approach.
#137
I just looked at the panel ratings of my own games and they are all spot on :-D

@lapsking: Chill, the main point of the ratings is to convey whether a game is worth the effort of downloading and playing it or not. Both your games have been deemed worthy. In no way is the rating telling you that all the effort you put in your second game was a waste of time, that's only happening in your head.

Anybody who plays both games will clearly see how much more work and polish went into the 2nd one, so why do you care that much about the cup rating?
#138
Moving an object along a circle is done by changing the angle and using sine and cosine to calculate the coordinates.

pseudo code:
  object.x = Maths.Cos(angle) * radius;
  object.y = Maths.Sin(angle) * radius;


An angle of zero produces the coordinates (radius, 0) i.e. exactly east of the center of the circle.
As the angle increases, the x coordinate goes down to 0 while the y coordinate increases towards the radius. I.e. at an angle of 90° the object is now directly south of the center.
#139
Right; I misread the original post and was wondering about the weird requirements but it does make sense now.
Your solution is correct; you need to completely skip the built-in walking.

Minor rewrite suggestion:
Code: ags
function repeatedly_execute()
{
  int speed = 2;
  // Direct position changes based on keyboard input
  cEgo.x += (IsKeyPressed(eKeyRightArrow) - IsKeyPressed(eKeyLeftArrow)) * speed;
  cEgo.y += (IsKeyPressed(eKeyDownArrow) - IsKeyPressed(eKeyUpArrow)) * speed;
}

Btw, this implementation means the character will move ~ 1.5x faster when moving diagonally.
This can be fixed by using floats for the position:

Code: ags
float egox, egoy;
function repeatedly_execute()
{
  float speed = 2.2;
  // Direct position changes based on keyboard input
  float dx = IntToFloat(IsKeyPressed(eKeyRightArrow) - IsKeyPressed(eKeyLeftArrow));
  float dy = IntToFloat(IsKeyPressed(eKeyDownArrow) - IsKeyPressed(eKeyUpArrow));
  if (dx != 0.0 && dy != 0.0) speed *= 0.7071;
  egox += dx * speed;
  egoy += dy * speed;
  cEgo.x = FloatToInt(egox, eRoundNearest);
  cEgo.y = FloatToInt(egoy, eRoundNearest);
}
#140
AGS is primarily a free tool to build adventure games, not a programming language. It's amazing that the script language is as powerful as it is, and AGS4 will make the compiler even better in a lot of ways.
Ten years ago, AGS was absolutely peerless in what it could do scripting-wise; the alternatives back then were dogshit.

What exactly is the expected answer when one asks why the compiler doesn't support feature X yet?
Why would one say "feature X should be available"? Why should it be available? Because you paid $0 for the product?
I will never understand this mindset. Especially if it's a "problem" that is extremely easy to work around.
SMF spam blocked by CleanTalk