Table of Contents

A VCI that gets smaller every time it's used

A VCI that gradually gets smaller every time it's used.
This could be useful for replicating things like consumption of food.

Material data

Any grabbable VCI will work.

VCI script

function onUse(use)
    local scale = vci.assets.GetSubItem(use).GetLocalScale()
    --To avoid the scale to go negative, shrink with a constant when it become smaller than a certain value
    if scale.y <= 0.11 then
    -- A single use will shrink the object by the stepppoint
    local steppoint = 0.1
    scale.x = scale.x - steppoint
    scale.y = scale.y - steppoint
    scale.z = scale.z - steppoint

VCI Script (Description)

Acquire the name of the VCI object being used with onUse(use) then acquire the current size using GetLocalScale().
Apply the shrunk Scale with SetLocalScale().

You can use the script above by copy and pasting it. Any grabbable VCI will work without any change.

en/vci/sample/onuse/no4.txt · Last modified: 2022/09/05 18:02 by pastatto

Page Tools