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

#321
It sounds like you're describing a launcher?
Since an AGS game is just an .exe file (in the context of a launcher) this is not really a question about AGS, more one about creating a Win32 GUI app with a "run exe" button I guess.

Edit:
Creating a 2nd AGS game with sprites and GUIs to launch the actual game so you don't have to include the launcher resources into the main game sounds like bollocks to me so has to be a translation issue.
#322
If the first line is inside the function then flipped ceases to exist when the function finishes.
It's news to me that AGS keeps a reference to the original sprite and falls back to it but maybe that's how it works internally.

Anyway, the solution is to add
Code: ags
DynamicSprite* flipped;
above the function, then do
Code: ags
  flipped = DynamicSprite.CreateFromExistingSprite(tileIdNorm,  true);
inside.
#323
Open GlobalScript.asc and find/add this:
Code: ags
function repeatedly_execute_always()
{
...
}

Put this inside:
Code: ags
  if (gInvbar.Visible && gRaiseArrow.Visible) gRaiseArrow.Visible = false;
#324
Not that I know of, you have to rely on the comments in the Global Script's game_start function and the existing function calls afaik. It's just a different way of clicking stuff with four separate cursor modes though, so not really to complicated to set up.

To find the solution to your issue I
1) looked at the list of functions and found place_button
2) right-clicked the radius variable and clicked "Go to Definition of radius"
3) found line 14 and right-clicked the constant, then clicked on "Go to Definition of VERBCOIN_DEFAULT_RADIUS"
4) based on the place_button code assumed that increasing the value would fix the problem
#325
It is a good first word though :)

Wordle 562 4/6

🟩🟨⬜🟩⬜
🟩⬜⬜🟩🟩
🟩⬜🟩🟩🟩
🟩🟩🟩🟩🟩

Spoiler
STARE
SPORT
SHIRT
SKIRT
[close]
#326
Wordle 561 3/6

⬜⬜⬜⬜🟩
⬜⬜⬜⬜🟩
🟩🟩🟩🟩🟩

Spoiler
STARE
POGUE
WHINE
[close]
#327
First of all, if you're just starting with the game, consider changing the resolution to 640x360. This will nicely scale up to all common HD resolutions because it's 16:9 and exactly a third of 1920x1080.

As for the buttons: open the VerbCoin script header (VerbCoin.ash) and look at line 2:
Code: ags
#define VERBCOIN_DEFAULT_RADIUS 38
Try changing the number to a bigger one.

If that doesn't help, open the main script (VerbCoin.asc) and look at the place_button function (line 170). In there the module calculates the button positions.

Also, when you changed the resolution to 640x400, the editor asked you whether you want to resize the GUIs accordingly. Did you confirm this or no? Because the GUIs and GUI sprites are all made for a lowres game, and you probably have to do a bunch of adjustments to the GUIs even when you confirm the resizing.
#329
Afaik objects and characters cannot be created dynamically, no. A dynamic sprite is just a bunch of pixels, it doesn't have a position for instance. That's why a sprite collision usually only makes sense in the context of assigning the sprite to an object or character.

One way to solve this is to create you own entity instance, an array of struct based objects that have a sprite and a position. Now you can get the surface of the sprite and iterate over its pixels, then add the position and collide the result with another entity.
In a 2.5D Iso game you usually only need to collide the footprint, and it gets even simpler if you only need circle vs. circle or circle vs. line.

Re the pathfinder: no, you cannot customize the algorithm in any way. However direct character control doesn't require pathfinding at all; the character will simply move in a direction until they hit something.
AGS supports this by providing a Character.WalkStraight() function. Keyboard modules usually send off the character like player.WalkStraight(player.x + 10000, player.y);
#330
Yes, music1 is an AudioChannel* pointer. If it's not pointing at null but an actual AudioChannel, you can now read (or set) the properties of this channel by referring to music1.

So if music1 isn't pointing at null, music1.PlayingClip can safely be accessed. It in turn is an AudioClip* pointer. It can also point to null though, if the AudioChannel isn't playing anything currently. So now we need to check for music1.PlayingClip not being a null pointer.

If music1.PlayingClip isn't pointing at null, we can now safely access music1.PlayingClip.ID.

You could do the check the long way like this:

Code: ags
  if (music1 != null) {
    AudioClip* clip = music1.PlayingClip;
    if (clip != null) {
      int id = clip.ID;
      // compare id, etc.
    }
  }
#331
No need to worry, it was supposed to be a lame joke about combining a hook and a rope into a grappling hook. :P

Also: I still don't understand what the code you're trying to simplify does. You posted
QuoteThe function is a basic interactive function, not using an item on something, so I can understand that ActiveInventory would work as I've made switch statements such as that in the past. It was only to check if the player had certain items then the other character would respond without having to type long lines with "if" and "else" statements.
but I have no idea what "a basic interactive function, not using an item on something" is supposed to mean or how to understand the inherent contradiction of "It was only to check if the player had certain items then the other character would respond" which again mixes the two concepts of merely possessing an item and using it on a character.

Why not simply post an example of old code so we can suggest possible improvements?
#332
Yes, the error here means that music1.PlayingClip is null.

In general, if you need to read a.b.c.d, you usually need to do if (a != null && a.b != null && a.b.c != null) first.

However in this specific case you should be able to get away with testing if Music != music.PlayingClip, which should work just like the ID comparison but makes checking for music.PlayingClip not being null first unnecessary.
#333
Wordle 554 3/6

⬜🟨🟨🟩🟨
⬜🟨🟨🟩🟨
🟩🟩🟩🟩🟩

Spoiler
STARE
HEART (stupid guess because of the A, but it narrowed things down)
EXTRA
[close]
Took me way too long to guess the 3rd row :)
#334
Glad you fixed it!
I can also reproduce this issue now; I added a new exit and the same thing happened for me. The existing exit still works without the fix though.

The reason was that I still had the code from your first post in my game, so clicking my exit happened with a cursor changed to eModeWalkTo.  :P
#335
Yes, that's what I tried and it worked. As it should I believe, because my code changes the internally used action, which is the one that is checked when you click on an exit. I don't know why it doesn't work for you.

Here's my VerbGUI.asc: https://pastebin.com/wFYFx9hz
Try replacing yours with mine, that's the only thing I can think of.
#336
Wordle 551 4/6

⬜⬜⬜⬜🟨
🟨🟨⬜⬜⬜
🟨🟨🟨🟨⬜
🟩🟩🟩🟩🟩

 :P

Spoiler
STARE
CLOUD
LEECH
EXCEL
[close]
#337
I'm afraid I can't reproduce this: I opened the game where I tested the above code and gave it a try and leaving the room via clicking the hotspot did work for me fine, both for Use and Give.
Not sure what's different with your game.
#338
First of all: it's called "int", short for "integer", which means "whole number" ;)
Second of all: Character.HasInventory() expects an InventoryItem*, not an int. This is why you're getting the error you mentioned.

As for the actual issue of making your code shorter: I'm still not sure if you're writing code for the something_Useinv function which is supposed to give different replies based on which item was used (because it feels like this is what you're trying to do based on the code) or whether you want "to check if the player had certain items before proceeding", because that's not something you'd use a switch statement for at all, and you'd also not check items individually I guess?

Anyways, here's how to do the first thing:
Code: ags
  switch (player.ActiveInventory) {
  case iKey:
    player.Say("It's the wrong key.");
    break;
  case iGoldenkey:
    player.Say("It's the wrong key.");
    break;
  case iSilverkey:
    player.Say("The door unlocks with a satisfying click.");
    break;
  default:
    player.Say("I need a key here.");
  }

The other thing works very differently:
Code: ags
  if (player.HasInventory(iRope) && player.HasInventory(iHook) && player.HasInventory(iInsurancePolicy)) {
    // ...
  }
  else {
    // ...
  }
#339
I'm sorry, this is going to require a deep dive into the Tumbleweed template I'm afraid and I don't really have the time currently to do that.

If this is going to be an essential mechanic in your game you might want to change the GUI anyway, for instance using an inventory system where you're basically equipping items (using a slot for each hand).
#340
Neither AGS nor the Tumbleweed template supports this out of the box.

If combining x and y first doesn't make sense it's going to get complicated. You would have to create an additional global .ActiveInventory item pointer and set it in the handler of using X on Y / Y on X. Next you have to adjust the function that updates the action text, this is relatively simple though: check if the second inventory item isn't null and compose the text from there.

Also, Danvzare's 3rd option sounds like a good workaround for this.
SMF spam blocked by CleanTalk