Script module created with AGS 3.6.1 to add inventory animation functionality for your script.
This example gives an inventory item a looping base animation and a separate cursor animation.
player.ActiveInventory = iDog
iDog.InvAnimate_SetBaseAnimation(VIEWDOG, 0, 5, 5, eInvAnimate_Normal);
iDog.InvAnimate_SetBaseAnimation(VIEWDOG, 1, 5, 5, eInvAnimate_Cursor);
iDog.InvAnimate_ToggleHideWhileActiveInventory(false);
- Sets a base animation for the normal inventory icon
- Sets a base animation for the cursor icon
- Disables hiding the normal inventory graphic while the item is in the cursor
- Use
eInvAnimate_Normalto affect only the regular inventory icon - Use
eInvAnimate_Cursorto affect only the cursor icon - Use
eInvAnimate_Bothto affect both at once
This example sets a base animation, then plays another animation over it with a delay_between_loops value of 500.
iCat.InvAnimate_SetBaseAnimation(VIEWCAT, 0, 3, 3, eInvAnimate_Normal);
iCat.InvAnimate_SetAnimation(VIEWCAT, 1, 3, 3, 500, eInvAnimate_RepeatForever, 1, eInvAnimate_Normal);
iCat.InvAnimate_ToggleCopyNormalGraphicToCursor(true);
- Sets a base animation for the normal inventory icon
- Plays a different animation every
500frames
- The
500value here is used as the animation'sdelay_between_loops - Because
InvAnimate_ToggleWaitForAnimationsis set totrueby default, it will always wait for the base animation to finish playing before switching to the current animation - Because
InvAnimate_ToggleShowBaseBetweenLoopsis set totrueby default, it plays the default animation in between loops of the current one. If disabled, it would display frame0of the current animation for500frames. - Because
InvAnimate_TogglePlayWhileBlockedis set totrueby default, items will continue to animate even while the script is blocked. - Because
InvAnimate_ToggleHideWhileActiveInventoryis set totrueby default, it will temporarily disappear from your inventory while set to the mouse cursor - If base animation was not set, it would instead display the base graphic between loops. For example, a still cat that licks its paws every 500 frames.
Chooses whether the animation functions work on the normal icon, cursor icon, or both.
eInvAnimate_NormaleInvAnimate_CursoreInvAnimate_Both
eInvAnimate_RepeatForevereInvAnimate_RepeatFixed
Functions for playing blocking inventory animations.
function InvAnimate_PlayBlockingAnimation(this InventoryItem*, int view, int loop, int delay, int delay_between_loops, optional int num_loops = 1)
Description
Plays a blocking animation on the current inventory item. Does not play the base animation between loops.
Functions for setting what the item displays when no temporary animation is playing.
function InvAnimate_SetBaseGraphic(this InventoryItem*, int sprite_index, InvAnimate_IconOption icon_option = eInvAnimate_Both, bool delete_base_animation = false)
Description
Sets the base graphic which displays if the inventory item has no base animation set.
Set delete_base_animation to true to delete any existing base animations. If no parameter is given, it defaults to false.
function InvAnimate_SetBaseAnimation(this InventoryItem*, int view, int loop, int delay, int delay_between_loops, InvAnimate_IconOption icon_style, bool enabled = true)
Description
Sets the animation which is always playing when no other animation is playing on top of it.
function InvAnimate_DisableBaseAnimation(this InventoryItem*, optional InvAnimate_IconOption icon_style = eInvAnimate_Both)
Description
Disables the base animation but does not delete it.
Does not wait for the current animation to finish. Can be re-enabled later. If no argument is given, it applies to both the normal icon and cursor.
function InvAnimate_EnableBaseAnimation(this InventoryItem*, InvAnimate_IconOption icon_style = eInvAnimate_Both, bool play_from_beginning = true)
Description
Enables the base animation that was previously disabled.
If no arguments are given, it enables both the normal icon and cursor, and plays them from the beginning instead of where they left off.
function InvAnimate_UnsetBaseAnimation(this InventoryItem*, InvAnimate_IconOption icon_style = eInvAnimate_Both)
Description
Deletes the base animation of an inventory item.
If no argument is given, the icon style defaults to both the normal icon and cursor.
Functions for playing and controlling temporary animations over the base animation or graphic.
function InvAnimate_SetAnimation(this InventoryItem*, int view, int loop, int delay, int delay_between_loops, InvAnimate_RepeatStyle repeat_style = eInvAnimate_RepeatForever, int num_loops = 1, InvAnimate_IconOption icon_style = eInvAnimate_Both, bool enabled = true)
Description
Sets an animation which plays over the base animation or graphic for a specified number of loops.
If repeat_style is set to eInvAnimate_RepeatForever, the animation loops indefinitely.
Values of unspecified optional parameters are:
- repeat forever
- perform
1loop - apply to both mouse and cursor
- start enabled
function InvAnimate_DisableAnimation(this InventoryItem*, InvAnimate_IconOption icon_style = eInvAnimate_Both)
Description
Disables the held animation but does not delete it.
Does not wait for the current animation to finish. Can be re-enabled later. If no argument is given, it applies to both the normal icon and cursor.
function InvAnimate_EnableAnimation(this InventoryItem*, InvAnimate_IconOption icon_style = eInvAnimate_Both, bool play_from_beginning = true)
Description
Enables the held animation that was previously disabled.
If no arguments are given, it enables both the normal icon and cursor, and plays them from the beginning instead of where they left off.
Functions for changing how inventory animations behave.
function InvAnimate_ToggleHideWhileActiveInventory(this InventoryItem*, bool enabled = true)
Description
Makes the inventory item hidden while that inventory item is selected.
This defaults to true for all inventory items. If no argument is given, it will be set to true.
function InvAnimate_ToggleCopyNormalGraphicToCursor(this InventoryItem*, bool enabled = true)
Description
Makes the inventory item in the mouse cursor always match the exact frame of the animation playing in the normal graphic instead of playing its own animation.
This defaults to false for all inventory items. If no argument is given, it will be set to true.
function InvAnimate_ToggleShowBaseBetweenLoops(this InventoryItem*, bool enabled = true)
Description
Makes the base animation or graphic play between loops of the current animation if the current animation is not ready yet.
This defaults to true for all inventory items. If no argument is given, it will be set to true.
function InvAnimate_ToggleWaitForAnimations(this InventoryItem*, bool enabled = true)
Description
Waits for the current animation to finish before moving to a new animation.
If set to false, new animations will play right away, or when the given number of frames have passed instead of waiting.
This defaults to true for all inventory items. If no argument is given, it will be set to true.
function InvAnimate_TogglePlayWhileBlocked(this InventoryItem*, bool enabled = true)
Description
Makes the current inventory item's animations continue to play even when blocked by another script, but not during certain dialogue.
This defaults to true for all inventory items. If no argument is given, it will be set to true.