I created a quick animation system that changes the item thumbnail inside the inventory when used.
First you’ll need to add following variables to your item:
animationPropertyList : string : “[ ]”
animationPlayList : string : “”
frameURL : string : “”
frameDuration : number : 0
animationIsRunning : boolean : false
initialize
{
"triggers": [],
"conditions": [
{
"operator": "==",
"operandType": "boolean"
},
true,
true
],
"actions": [
{
"type": "setEntityVariable",
"entity": {
"function": "thisEntity"
},
"variable": {
"function": "getEntityVariable",
"variable": {
"text": "animationPropertyList",
"dataType": "string",
"entity": "NG5gjDrimk",
"key": "animationPropertyList"
}
},
"value": {
"function": "insertStringArrayElement",
"value": "[\"240\",\"https://cache.modd.io/asset/spriteImage/1683288430619_Test_UI_000.png\"]",
"string": {
"function": "getValueOfEntityVariable",
"variable": {
"function": "getEntityVariable",
"variable": {
"text": "animationPropertyList",
"dataType": "string",
"entity": "NG5gjDrimk",
"key": "animationPropertyList"
}
},
"entity": {
"function": "thisEntity"
}
}
},
"comment": ""
},
{
"type": "setEntityVariable",
"entity": {
"function": "thisEntity"
},
"variable": {
"function": "getEntityVariable",
"variable": {
"text": "animationPropertyList",
"dataType": "string",
"entity": "NG5gjDrimk",
"key": "animationPropertyList"
}
},
"value": {
"function": "insertStringArrayElement",
"value": "[\"240\",\"https://cache.modd.io/asset/spriteImage/1683292757986_Test_UI_003.png\"]",
"string": {
"function": "getValueOfEntityVariable",
"variable": {
"function": "getEntityVariable",
"variable": {
"text": "animationPropertyList",
"dataType": "string",
"entity": "NG5gjDrimk",
"key": "animationPropertyList"
}
},
"entity": {
"function": "thisEntity"
}
}
},
"comment": ""
},
{
"type": "setEntityVariable",
"entity": {
"function": "thisEntity"
},
"variable": {
"function": "getEntityVariable",
"variable": {
"text": "animationPropertyList",
"dataType": "string",
"entity": "NG5gjDrimk",
"key": "animationPropertyList"
}
},
"value": {
"function": "insertStringArrayElement",
"value": "[\"240\",\"https://cache.modd.io/asset/spriteImage/1683288327097_Test_UI_004.png\"]",
"string": {
"function": "getValueOfEntityVariable",
"variable": {
"function": "getEntityVariable",
"variable": {
"text": "animationPropertyList",
"dataType": "string",
"entity": "NG5gjDrimk",
"key": "animationPropertyList"
}
},
"entity": {
"function": "thisEntity"
}
}
},
"comment": ""
},
{
"type": "setEntityVariable",
"entity": {
"function": "thisEntity"
},
"variable": {
"function": "getEntityVariable",
"variable": {
"text": "animationPropertyList",
"dataType": "string",
"entity": "NG5gjDrimk",
"key": "animationPropertyList"
}
},
"value": {
"function": "insertStringArrayElement",
"value": "[\"240\",\"https://cache.modd.io/asset/spriteImage/1683288288964_Test_UI_005.png\"]",
"string": {
"function": "getValueOfEntityVariable",
"variable": {
"function": "getEntityVariable",
"variable": {
"text": "animationPropertyList",
"dataType": "string",
"entity": "NG5gjDrimk",
"key": "animationPropertyList"
}
},
"entity": {
"function": "thisEntity"
}
}
},
"comment": ""
},
{
"type": "setEntityVariable",
"entity": {
"function": "thisEntity"
},
"variable": {
"function": "getEntityVariable",
"variable": {
"text": "animationPropertyList",
"dataType": "string",
"entity": "NG5gjDrimk",
"key": "animationPropertyList"
}
},
"value": {
"function": "insertStringArrayElement",
"value": "[\"240\",\"https://cache.modd.io/asset/spriteImage/1683288223651_Test_UI_006.png\"]",
"string": {
"function": "getValueOfEntityVariable",
"variable": {
"function": "getEntityVariable",
"variable": {
"text": "animationPropertyList",
"dataType": "string",
"entity": "NG5gjDrimk",
"key": "animationPropertyList"
}
},
"entity": {
"function": "thisEntity"
}
}
},
"comment": ""
},
{
"type": "setEntityVariable",
"entity": {
"function": "thisEntity"
},
"variable": {
"function": "getEntityVariable",
"variable": {
"text": "animationPropertyList",
"dataType": "string",
"entity": "NG5gjDrimk",
"key": "animationPropertyList"
}
},
"value": {
"function": "insertStringArrayElement",
"value": "[\"240\",\"https://cache.modd.io/asset/spriteImage/1683288179954_Test_UI_007.png\"]",
"string": {
"function": "getValueOfEntityVariable",
"variable": {
"function": "getEntityVariable",
"variable": {
"text": "animationPropertyList",
"dataType": "string",
"entity": "NG5gjDrimk",
"key": "animationPropertyList"
}
},
"entity": {
"function": "thisEntity"
}
}
},
"comment": ""
},
{
"type": "setEntityVariable",
"entity": {
"function": "thisEntity"
},
"variable": {
"function": "getEntityVariable",
"variable": {
"text": "animationPropertyList",
"dataType": "string",
"entity": "NG5gjDrimk",
"key": "animationPropertyList"
}
},
"value": {
"function": "insertStringArrayElement",
"value": "[\"240\",\"https://cache.modd.io/asset/spriteImage/1683288119754_Test_UI_008.png\"]",
"string": {
"function": "getValueOfEntityVariable",
"variable": {
"function": "getEntityVariable",
"variable": {
"text": "animationPropertyList",
"dataType": "string",
"entity": "NG5gjDrimk",
"key": "animationPropertyList"
}
},
"entity": {
"function": "thisEntity"
}
}
},
"comment": ""
},
{
"type": "setEntityVariable",
"entity": {
"function": "thisEntity"
},
"variable": {
"function": "getEntityVariable",
"variable": {
"text": "animationPropertyList",
"dataType": "string",
"entity": "NG5gjDrimk",
"key": "animationPropertyList"
}
},
"value": {
"function": "insertStringArrayElement",
"value": "[\"0\",\"END\"]",
"string": {
"function": "getValueOfEntityVariable",
"variable": {
"function": "getEntityVariable",
"variable": {
"text": "animationPropertyList",
"dataType": "string",
"entity": "NG5gjDrimk",
"key": "animationPropertyList"
}
},
"entity": {
"function": "thisEntity"
}
}
},
"comment": ""
},
{
"type": "setEntityVariable",
"entity": {
"function": "thisEntity"
},
"variable": {
"function": "getEntityVariable",
"variable": {
"text": "animationIsRunning",
"dataType": "boolean",
"entity": "NG5gjDrimk",
"key": "animationIsRunning"
}
},
"value": false,
"comment": ""
}
],
"name": "initialize",
"parent": null,
"key": "RdxXQVj4zt",
"order": -1
}
The initialize script should be run on item creation.
The first number inside each row tells how long(MS) the frame should be played, while the second part is the URL of the frame image that should be shown.
I added 2 key-words “END” for an one shot animation and “REPEAT” for an infinite looping animation.
You can add as many frames to your animation as you want using the same action of setting entity variable.