3/16/18

Shuffling Shells No More

Alright, so NoxGaming pointed out that when characters are swapped through Formation, the characters' positions are swapped.  In a normal RPG Maker project, this swap is okay as a reflection of the new Formation and characters are not far apart.  In my project, which involves jumping gaps, vore and stuck characters, person A can be at person B's position even if not feasible.

I have corrected that.
So this is what happens:  the Formation makes use of the Game Party's swap_order, which mainly does 
@actor[index1], @actor[index2] = @actor[index2], @actor[index1]
Or in other words, this function swaps the position of these two parts of the array, so the order changes from [0,1,2,3] to [1,0,2,3] if I change the leader (0) and the second person.  One of the issues here is that actors don't store character data, hence I would need some more variables.  You could assign the "characters" by the two indexes alone, but I chose to create an array from the whole team and then swap them similar to the actor data and then relist the character data to the whole team.

If I recorded the x and y by themselves, character positions could be swapped alright, but if I recorded the character, this seems to present a problem as one character would go to the other character.  That had stumped me a bit until last night; if you are assigning an object to a character, you are treating it as the object under a different name.  The most glaring example is the Game Party, which means that you could check if the 7th character of the database has a poison state but give him poison if he's part of the team (Hence, when one character gets the coordinates from the array, I was actually changing the array so that the next character has the changed coordinates).  Thankfully, this was solved by using .clone on the character objects so that I would have their data but they weren't the originals so their data won't be affected.

That is, by default, a character swap of the first and second character would turn [1,2,3,4] into 2,1,3,4.  With my edit, [1,2,3,4] would look like 1,2,3,4 but if I start to move, 2 would be moving (and 1,3,4 will follow).

Of course, the second part of the code involves which character data to implant or else default data like x and y position would keep the position of the player (first character) where they are.  Obviously, x/y (designation position) and real x/y (moving position) will are both needed as having only one would make the character walk to that point.  Also, jumping pads require me to change jump_count (method made) for height and I would like to preserve directions.  Although I decided to copy the whole list, there are some data that I would have to remove as they are either updated automatically or could present problems.  For example, through is kicked off since you're passing a follower's through over a player's not-through.

But anyway, characters swap "control" instead of position.  This could have some interesting implications if I choose to split the party  in two.

---

General setup for the "control" swap via party-swap:
-Make array and record [0] for game_player.clone
-Loop for the follower.clone for the other parts of the array
-Default swap_order lines (swap actors, refresh player and followers by proxy)
-Swap the character array
-Reassign character values for the player and repeat for the followers
*Used a separate method to reassign character variables in character section.

No comments:

Post a Comment