10/23/17

The Lass is Half Full


I use Himework's State Charges back in The Fates We Weave to manage "stacks" of states, such as the Guard Removals and the Webbings.  This is partly because I'm partly afraid of script compatibility if I were to use Hime's Conditional or Progressive states with say CP's Graphic State script.  Yesterday, I began working on modding Himework's State Character so that the graphics will change based on stacks of states rather than just one state.

...State Character isn't on Hime's site because I modded that from her State Face script, though you may have seen this script in effect if you played Stupid Rubber Peril Game.

Anyway, the pic shows no state, 1 Charge of a state, and 2 Charges of a state.  If state is removed by walking, charges drop off one by one, so it kinda "washes off".  I managed to get the script to work with assigning multiple graphics and a "general graphic" so far, and I just transplanted the code to work with faces and battlers.

Oh, and I tested this using a snippet in conjunction with the Quicksand script (which I just tinkered again to account for non-visible Followers)




Getting the State Charges to mingle with State Characters/Face was confusing at first until I read up on how Arrays work.  Then I actually managed to get it working once I truly understand arrays.  It helps that I use a method to put the array into a game_variable to see how the array is sorted.

First of all, Hime's load_notetag for the State Face makes array[state] = [filename, index].  If I want to do array[state][charge] = [filename, index], I must first make the array exist, so I place a filler number with array[state] = [something] (unless the array already exists).  So


array[state] = [0] unless array[state]
array[state][charge] = [filename, index]

Ideally, the data for say 2 charges of state 12's filename should look like array[12][2][0], but to cut down on confusion, we should probably have array2 = array[12][2] and then array2[0]. 

I also reserved a "0 charge" when I want to cover the rest of the charges in the states (example, 2 notetags with the tenth having a finished graphic instead of 9 partials and one finished.).  With the example above, array[state][0] = [filename, index] is going to replace whatever we put in array[state] = [nil,nil] unless array[state], plus Hime's State Charge script mainly works as having a state has 1 charge at minimum, so it's not likely you can access array[state][0].

However, we will need to a new array in order to grab array[state][0].  I would declare a new @newArray = {} and then declare @newArray[state] = true if charge  == 0.  Next, I'll copy one of the methods above load_notetag that is designed to return the array we created.  Now in our name and index methods, Returns will end the method and the first return should be for a normal state and charge.  If that stack has no charge, we want to grab our "general graphic" data at 0, but only if @newArray[state] exists/true.

So yeah, I managed to get my arrays working and will probably transplant the structure to my Faces and Battlers.

No comments:

Post a Comment