View Single Post
Seren Seren's Avatar

JCF Member

Joined: Feb 2010

Posts: 864

Seren is a name known to allSeren is a name known to allSeren is a name known to allSeren is a name known to allSeren is a name known to allSeren is a name known to all

Feb 7, 2013, 02:50 AM
Seren is offline
Reply With Quote
Quote:
Originally Posted by minmay View Post
Random idea: onTrigger function. As in, call it when the trigger is turned on (but not for remaining on). Maybe split into onTriggerOn (call when turned on), onTriggerOff (call when turned off), onTriggerSwitch (any change). You can imitate this with existing capabilities of course but it's a bit cumbersome and I'm worried about checking too many conditionals every frame (what if we go up to 256 trigger IDs some day?), though I suppose that probably isn't a concern nowadays.
I'm pretty sure that JJ2 doesn't contain onTrigger() itself, so to add it, JJ2+ would just have to check for those "too many conditionals every frame" on its own and it wouldn't be any faster. However, it's worth noting that there's no reason this would be slow at all, as all you have to do is check current trigger state (JJ2 array) and previous trigger state (custom array you should update manually) for every trigger. So, check state of two booleans in a for() loop that repeats 32 (or, in your "some day" scenario, 256) times. By my estimation, this won't slow the game down by more than 1.0*10-20 fps. In other words: it's not cumbersome, it gives your script approximately up to 6 more lines, and you shouldn't worry about speed issues, there's no way this would slow the game down.
__________________

I am an official JJ2+ programmer and this has been an official JJ2+ statement.

Last edited by Sir Ementaler; Feb 7, 2013 at 03:01 AM.