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

Topics - Laura Hunt

#41
Not sure if this would qualify as a "beginner question", given that other issues I've had turned out to be in fact quite advanced, but let's give this a try!

Rather than having an inventory for the game I'm working on, I would like to implement a "pick up object - use it on something else" system.

For example, say there's an empty glass on a table. If the player clicks on the object, the character will walk up to it (still not scripted in the example below) and the cursor will turn into the sprite of the glass while at the same time the object/sprite on the table is disabled:

Code: ags
function oGlass_Interact()
{
  player.AddInventory(iGlass);
  player.ActiveInventory = iGlass;
  oGlass.Visible = false;
  mouse.Mode = eModeUseinv;
}



Now with the glass as active inventory item / cursor, the player can use it on a hotspot on the wall and overhear a conversation.

So far, so good. Everything works as it should, except that when I hit right-click in order to deselect/release the active inventory item, I would like for the object to reappear in its original position.

The only way I have come up to do this would be to do a check for every single inventory item in the game to see which one the player is carrying and make the corresponding object visible. This code does the job nicely:

Code: ags
if (mouse.Mode == eModeUseinv && button == eMouseRight) {
  if (player.ActiveInventory == iGlass) object[0].Visible = true;
  // etc etc etc for every single inventory item!!
  player.ActiveInventory = null;
  }


However, this only seems like a good idea because my game will have a very small number of items, but it doesn't seem like the most elegant or resource-optimized way to do this. Any suggestions for alternatives?
#42




Yay I did it!! My very first AGS game, and I even finished it sooner than I thought  ;-D

Like the tag says, it's "A first-person, sort-of-escape-the-room, point-and-click adventure dealing with grief, trauma and depression, and how they can take us to a place that's very hard to come back from."

At first this was meant just as a practice ground of sorts, my own little sandbox to experiment and learn the basics in, rather than something meant to be shared or seen by others. But as I learned more and more stuff, I realized that I actually liked this story a lot and thought it was worth creating a full game out of it. Or at least something with a beginning, middle and ending, rather than a bunch of rooms with stuff to click on  :-D

Still, even for a point-and-click adventure there's not much in the way of gameplay except for one "proper" puzzle, so the focus is mostly on the story/narrative/experience/mood. The inventory gets very little use but I wanted to have the functionality anyway, and if I'm being honest, the one central riddle I ended up including feels a bit tacked on just for the sake of having a puzzle, but again, I just wanted to have something a bit more complex than "game starts, click on everything, read everything, end".

So yeah, despite not being much of a "game", I do hope that at least the writing, story and music are enjoyable! In particular, creating music for a game for the first time has been a super interesting experience, as it really forced me to think in a totally different way to what I'm used to as an amateur producer-slash-musician, mostly thinking in terms of loops rather than fully-fledged compositions. I really want to do more of this  (nod)

Special mention to Khris, Snarky and Crimson Wizard for all their help! I would be so lost without you guys as well as, of course, everybody else who ever stepped in to give some advice. Cheers!

#43
Hi all,

I'm running into an issue that's driving me crazy.

I've defined a global Audiochannel* pointer called "musicchannel". The "Music" type is set to just 1 channel max and no crossfade. I have the following code that gets triggered when the player hits "Start game" in my start menu:

Code: ags
musicchannel = aIntro.Play(eAudioPriorityNormal, eOnce);
musicchannel = aSoundtrack1.PlayQueued(eAudioPriorityNormal, eRepeat);


(Both aIntro and aSoundtrack1 are defined as type "Music")

This works perfectly, the intro plays once and then the actual soundtrack starts playing in a loop. However, when I get to a room where the music has to stop (using musicchannel.Stop() in the room_Load function), I get an NPE. But it doesn't make any sense because musicchannel is playing something!

However, if I don't use the intro and just play the main soundtrack directly (musicchannel = aSoundtrack1.Play(eAudioPriorityNormal, eRepeat)), then I don't get this issue. The music stops just as it should.

So the only difference between both scenarios is that I get the NPE only when I queue the second track after the intro. What is happening here then? When I queue a track it gets assigned a separate channel even though I've explicitely told AGS to play it in "musicchannel" and even though in theory there can only be 1 channel playing a "Music" file?

If this is the case, then I guess I can always use Game.StopAudio(Music) to stop the soundtrack, since I'm never going to have two music tracks playing simultaneously, but it bums me that AGS doesn't respect my channel assignment.

Any help would be greatly appreciated, as always!

#44
Hi all,

I have a couple of very simple questions so I thought I'd lump them both together in one post, hope that's ok:

1) I'm using the Display function to display messages on screen, but this blocks background animations. Is there a way around this?

2) My game has only one action and two cursors, "neutral/no action" and "interact". I want the cursor to change from an arrow to a hand when it's over a hotspot or object, so I used this code in repeteadly_execute which I believe was contributed by Khris and uses a custom property called def_curs:

Code: ags

  int mm = mouse.Mode;
  int nm;     // new mode
  Hotspot*h;
  Object*o;
  int lt = GetLocationType(mouse.x, mouse.y);   // what's under the cursor?

  if (mm != eModeUseinv) {
    if (lt == eLocationNothing) nm = eModeLookat;
    if (lt == eLocationHotspot) {
      h = Hotspot.GetAtScreenXY(mouse.x, mouse.y);
      nm = h.GetProperty("def_curs");
    }
    if (lt == eLocationObject) {
      o = Object.GetAtScreenXY(mouse.x, mouse.y);
      nm = o.GetProperty("def_curs");
    }
    if (lt == eLocationCharacter) {
      nm = eModeTalkto;
    }

    if (nm != mm) mouse.Mode = nm;  // only change if necessary to not disturb animated cursors


However, I find that this much simpler version also works for me:

Code: ags

    
  int mm = mouse.Mode;
  int nm;     // new mode
  int lt = GetLocationType(mouse.x, mouse.y);   // what's under the cursor?

  if (mm != eModeUseinv) {
    if (lt == eLocationNothing) nm = eModeLookat;
    if (lt == eLocationHotspot || lt == eLocationObject) nm = eModeInteract;
    if (nm != mm) mouse.Mode = nm;  // only change if necessary to not disturb animated cursors



So this is question is more about curiosity, really. What is the purpose of using a custom property in the original code? Are there other situations, more complex than my scenario, in which it would be necessary?

Thanks a lot in advance!
#45
Hi everybody, total newbie here :smiley: I'm creating my first game in AGS, a first-person point-and-click adventure, and thanks to these amazing forums and the manual I already have a lot of basic stuff down, such as cursor changes, using inventory items etc. But now I'm completely stumped and I can't find anything in the forums that applies to my problem.

At a certain point I want the player to be able to click on a cellphone that's lying around and for this to trigger a scripted SMS/Whatsapp conversation, the kind where each participant's text is on each side of the screen and the text is contained inside speech bubbles or simply rounded rectangles.

Since the conversation is completely scripted, I don't need to complicate things for now with different dialog options and such (phew!).

The thing is, I'm completely stumped as to how to do this. Functions such as Display or Say would allow me to use a custom text window for the "speech bubble" background, but the problem is that these functions can only display one message on screen at a time, and of course, I want the whole conversation to be progressively displayed on the screen message by message, the same way you would see it on your phone.

Another option I thought about was creating a GUI with labels that are initially invisible and appear one by one after a short delay, but labels can't use custom text windows (as far as I know!), so I wouldn't be able to customize them as speech bubbles. So while it would work from a technical standpoint, I would sacrifice the "chat" look and feel.

I'm starting to fear that the solution is necessarily going to imply doing stuff with overlays, drawing surfaces, and/or dynamic sprites, but the thought is really intimidating, since I've never used any of that and I have no idea how it works. But if it's inevitable, I'd truly welcome a nudge or two in the right direction.

Any help would be dearly appreciated!
SMF spam blocked by CleanTalk