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

#1
I'm an idiot, I had not idea you could do that in properties with BASS enabled. For what it's worth, Khris' way worked too. Thanks everybody for your help.
#2
Reading through the forums, I've not been able to find a solution for a specific issue I'm having, apologies if I've overlooked anything.

Essentially at the moment, when I left click on an item in the inventory, it becomes the mouse cursor so it can be used on other items. The code for this is as part of the BASS template:

Code: ags
function on_mouse_click(MouseButton button)
{
  if (action != null)
  {
    action.Text = "";
  }

  if (!IsGamePaused() && (button == eMouseLeft || button == eMouseRight))
  {
    do_room_action(button);
  }
  else if (button == eMouseLeftInv || button == eMouseRightInv)
  {
    do_inventory_action(button, inventory[game.inv_activated]);
  }
}

If I replace the else if so it's like so:

Code: ags
else if (button == eMouseLeftInv || button == eMouseRightInv)
  {
     inventory[game.inv_activated].RunInteraction(eModeInteract);
  }

Then that changes it so that whatever event is set to interact for all inventory item runs (and conversely I can no longer have the mouse cursor become the inventory item).

The basic concept is that I have a book which the player can pick up, which the player can then left click on in the inventory bar and it opens up a new room with an object on the screen that functions as a book they can read.

The question I have, is there to set the book inventory item so it's the only inventory item that will run emodeinteract whilst all others will stick to automatically becoming the cursor?
#3
Thanks Khris, I made a similar change in my animation cycle and it worked a charm. Thanks to everybody else who answered too.

Just for anybody else in the future looking for similar guidance, what I done to achieve the effect was crop down each frame that was part of the animation to ensure that it was essentially "tight" e.g the width of the frame was as close as possible to the character's body which as Khris explained essentially prevents any further movement and stops that floating look. I also changed up the frames, doubling up the frames for the step in the view. The extra frame made the step look better and helped emphasise the drag motion on the other leg. Furthermore, turning down the movementspeed in the options for the character and bringing it down to a level I liked to help emphasise that it's a slow limp.

#4
Quote from: Crimson Wizard on Tue 13/02/2024 13:18:53AGS does not have such feature built-in, so this has to be done by scripting a custom movement.

I do not have a ready code example, but my thinking is this:
- save the walk destination (x,y) in global variables, and start the walking;
- in function repeatedly_execute check if the character is walking, and which animation frame it is;
- - if character is walking, and this is a frame where character should pause, then stop walking, and run animation using Animate command (non-blocking)
- - if character is not walking, but a destination is saved, and animation has finished, then order to walk towards destination again.
- when character reaches the destination, reset the global variables (in order to avoid unnecessary walking further).


On a side note, I believe that such feature is worth planning for the future versions of the engine.


This is going to be a bit of a noddy question, but I've not really touched the global variables part of the engine yet, what would be the type & initial value? I'm guessing type is a string and the value is the x,y?

Quote from: Khris on Tue 13/02/2024 14:37:29The limp stopping mid-animation is always an issue but pretty much unavoidable unless you code completely custom walking.

Here's a very quick example of a limping walk-cycle:



Would it be possible to share the code used for that example? I'm trying put together how this all works but I'm not quite connecting it together yet in terms of how I do likewise.
#5
Many thanks for your suggestion. I must apologise however, I think I've phrased it poorly in the initial post. So this is for the main player character for their normal walk in-game rather than for a set animation to be played at some point. With that in mind, is what you suggested still a potential solution? Just thought I'd check as again it's completely my fault!
#6
Hi,

So I've created a walk cycle for a player character who has a limp. As the character walks, the limping leg drags behind him.

The issue I'm having for the character movement is that the character should move forward with the first few frames in the cycle, then remain in position as the rest of cycle plays out and the limping leg catches up. As it is, the character keeps moving forward for the entire cycle, resulting an odd gliding look.

Is there a way to make it so the forward movement only occurs for the relevant frames and that they remain locked in position for the rest of the walk cycle?
#7
Many thanks both for your help on this, glad to say I've successfully managed to implement the double click now into the game thanks to you.

Just in case this might prove useful to anybody in the future who searches for this, here's a quick guide on how to implement using all the fantastic steps provided by others above (please note this has only been tested with the configuration listed in initial post active)

Step 1: a) Choose one Cursor mode and rename it to "DoubleClk" or else what you think is appropriate.
b) Now for every hotspot that would support double click you may create a event function for this custom event "DoubleClk".

Step 2:You need to edit line 163 (or wherever function on_mouse_click is) in the Global Script so it looks like below. I know that the note says all clicks handled by TwoClickHandler script, but ignore that.

Code: ags
// called when a mouse button is clicked
function on_mouse_click(MouseButton button)
{
  {  
  if (DoubleClick.Event[eMouseLeft])
    {
    LocationType loc = GetLocationType(mouse.x, mouse.y);
    if (loc == eLocationHotspot)
      {
        Hotspot *h = Hotspot.GetAtScreenXY(mouse.x, mouse.y);
        h.RunInteraction(eModeDoubleClk);
      }
    }
  }
  // all clicks handled by TwoClickHandler script
}

Step 3:The TwoClickHandler script has an automatic script to run on a left (interact) or right (look) click on a hotspot. If you're planning on having invisible hotspots (e.g. a PC is walking through the woods rather than a door) then to get rid of the automatic interact/like dialogue, click on the hospot any for each event (interact & look at events) enter the following code:

Code: ags
function QuickExit_Interact() //Quickexit is name of my hotspot, change it to whatever you've called hotspot
{
 Display("");
}

Code: ags
function QuickExit_Look()
{
 Display("");
}

This will mean that the PC won't interact with hotspots and only a double-click on side of screen where hotspot is will automatically transport them to new room. Hope that helps!

#8
Many thanks for your response.  To answer your first question, I can write a script to leave the room once the PC walks into the designated edge e.g. going to the right edge leads to X room, what I'm not certain on is how to write a script for a hotspot so a double click immediately changes room so they don't have to wait for the PC to walk over. Apologies, I do have some basic follow-up questions.

I've followed step one and renamed the cursor, and I've called the hotspot QuickExit. So going to set up the event, and it takes me to the room script which is below:

Code: ags
function QuickExit_Mode8()
{

}

So my questions are:

1) Where should the code you have provided be going? In the Room script, Global Script DoubleClick script, or TwoClick script?

2) What kind of code should I be inputting in the above function being created so a double click now takes me straight away to a different room? Is it just your regular change room script or is it something else?


Many thanks for your patience.
#9
Hi,

I'm using AGS 3.6.0 (latest patch), BASS, and Double Click V 1.0 module.

I'm trying to figure out how to script an immediate (or at least as close as one can get) change room when I double click on either a hotspot or an edge.

Seen this done in a few modern games using the engine, but for the life of me unable to figure it out and not been able find any posts on how to programme it with my configuration.

Any help is tremendously appreciated.
SMF spam blocked by CleanTalk