Custom dynamic metada Binded to actors (variables)

Posted: 28 Oct 2020 16:45
by nio kasgami

It was suggested before in the discord, but not pushed further?

but I think an extension that allows 'stats' or variable binded to actors and saved by savefile would be extremely useful.

Example :
RPG stats like HP etc or a Love stats who is binded to the activated actor.

implementation
It would be either a dictionary or an array of variables BINDED into the character section that can hold Classic integer, float or string values. (to keep simple )
They have a range specified into the value and is clamped to the max value set)
It would allow to fetch the data and use in IF method (example use: game over if the fear meter is full)

You can access those data by :

Code: Select all

@getData ActorName StatesNameOrId  

It can also be set

Code: Select all

@setData ActorName StateNameOrId Additive? value

Additive : wether or not the value is set or Add to the existing value (could be shorten by += for additive or + for set)
i.e : @setData ActorName StateName += 10
also adding ++ could do incremental increase by 1)

Why these features?
Having custom Metadata for actor is something that Would help greatly to implement custom variable specific to the actors without cluttering the files or global space. VN maker have this features and it is VERY useful for make multiple type of game.


Re: Custom dynamic metada Binded to actors (variables)

Posted: 28 Oct 2020 19:00
by Elringus

I think that's already possible with expression functions. Check the guide for more info and examples.


Re: Custom dynamic metada Binded to actors (variables)

Posted: 28 Oct 2020 20:41
by nio kasgami

I think this npot help to keep the tracking and variable in track? what I meant is that actor can have bonded variables. I generally meant this options as a way to not get lost with multiple stats.

but if you have proper example then I am all in to see

I also checked script expression and...I don't see how we can do that using that?


Re: Custom dynamic metada Binded to actors (variables)

Posted: 28 Oct 2020 21:25
by Elringus

Not sure what you mean by keeping variables in track. For an example, you can make an expression function like GetStat(StatName, CharId), which will return the desired stat for the specified char. To set the stat, add a custom command, like @setStat StatName.StatValue char:CharId.


Re: Custom dynamic metada Binded to actors (variables)

Posted: 28 Oct 2020 22:32
by nio kasgami

Oh I see!

so I could do an Custom Variable manager and then I create an script function who fetch the data and save it into the nani novel?

I may overthink the idea tho


Re: Custom dynamic metada Binded to actors (variables)

Posted: 28 Oct 2020 23:14
by Elringus

If you mean overriding ICustomVariableManager, you won't need that. Just an expression function and a command, as I've mentioned before. You can store the variable values with the built-in variable manager or add a custom state, if you wish (see the state management guide for more info on that).