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

#41
Hi folks,

I'd like to figure out (if possible) how to variate characters' speech views so that the player won't see the exact same animation every time they talk.

For example, in a game like CMI, you'll notice that the characters' heads bob and mouths move in a different pattern for each line, even if you repeat the same line of dialogue over and over. This small detail helps to break up the monotony and add pleasing variety to the talking portions of the game.

So how can something like this be achieved in AGS?

I was thinking maybe you could randomize which frame of a long speech view to start with each time a character speaks, but the SpeechView function doesn't have a parameter for the starting frame. I know that the Animate function does, but is that what we'd want to use here?


Getting even more advanced than that, there are also different animations depending on the mood of the dialogue. For instance, the character might be shocked, their eyes wide and arms outstretched, or angry, with a furrowed brow and hands on their hips. And these animations too appear to be varied in their patterns. I'd love to be able to look under the hood and see how they went about doing all of this back then.

But can these things also be done in AGS? I reckon it'll take a significant number of views to animate, but I'm up for it if the results can be as desired.

Thoughts?
#42
Thanks for the suggestions, guys!

Khris, your method did the trick. I also added the cEgo.SetIdleView(ROGERIDLE, Random(5)+5); line to the game_start function, so that the blinking can start right away once the character is idle, rather than after the default idle view start delay. Do you see any potential problems in doing that?


On another note, what would be a good way to implement other idle animations, such as the character tapping their foot, initiated amongst the blinking animations?
#43
Hi folks,

So I'm trying to have my player character blink at random intervals while idle, and I'm having a little trouble wrapping my brain around how to get it to work right. (I know not to use the Blinking View, as I'm not doing a Sierra-style game.)

I have a view (#4) with a single blink animation. Then, in my global script, I tried this:

Code: ags

function repeatedly_execute()
{
  int i;
  i = Random(10);
  cEgo.SetIdleView(4, i);
}


But that's not working as desired. The animation appears to be zipping by more rapidly than if I left it as an ordinary, evenly spaced idle view, and is also occurring way too frequently. I imagine it's got something to do with my randomized SetIdleView delay (which I assumed, from my understanding of the manual description, would be the delay between each playing of the view), but I'm unsure as to what exactly the problem is, and how to fix it.

Any insights (or tips on how to better achieve this in general)?
#44
Eureka! Your last bit of clarification helped me crack it.

In the verb coin script body (not header), I've got the declaration and export:
Code: ags
String region_direction[AGS_MAX_REGIONS];
export region_direction;

(Placement of the export command doesn't appear to need to be at the end of the script after any functions that use the variable...?)

And I put the import command in the global script header so that I don't need to include it in every room script:
Code: ags
import String region_direction[AGS_MAX_REGIONS];


After that, all I needed to do was tell the cursor change function which sprite to use with each directional string text and define the appropriate direction for each region in the "room_Load" function, and voila, works like a charm. I'll cross my fingers that it continues to work in subsequent rooms, but the logic of the scripts implies that it should be fine.

Thanks a bunch, CW! Please let me know if there's any way I may reward you for your time and attention.
#45
Thanks again, CW.

After deleting the global variable, I read the full manual article and thought I was following the instructions correctly, but apparently not, as I'm getting this pop-up error when the game tries to load:
Loading game failed with error: Script link failed. Runtime error: unresolved import 'region_direction'.

So in the GlobalScript header, I declared:
Code: ags
String region_direction[AGS_MAX_REGIONS];


In the room script, after the "room_Load" function that sets the region direction, I exported the variable:
Code: ags
export region_direction;


And in my verb coin script (where the other cursor functions are), I imported it:
Code: ags
import String region_direction[AGS_MAX_REGIONS];


Anything obvious jump out to you as wrong there? Maybe the order in which scripts are read?


Quote from: Crimson Wizard on Sun 24/10/2021 22:09:27
... but you seem to already had experience with that as you have "region[0]" in your code.
To be fair, that part of the function was a direct copy-paste from the manual section about region functions, although I understood it on a basic level.
#46
Thanks for your assistance, CW. Arrays have been beyond my current skill level.

I'm getting an error on the first line:
Code: ags
String region_direction[AGS_MAX_REGIONS];

Error: Attributes of identifier do not match prototype

Any ideas? Something to do with my global variable, perhaps? (It is set as String type with "left" as the initial value.)

Quote from: Crimson Wizard on Sun 24/10/2021 07:22:15
Your first code snippet (one with room_Load) does not make much sense, you only test a region under the mouse cursor once at the room load, what if the mouse is not over the region at that time? Then the variable is never set.
Yeah, that didn't seem right. Initially, I had it under "repeatedly_execute", but through my trial and error it eventually ended up under "room_Load" and just stayed there until I came to ask for help.
#47
Hey guys,

I'm trying to have the cursor switch to one of four directional arrows when over different regions that lead to other rooms.

- I have a sprite for each arrow: left (sprite slot 46), right (47), up (48), and down (49).

- I made an "Arrow" cursor mode out of the Usermode1 cursor, with the default image set to 46 (the "left" arrow sprite).

- I have a global variable set up (in the Global Variables pane) named "region_direction", string type, initial value: left.

In my room script, I have the following function to set the "region_direction" accordingly depending on the specific region. In this instance, for region 1, I want to use the "up" arrow.
Code: ags

function room_Load()
{
  Region* r = Region.GetAtScreenXY(mouse.x, mouse.y);
  if (r == region[1]) {
    region_direction = "up";
  }
}


Finally, in the verb coin script (where all of the other cursor related functions are), in the "repeatedly_execute" function, I have the following code to switch the cursor back and forth from the arrow mode to the standard walkto cursor, with the intention of the arrow graphic changing to the appropriate sprite depending on the "region_direction" variable (in this case, sprite 48 for "up"):
Code: ags

Region* r = Region.GetAtScreenXY(mouse.x, mouse.y);
if (r != region[0]) {
  if (region_direction == "up") {
    mouse.ChangeModeGraphic(eModeArrow, 48);
  }
  mouse.Mode = eModeArrow;
}
else {
  mouse.Mode = eModeWalkto;
}


With this, the cursor switches back and forth as expected, but the arrow sprite does not change, just stays on the initial "left" sprite.


I've been trying different variations of this all day. It seemed to make sense in my head but I just can't get it to work. I've read several older threads of similar scenarios, but nothing's seemed to help me so far. I don't know if I'm just missing one important point here, like how script types work with each other, or if the solution is more complex than I initially thought.

Can someone please tell me what I'm doing wrong, or how else to achieve what I'm trying to?

Thank you!
#48
That appears to have done the trick, Khris! Thanks so much. I don't think I would have figured out that conversion necessity on my own, even having read the manual entry. Enjoy your coffee. I'm sure there will be plenty more where that came from ;)
#49
Thank you guys for chiming in.

Quote from: Khris on Fri 08/10/2021 08:14:19
How and when are you (re-)populating the list of save games?
I have a function that calls it when the save GUI is opened from my main options GUI:
Code: ags

function bSave_OnClick(GUIControl *control, MouseButton button)
{
  lstSaveList.FillSaveGameList();    //call save game list
  lstSaveList.SelectedIndex = -1;    //no selection in list
  gSaveGame.Visible = true;    //open save game GUI
}


Quote from: Gilbert on Fri 08/10/2021 10:44:54
1. I guess that slot_selected somehow is never set to true, so the false path is always chosen in the if-else if group. (So apart from just checking only the selected index in a Display() you may also check this bool variable.)
The function starting at line 3 of the script in my OP sets the bool to true when the player makes a selection in the list box, confirmed by a "1" display-check of the bool.

Quote from: Gilbert on Fri 08/10/2021 10:44:54
2. The ItemCount property of a listbos is readonly so you should not write something like "lstSaveList.ItemCount ++". Instead that related line should be SaveGameSlot(lstSaveList.ItemCount +1, tbSaveName.Text); in order to save to a new slot.
When you repopulate the listbox the next time the ItemCount will be updated correspondingly.
I had actually tried it both ways, to the same result, but I've set it back to "+1" in light of Crimson Wizard's note, which I had not gleaned from the part in the scripting tutorial about the "++" shortcut.

Quote from: Gilbert on Fri 08/10/2021 10:44:54
If this is the case, though, it would also overwrite the same existing slot if you do not choose any slot in the list. Have you checked that too?
With nothing in the list selected, the save gets saved to a new slot, as expected. It's only when an existing slot (any slot) is selected that the top slot (and only the top slot) gets overwritten.
#50
Quote from: Khris on Fri 08/10/2021 07:42:43
Something like
Code: ags
  Display("selected index: %d", lstSaveList.SelectedIndex);

should help you debug this.

Hi, Khris. Thanks for the suggestion. I did already check with that, however, and it did appear that things were working correctly (if I selected slot 3, it would display a 3; if slot 8, an 8), yet after I saved and went back to the list, only the top slot, not the one I had selected, would be overwritten. ???
#51
Hey, guys. I'm trying to script (what I thought would be) a simple "save slot overwrite" function in a custom save GUI, but all I'm getting is overwriting of the slot at the top of the save list, no matter which other slot I have selected. Can you please take a look and tell me what I've gotten wrong here?

Code: ags

bool slot_selected = false;    //for signaling whether an existing save slot is selected; no selection by default

function lstSaveList_OnSelectionChanged(GUIControl *control)    //selection of an existing save slot
{
  slot_selected = true;
}

function bSaveConf_OnClick(GUIControl *control, MouseButton button)
{
  if (slot_selected == false)    //no existing save slot is selected
  {
    SaveGameSlot(lstSaveList.ItemCount ++, tbSaveName.Text);    //save to the next slot up from the existing total count
    gSaveGame.Visible = false;    //close save GUI
  }
  else if (slot_selected == true)    //an esiting save slot is selected
  {
    SaveGameSlot(lstSaveList.SelectedIndex, tbSaveName.Text);    //save to the selected save slot, overwriting it (???)
    gSaveGame.Visible = false;    //close save GUI
  }
}
#52
Well, I can try to go through the newest template and adjust the scripting to suit my needs. I'm just not sure how ubiquitous the necessary scripts are, and I'm still only a novice at scripting. I suppose it could be a decent learning experience, though.
#53
I'm using the slightly older template linked by morganw above to get the timed-click-verb-coin and verb-coin-in-inventory functionality. In that template, the cursor changes from a white "X" to a blue one when you hover over a hotspot, etc., but again, the switch seems a little laggy with swifter mouse movements.
#54
Thank you, Khris! I'll try out your solutions as soon as I get back into AGS.

With regards to #6, what I'm referring to is the automatic graphical change that occurs when you hover over an object/hotspot/etc. This change appears to not happen instantly when you are mousing around a little more quickly. Instead, there seems to be a delay, just long enough to be noticeable.

This may or may not be a template specific issue, as I don't recall noticing it before, so can you tell me where I might want to poke around in the scripts, if you don't know of a direct solution?
#55
Quote from: morganw on Tue 28/09/2021 00:01:27
You can download the last revision of the old version (with timed clicks) from here:
https://github.com/adventuregamestudio/ags-template-source/archive/440e6acd32faed710aa0512f21ff404b8e80c84b.zip

If you want something that works exactly like CMI it is likely a close match but the part of the reason it was changed was because some players don't even think to try a timed click (outside of using a touch screen).

Thank you very much, morganw.

I had to update lines 384 and 385 of the VerbCoin GUI to get it to run in v3.5.1 as such:
Code: ags
verbc_border_x = Screen.Width - gVerbCoin.Width;
verbc_border_y = Screen.Height - gVerbCoin.Height;


This is definitely a step closer to what I'm going for, but there are still a few little niggles I have before it's just right. I've gone through the scripting to see if I could figure out how to make the desired adjustments, but it's beyond my skill level at this point in time. If someone would be willing to help add/modify the necessary scripts to get me on track, I'd be most grateful, and would even be happy to compensate you for your time (if such offers are allowed on here; I didn't read any disclaimers against doing so). Feel free to PM me in regards to that.

Here are the adjustments I'd like to make:

  • After activating the verb coin (left-click and hold), I'd like the verb coin to remain on the screen until the mouse button is released, regardless of the cursor position. The current behavior makes the verb coin deactivate when the cursor leaves its edges. Similarly, if you move off of the verb coin within the inventory, it deactivates both the verb coin and the inventory GUI. This is not preferred.
  • I'd like the cursor and verb coin to be accessible again immediately after initiating an event on a hotspot/object, and be able to interrupt the playable character's current action with whatever event you call on next. Currently, the cursor and ability to interact disappear until the current action is completed. I prefer the more free feeling controls found in CMI.
  • Currently, when you click and hold on one of the verb coin buttons, that button's selected sprite stays active until you hover over another button, even if you move the cursor over a non-button area of the verb coin. I'd like the verb coin to return to its idle sprite and no button selection when you move off of any button, even with the mouse click still held.
  • With the inventory open, if no inventory object has been selected, I want the inventory to stay open unless the player (a) left-clicks outside the edges of the inventory, or (b) right-clicks anywhere on the screen. The current behavior closes the inventory when you move the cursor outside its edges, whether you've selected an object or not.
  • I'd like the Esc key (in addition to right-click) to clear inventory objects from the cursor. Currently, only right-click does this.
  • There appears to be a small delay switching from the plain cursor to the hotspot cursor when quickly mousing over a hotspot/object. Can this be fixed?
  • This last one will likely require as much sprite creation work as scripting, but I'd like an outline to appear around the currently selected object when you hold it over another object/hotspot/etc. A rundown of how I can implement this would be great.
Strikethrough = Figured out

Anyone willing and able, please let me know if you can give me a hand with all this, and again, I would be happy to pay you accordinly.

Thanks!
#56
Thanks, guys. I appreciate the multiple solutions. I'll report back if I run into trouble implementing either of them.

Any tips on getting the CMI functionality of the verb coin and inventory to work (question 2 in my OP)?
#57
Hi all,

Hope you're doing well.

I've spent a couple of hours searching the forums, manual, and wiki, but haven't found the answers to exactly what I'm looking for (nor much on the general topic that's at all recent). I feel I've done my due diligence before posting, so I'll feel really dumb if something flew right over my head.

I'm trying to create a game with The Curse of Monkey Island style verb coin, inventory, and game menus. I've started with the Verb Coin template, which seems the right start, but I've got some questions on its intricacies and how to expand upon it:

1. How can I replace the default, plain graphics with my own custom-made images/sprites (e.g., in CMI: a literal coin for the verb coin, a treasure chest for the inventory, a journal for the main game menu)? Any links that I found in old threads that might've shown such examples all appear to be long dead, and I don't see (in the various GUI properties in AGS) where to assign a graphic to use. Surely this kind of thing is possible...?

Edit: Forgive me, I just saw the BackgroundImage parameter right there under the GUI properties, but I swear it wasn't there before. You believe me... Right?...

    1a. Can I assign an animated view to a GUI (e.g., how the coin in CMI shines when activated)?

    1b. Is there a problem with having a singular options menu, containing save, load, quit, etc. buttons all in one? All of the menus that I've seen so far appear to handle just one of those functions each. Is there something wrong with setting up a global main menu GUI with all options that link to sub-menus to carry out those options, the way most modern games function?

2. I'd like to retain identical functionality of the CMI interface (e.g., click and hold to bring up the verb coin, verb coin functionality within the inventory, etc.). I've gathered that this is how it might have worked in the Verb Coin template previously, but appears to have been changed in more recent iterations. Is there a simple way to restore these desired behaviors?


Again, most of the threads I've found on these topics are quite old, and I don't know what information in them is still relevant/useful, so if any of you all can assist me with these points, or at least point me in the right direction, I'd very much appreciate it.

Thank you!
SMF spam blocked by CleanTalk