Page 1 of 1

"Clamped" number variables?

Posted: Thu Nov 09, 2017 12:12 pm
by Abelius
Hi there,

I was wondering if there's some easy way in DS to declare a number variable with min and max values, just from the interface, so I don't need to resource to external code to clamp its value periodically...

If not, I use PlayMaker so I guess I could make a 'watcher' FSM, but that solution doesn't ring just right, performance-wise, to me (I think).

Thanks.

Re: "Clamped" number variables?

Posted: Thu Nov 09, 2017 12:48 pm
by Tony Li
There's no built-in way to automatically clamp to min and max values.

I agree that a 'watcher' FSM wouldn't be the most efficient solution. But then again it might not be an issue if you only check, for example, at the end of conversations.

Depending on how you change the variable's value, you could register a custom Lua function to set a variable with clamping, or do the same with a PlayMaker action.

BTW, if you're using the Increment On Destroy component, it clamps, so you don't need to do anything special for it.

Re: "Clamped" number variables?

Posted: Thu Nov 09, 2017 3:00 pm
by Abelius
Ok, no problem. I'll go for the 'clamp everything' approach at the end of conversations.

Thanks for your quick response!