Idle animations

Started by FortressCaulfield, Mon 21/10/2024 14:08:08

Previous topic - Next topic

FortressCaulfield

EDIT:
I learned some interesting things about idle animations.
1. They do not set char.Animating to true.
2. Using SetIdleAnimation while it is playing not only resets the timer but aborts the current idle.

Questions:
There does not appear to be a way to adjust or read the timer for a char's idles. Am I missing something? I don't mean the delay value itself, I mean whatever is counting the seconds. Like there's no way to manually reset it or have a char on a 20s delay start at 10s when you walk into the room for the first time?

Do the idle timer countdowns for non-ego reset when you leave the room?

Does changing idle view or idle delay reset the countdown timer?

Is there an easy way to tell what chars in a room? Like an 'occupant' array in the room struct?

I have 3 chars on the same screen. I don't want their idles all playing at once, but I also don't want any of them to have to be on overly long delays. I'm thinking the following:

Char A- 7 second delay, Char B- 14s, Char C- 21s
In the room's repeatedly execute always, if char A or B is animating and in their idle view, set their delay to 21. Would that work?

I would really like to be able to have a global check in whatever code plays idle animations that allows only one to play at a time and also fuzzies up the timer, adding a random 0-3 seconds, but I don't think the script has access to the code to do that.

Thanks in advance!
"I can hear you! My ears do more than excrete toxic mucus, you know!"

-Hall of Heroes Docent, Accrual Twist of Fate

Crimson Wizard

#1
The built-in idle settings are meant to be set once, and then let engine to handle them automatically, and independently for each character.

If you need something more complicated, and especially if you need multiple characters to depend on each other, then it may be easier to write your own system in script.

I don't know if the characters in question are playable or NPCs. If these are standing NPCs, meaning they don't move, then scripting idling for them is mostly a matter of adding a "time" parameter and reducing it down in rep-exec-always, or similar.

A good way to "attach" values to characters is Custom Properties: these may be both read and set in script.
https://adventuregamestudio.github.io/ags-manual/CustomProperties.html

Another possible approach is to use timers. AGS own timers are limited, but there's this timer module, for example: https://www.adventuregamestudio.co.uk/forums/modules-plugins-tools/module-timer-0-9-0-alternate-variant/

If these characters may walk or do something that would reset "idle counter", then situation becomes bit more complicated, as you also will have to detect these actions and reset the counter. But I won't expand on this before I know specifics (I don't know if that's necessary).


QuoteIs there an easy way to tell what chars in a room? Like an 'occupant' array in the room struct?

Unless you script your own array, the only way is to iterate all characters using "character[]" array in a loop (the number of characters may be learnt using Game.CharacterCount), and check their Room property.
https://adventuregamestudio.github.io/ags-manual/Character.html#characterroom

FortressCaulfield

> the only way is to iterate all characters using "character[]" array in a loop

I guess that wouldn't be awful since my game's only going to have maybe 40 chars total.

The chars in question are all NPCs. I think I can accomplish what I need to with your answers so far, thanks!
"I can hear you! My ears do more than excrete toxic mucus, you know!"

-Hall of Heroes Docent, Accrual Twist of Fate

SMF spam blocked by CleanTalk