MathScript Snippets
A collection of snippets you can use in math scripts.
Update a dvar array on new day.
In this example, we use a dungeon with the label sfq_town . We have the following dVars:
last_trainer_resetWhich we store the day when this math script was run last.trainer_skillsWhere we store an array of 4 action labels that we'll use in conditions to decide which skills are available at a trainer.
setDvar("sfq_town","last_trainer_reset","!$g_day")
actions = getAssetLabelsRegex('Action', '^sfq_pc')
shuffle(actions)
actions = arraySlice(actions, 0,4)
setDvar("sfq_town", "trainer_skills", actions)Explanation:
setDvar("sfq_town","last_trainer_reset","!$g_day")Sets a dvar called last_trainer_reset in the dungeon labeled sfq_town to the current day.