Show Posts

You can view here all posts made by this member. Note that you can only see posts made in areas to which you currently have access.

Messages - Khris

Pages: [1] 2 3 ... 528
I'd get a custom mouse where the hardware buttons are switched. Or just open one up and do it yourself.

Alright, I managed to put together a workaround. It's not exactly pretty, but I don't see any other option.

Code: Adventure Game Studio
  1. // global header
  2. import void afi();
  4. // global script
  5. void afi() {
  6.   SaveGameSlot(1, "reset");
  7.   SetTimer(1, 1);
  8. }
  10.   // add to repeatedly_execute
  11.   if (IsTimerExpired(1)) CallRoomScript(1);

In your room script:
Code: Adventure Game Studio
  1. function room_AfterFadeIn() {
  2.   afi();
  3. }
  5. // actual after fadein code
  6. void on_call(int p) {
  7.   player.Say("Room1 after fadein");  
  8. }
(You obviously need to use a different timer / on_call index if you're already using 1.)

Instead of your AfterFadein lines, the game schedules a save and sets a timer. This 1 frame idling triggers the saving to slot #1, and right afterwards, the game calls the room's on_call(1), which runs the lines previously in AfterFadein.

Yes. The basic idea is to use repeatedly_execute() to check GetLocationType(mouse.x, mouse.y) != eLocationNothing and switch the cursor graphic accordingly.

Wouldn't it be possible to fake the eSpeechTextOnly setting and set the volume of Channel #0 to the lowest value, i.e. mute it?

There's a noticeable difference, but it would still be better to post PNGs instead (lossless compression, no artifacts). It's always a good idea to use PNGs over JPGs, but it's kind of crucial when it's all about rendering quality ;)

Disregarding the bad quality of the screenshot, the AA version looks perfectly fine to me.

Anyway, yes it was an editor bug where it didn't come up autolmatically :P
The script editor doesn't always 100% recognize new pointers/variables while typing, so occasionally you have to blur and refocus the script window for autocomplete to work. But in that case the window doesn't show up at all. Are you saying you got an autocomplete window with all the properties and functions except for IsInteractionAvailable()...?

Just to confirm this: it exists. It pops up in auto-complete just fine. It compiles fine. (since AGS 3.4.0)

Characters are drawn back to front, based on their baseline. When two Characters have the same baseline, the result is arbitrary - possibly based on the character's ID (since the sorting algorithm doesn't have anything else to go on).
Like others have pointed out, a fixed baseline makes no sense for Characters in 99% of cases, that's why there's no property in the editor.

One way to ensure proper drawing in your case is to reduce the walkable area; it shouldn't cover the entire ground anyway since a character's feet extend beyond her pivot pixel.
If that's not enough for some reason, another way to fix this is to move the character position up by for instance 5 pixels, then change their .z to a negative value like -5 (again in script). That way the sorting uses the lower Y coordinate but the character is still drawn at the same spot.

Just re the candlelight code:
1. if the player picks up one of these items, then uses (and loses) it elsewhere, it will appear back in the room (unless that's what you want, of course)
2. distance in a 2D coordinate system:
Code: Adventure Game Studio
  1.   float dx = IntToFloat(mouse.x - Obj.X), dy = IntToFloat(mouse.y - Obj.Y);
  2.   int dist = FloatToInt(Math.Sqrt(dx * dx + dy * dy), eRoundNearest);
  3.   int trans = (dist <= 100) * dist + (dist > 100) * 100; // the multiplication casts the bools to 1 or 0

It sounds like all you need to do is disable manual saving and simply call SaveGameSlot(1); in on_event/eEventBeforeFadein. This way the one savegame always contains the current room's initial state and there's no need to reset anything in the first place. This should solve all three points.

The only way to get a division by zero is if the player and enemy have the same coordinates exactly.
Code: Adventure Game Studio
  1.   float l = Math.sqrt(dx * dx + dy * dy);
insert this:
Code: Adventure Game Studio
  1.   if (l == 0) return true;

It's simpler to do this with math. Afaik you already have a distance check implemented, so all that's left is the angle.
If you have the enemy's line of sight as degree int angle, you can get the normalized vector like this:
Code: Adventure Game Studio
  1.   float af = Maths.DegreesToRadians(IntToFloat(angle));
  2.   float ex = Math.Cos(af), ey = Math.Sin(af);
The vector towards the player is again
Code: Adventure Game Studio
  1.   float x = IntToFloat(enemy.x), y = IntToFloat(enemy.y);
  2.   float dx = IntToFloat(player.x - enemy.x);
  3.   float dy = IntToFloat(player.y - enemy.y);
  4.   // normalize vector
  5.   float l = Math.sqrt(dx * dx + dy * dy);
  6.   dx /= l;
  7.   dy /= l;
You can now calculate the dot product:
Code: Adventure Game Studio
  1.   float dot = dx * ex + dy * ey;
If the two vectors point in the same direction, this product is exactly 1. If they point 90 degrees apart, it's 0. In other words, all you need to check is if (dot > 0.5) and the player is inside the cone. Use a value closer to 1 for a narrower cone.

However I'm guessing you also want to display the cones for the player to see? You can for instance draw them on a semi-transparent, not clickable GUI, again using some Math and DrawTriangle()

Was a typo:

Code: Adventure Game Studio
  1.     float l = Math.sqrt(dx * dx + dy * dy);

Ok, so pixel-based? In that case you need to "walk" along the line from enemy to player and check every (or every other) pixel for being a wall, using a loop. Something like
Code: Adventure Game Studio
  1. bool SightBlocked(float fx, float fy) {
  2.   int x = FloatToInt(fx, eRoundNearest);
  3.   int y = FloatToInt(fy, eRoundNearest);
  4.   // check if room pixel x, y is blocking
  5.   return GetLocationType(x - GetViewportX(), y - GetViewportY()) == eLocationObject;
  6. }
  8. bool IsVisibleTo(this* Character, Character* enemy) {
  9.   float x = IntToFloat(enemy.x), y = IntToFloat(enemy.y);
  10.   float dx = IntToFloat(this.x - enemy.x);
  11.   float dy = IntToFloat(this.y - enemy.y);
  12.   float l = Math.sqrt(dx * dx + dy * dy);
  13.   // check every 2 pixels
  14.   dx /= l / 2.0;
  15.   dy /= l / 2.0;
  16.   int steps = FloatToInt(l / 2.0, eRoundDown);
  17.   for (int i = 0; i < steps; i++) {
  18.     x += dx; y += dy;
  19.     if (SightBlocked(x, y)) return false;
  20.   }
  21.   return true;
  22. }

Now you can use
Code: Adventure Game Studio
  1.   if (player.IsVisibleTo(cPatrol1)) ...

There's no one answer to this question. What exactly do you mean by "near complex"? What are you using for walls?
Turn-based often also means grid-based, which means walls are along grid lines. According LoS algorithms are all over the internet.

Did you check the Scripting -> Multimedia section of the manual?

If you use a single color for transparency, you can tell AGS which corner to grab it from during importing the sprite.
Or you use alpha transparency, in which case the image needs to be saved as PNG, with an alpha channel.

What's google paint? I googled it but didn't find anything besides some Chrome apps.

Usually, when a game crashes, you're presented with an error message... why not go ahead and paste that into your post, verbatim?

Advanced Technical Forum / Re: Flat Shaded 3D models
« on: 01 Jun 2018, 12:49 »
Yeah, you need to turn the mouse coordinates into 3D camera screen coordinates, unproject them into the world, then intersect the line camera-mouse with all triangles. Then find the closest one of all that get hit.

Advanced Technical Forum / Re: Flat Shaded 3D models
« on: 31 May 2018, 21:16 »
It's bugged (no visibility check, perspective is weird, and rotating camera opposite way around makes triangles appear all over the screen).
You can solve the 1st and 3rd issue with frustum culling, btw. Welcome to hell ;)

Pages: [1] 2 3 ... 528