esselfortium Posted February 3, 2009 While thinking about possible ways to simplify the process of coding long animation sequences in EDF, to reduce code bloat and tedious work, I came up with the seemingly simple idea of referencing counter values in place of the sprite-frame field in EDF frames. Thus, instead of having 30 lines of SMOK|A, SMOK|B, SMOK|C, etc., you could set up a loop using SMOK|Counter(0) or something similar to step through as many frames as needed, using only a few lines of code. A full example of how this might look: frame EX_DEATH1 { cmp = "TNT1 | A | * | 0 | SetCounter(0,10,Set) | @next" } frame EX_DEATH2 { cmp = "TROO | Counter(0) | * | 3 | CounterJump(EX_DEATH4,3,30,0) | @next" } frame EX_DEATH3 { cmp = "TNT1 | A | * | 0 | SetCounter(0,1,Add) | @prev" } frame EX_DEATH4 { cmp = "TROO | 31 | * | -1" }What's happening in each state: EX_DEATH1: This state makes sure that Counter 0 is set to the value 10 when the death animation begins, and goes on to the next frame. EX_DEATH2: This state is where the visible animation occurs. It uses the Counter 0 value to determine which sprite frame to draw, then does a CounterJump to check whether it has reached frame 30, in which case it skips to EX_DEATH4. Otherwise, it continues to EX_DEATH3. EX_DEATH3: This state adds 1 to the Counter 0 value, and returns to EX_DEATH2 so that the newly-specified sprite frame will be displayed. EX_DEATH4: The final state, which (unless I screwed up the CounterJump syntax, which is very possible) is only reached after the monster has stepped through each sprite frame from 10 to 30 by incrementing Counter 0. If feasible, this would greatly reduce the amount of copy and paste and tedious manual work involved in defining EDF monster and effect animations. Further possibilities and related ideas: If this is possible, might it also be possible to reference counter values in the Bright, State Length, and some other relevant fields? I'm seeing the most immediate and obvious uses for the one I've described, but I'm sure some talented and enterprising individuals could find cool things that could be done with any further possible counter-scripting possibilities. :) It'd also be pretty amazing if there was some way that counter values could be used in place of one character of a sprite name, but I'm not sure how this would be specified. { cmp = "TRO + Counter(1)" } or something like it (to get a sprite name like "TRO1" or "TRO2" depending on the value) probably would be problematic to check for in every frame, so this would more likely be Heredoc territory I suppose. I don't really know much of anything about those, though! 0 Quote Share this post Link to post
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.