Battle Symphony re-orienting party direction mid-game?

TSED

Underfoot
Member
Joined
Feb 12, 2014
Messages
28
Reaction score
9
First Language
English
Primarily Uses
I am using a number of Yanfly's scripts as well as Yami's Battle Symphony, and I was wondering how I would go about doing the following:

When I want to have a boss-fight type thing, change the party alignment (from PARTY DIRECTION 6 to PARTY DIRECTION 2) and then change the actor locations.

Basically, the majority of the battles would be fought with a left-aligned party facing right. On occasion I'd like to shake that up, but I have no idea how.

Yanfly's Core / Party Manager are in play.  Here's a link to the Party Manager: http://yanflychannel.wordpress.com/rmvxa/core-scripts/party-system/

Yami's Battle Symphony: http://symphonyan.org/battle-symphony-introduction/


Other scripts are in play but I am reasonably certain they won't matter. (I know the odd bit about programming and as far as I can tell none of the variables and whatnot are shared.)  If it turns out I'm wrong I'll do a complete listing.

I imagine it'd be something like this:

Common Event (BossFightStart) called. (This has a number of script calls that change the party direction & locations.)

BATTLE PROCESSING GOES HERE.

Common Event (BossFightsOver) called.  (This has script calls that undo the BossFightsStart's changes).

If what I'm asking is confusing, I could provide screenshots demonstrating what I'm trying to do. I'd prefer not to, though, because effort.

Any help would be appreciated!
 
Last edited by a moderator:

Peridot Gaming

Veteran
Veteran
Joined
Nov 25, 2012
Messages
123
Reaction score
14
First Language
English
Primarily Uses
My initial thought is that you could change the line 1639 in the Battle Symphony script (the first line of code in break_pose) from:

@direction = SYMPHONY::View::pARTY_DIRECTIONto be:

@direction = $game_variables[x]where you make x the id of a variable to be used.  You would then just need to update the variable whenever you want to change the direction that the party faces (in your example it would be in your Common Events).  You would also need to set this initially - probably at the start of your game.

It would mean that the PARTY_DIRECTION setting in the script is not used.

Disclaimer: This is completely untested.  :)
 

TSED

Underfoot
Member
Joined
Feb 12, 2014
Messages
28
Reaction score
9
First Language
English
Primarily Uses
My initial thought is that you could change the line 1639 in the Battle Symphony script (the first line of code in break_pose) from:

@direction = SYMPHONY::View::pARTY_DIRECTIONto be:

@direction = $game_variables[x]where you make x the id of a variable to be used.  You would then just need to update the variable whenever you want to change the direction that the party faces (in your example it would be in your Common Events).  You would also need to set this initially - probably at the start of your game.

It would mean that the PARTY_DIRECTION setting in the script is not used.

Disclaimer: This is completely untested.  :)
Oh, nice.  I'll test it out when I have some time to, but one gaping hole is that the actor's X's and Y's would remain unchanged.  They would still be lined up along the lefthand side, just facing upwards instead of right now.  Any suggestions there?

(I am familiar with needing to set up switches / variables at the beginning.  I think I've got 5 that need setting before anything happens so far, so it's easy to implement!)

EDIT:: Yep, it worked like a charm.  Now to figure out how to have the party directions set.

Hmm.  I could probably just use the exact same principle, though it'll be less elegant...  MORE NEWS AT 11.

MORE EDIT:: Nope.  It's stored as an array, from what I can tell, and I don't know enough about programming to fiddle with this.

What I believe to be the relevant code:

def set_default_position super return if @origin_x && @origin_y return unless $game_party.battle_members.include?(self) @origin_x = @screen_x = @destination_x = SYMPHONY::View::ACTORS_POSITION[index][0] @origin_y = @screen_y = @destination_y = SYMPHONY::View::ACTORS_POSITION[index][1] return unless emptyview? @origin_x = @screen_x = @destination_x = self.screen_x @origin_y = @screen_y = @destination_y = self.screen_y endHowever, there is another method:

def correct_origin_position return if @origin_x && @origin_y @origin_x = @screen_x = SYMPHONY::View::ACTORS_POSITION[index][0] @origin_y = @screen_y = SYMPHONY::View::ACTORS_POSITION[index][1] return unless emptyview? @origin_x = @screen_x = @destination_x = self.screen_x @origin_y = @screen_y = @destination_y = self.screen_y endWhich might be important and/or relevant instead.  I'm unsure.

For ease of gurus, here is the initial blip that defines the locations with the comments cut out:

module View EMPTY_VIEW = false PARTY_DIRECTION = 6 ACTORS_POSITION = { 7 => [100, 224], 5 => [116, 244], 3 => [132, 264], 1 => [148, 284], 0 => [148, 304], 2 => [132, 324], 4 => [116, 344], 6 => [100, 364], 8 => [216, 394], } end The EMPTY_VIEW is related to another option, and I think I can cut out "PARTY_DIRECTION" but I'm not brave enough to.
 
Last edited by a moderator:

Peridot Gaming

Veteran
Veteran
Joined
Nov 25, 2012
Messages
123
Reaction score
14
First Language
English
Primarily Uses
I have a couple of ideas about this, but am at work at the moment so will have a go at it when I get home in a couple of hours.

If you don't feel brave enough to cut PARTY_DIRECTION out of the script, just put # in front of it.  That will leave it in the script but will just make it so the line is commented out.

Edit:

Ok, I've looked into it and believe I have a solution for you.  It may not be too elegant, and again I haven't tested it in Battle Symphony but in my testing script it seemed to do what I wanted.

It's a bit awkward but I'll try to explain what I have done:

Change the ACTORS_POSITION definition so that it now meets this structure:

ACTORS_POSITION = {               #Dir=1     #Dir=2    #Dir=3    #Dir=4    #Dir=5    #Dir=6    #Dir=7    #Dir=8    #Dir=9      0 =>  [[148, 284],[150,300],[155,305],[160,310],[165,320],[170,330],[180,335],[185,340],[190,350]],      1 =>  [[148, 284],[150,300],[155,305],[160,310],[165,320],[170,330],[180,335],[185,340],[190,350]],      2 =>  [[148, 284],[150,300],[155,305],[160,310],[165,320],[170,330],[180,335],[185,340],[190,350]],      3 =>  [[148, 284],[150,300],[155,305],[160,310],[165,320],[170,330],[180,335],[185,340],[190,350]],      4 =>  [[148, 284],[150,300],[155,305],[160,310],[165,320],[170,330],[180,335],[185,340],[190,350]],      5 =>  [[148, 284],[150,300],[155,305],[160,310],[165,320],[170,330],[180,335],[185,340],[190,350]],      6 =>  [[148, 284],[150,300],[155,305],[160,310],[165,320],[170,330],[180,335],[185,340],[190,350]],      7 =>  [[148, 284],[150,300],[155,305],[160,310],[165,320],[170,330],[180,335],[185,340],[190,350]],      8 =>  [[148, 284],[150,300],[155,305],[160,310],[165,320],[170,330],[180,335],[185,340],[190,350]],    }What this has done is change each of the ACTORS_POSITION arrays from simply [x,y] to now be an array of 9 arrays, each containing [x,y].  These 9 arrays now relate directly to directions 1 - 9 (although not sure if 5 is really used or not).  Basically you need to include the 9 arrays for each battle member so that the next couple of code changes can find the correct array and use the specified positions included in it.  Now I have gone and been lazy and set all the party positions to be the same for each party member, but you will need to set each [x,y] to be correct (like i said, I was lazy).  You must include all 9 arrays of [x,y] otherwise you may break things if you set your direction variable to be a number where the array doesn't exist.

Then change the 2 posted methods to be:

def set_default_position    super    return if @origin_x && @origin_y    return unless $game_party.battle_members.include?(self)    dir = $game_variables[x]    #<------- remember to change x to your variable id    @origin_x = @screen_x = @destination_x = SYMPHONY::View::ACTORS_POSITION[index][dir-1][0]    @origin_y = @screen_y = @destination_y = SYMPHONY::View::ACTORS_POSITION[index][dir-1][1]    return unless emptyview?    @origin_x = @screen_x = @destination_x = self.screen_x    @origin_y = @screen_y = @destination_y = self.screen_y  endand

def correct_origin_position    return if @origin_x && @origin_y    dir = $game_variables[x]    #<------- remember to change x to your variable id    @origin_x = @screen_x = SYMPHONY::View::ACTORS_POSITION[index][dir-1][0]    @origin_y = @screen_y = SYMPHONY::View::ACTORS_POSITION[index][dir-1][1]    return unless emptyview?    @origin_x = @screen_x = @destination_x = self.screen_x    @origin_y = @screen_y = @destination_y = self.screen_y  endJust remember to change [x] to be the id of the variable you are using.

Hopefully this all works okay.

If you have any problems with this, just let me know as I am never sure if I am explaining what I am doing overly well at times.
 
Last edited by a moderator:

TSED

Underfoot
Member
Joined
Feb 12, 2014
Messages
28
Reaction score
9
First Language
English
Primarily Uses
First, I definitely appreciate the help!  I would have no idea what I'm doing whatsoever and likely just scrap the idea altogether without you.  And I don't know what you mean by inelegant, because it's a single variable that solves all the problems!  So much nicer than anything I'd scribble together.

EDIT:: I am an idiot.  The problem was that I mislabeled actor 3 in the coordinate array as 4.  YEP.

 

Second, I followed your instructions.  (Remembered to swap out the variable, as you'll see).  It worked perfectly for 1-3 battlers (as in characters-in-party), but when I use 4 or more I get the following error:

Script "Battle Symphony" line 1807: NoMethodError occurred.

undefined method '[]' for nil:NilClass
The line in question is: 

@origin_x = @screen_x = SYMPHONY::View::ACTORS_POSITION[index][dir-1][0]From the whole thing:

def correct_origin_position return if @origin_x && @origin_y dir = $game_variables[4] #<------- remember to change x to your variable id @origin_x = @screen_x = SYMPHONY::View::ACTORS_POSITION[index][dir-1][0] @origin_y = @screen_y = SYMPHONY::View::ACTORS_POSITION[index][dir-1][1] return unless emptyview? @origin_x = @screen_x = @destination_x = self.screen_x @origin_y = @screen_y = @destination_y = self.screen_y end-----------------------------
Secondly, I have a question.  There will be at most four party directions in play - 2, 4, 6, and 8.  Battle Symphony only supports those directions.  Would it be safe to scrap the other arrays?
 
Last edited by a moderator:

Peridot Gaming

Veteran
Veteran
Joined
Nov 25, 2012
Messages
123
Reaction score
14
First Language
English
Primarily Uses
With regards to only using directions 2,4,6 and 8:

Make it so that you only have 4 arrays for each ACTORS_POSITION like this

ACTORS_POSITION = {               #Dir=2     #Dir=4    #Dir=6    #Dir=8      0 =>  [[148, 284],[150,300],[155,305],[160,310]],      1 =>  [[148, 284],[150,300],[155,305],[160,310]],      2 =>  [[148, 284],[150,300],[155,305],[160,310]],      3 =>  [[148, 284],[150,300],[155,305],[160,310]],      4 =>  [[148, 284],[150,300],[155,305],[160,310]],      5 =>  [[148, 284],[150,300],[155,305],[160,310]],      6 =>  [[148, 284],[150,300],[155,305],[160,310]],      7 =>  [[148, 284],[150,300],[155,305],[160,310]],      8 =>  [[148, 284],[150,300],[155,305],[160,310]],    }and then change the methods that I gave you so that instead of

[dir-1]you have

[(dir/2)-1]that should then make it so the following occurs:

Direction 2 divided by 2 = 1, minus 1 = 0, so array #0 is used

Direction 4 divided by 2 = 2, minus 1 = 1, so array #1 is used

Direction 6 divided by 2 = 3, minus 1 = 2, so array #2 is used

Direction 8 divided by 2 = 4, minus 1 = 3, so array #3 is used

Do you still have an issue with what you put in your spoiler tag, or is that fixed by what you mentioned in your edit?

I'm hoping that this will all work, but just let me know if there are any issues.
 
Last edited by a moderator:

TSED

Underfoot
Member
Joined
Feb 12, 2014
Messages
28
Reaction score
9
First Language
English
Primarily Uses
Yeah, the edited in "I'm an idjit" bit was for the now-spoilered problem.

I'm curious why the method needs to change.  Wouldn't I be able to just cut out the extraneous arrays and just be conscious of the variable number?  I'll also confess that I don't understand what the divide-by-two change does, and I'd like to!  Is it because the array-of-arrays has them ordered on a 1-to-1 basis and so that if, for example, a 6 goes in, it looks for the 6th array?  Thus /2 so that 6/2 = 3 (aka 3rd array)?
 

Peridot Gaming

Veteran
Veteran
Joined
Nov 25, 2012
Messages
123
Reaction score
14
First Language
English
Primarily Uses
TSED, on 10 Sept 2014 - 3:54 PM, said:Yeah, the edited in "I'm an idjit" bit was for the now-spoilered problem.

I'm curious why the method needs to change.  Wouldn't I be able to just cut out the extraneous arrays and just be conscious of the variable number?  I'll also confess that I don't understand what the divide-by-two change does, and I'd like to!  Is it because the array-of-arrays has them ordered on a 1-to-1 basis and so that if, for example, a 6 goes in, it looks for the 6th array?  Thus /2 so that 6/2 = 3 (aka 3rd array)?
 

Good to know that the problem was no longer a problem.   :)

 

As for the rest: you could leave any of the unused arrays in there (perhaps setting any unused ones for invalid directions to [0,0] so you can see that they are not used), however I was going for a bit more of a neater solution so that you wouldn't have a load of empty, or unused, arrays in the ACTORS_POSITION setup.  To be honest, though, if you just wanted to set the unused ones to [0,0] then that should be fine.

 

The divide by 2 bit was because I was simplifying the ACTORS_POSITION setup.  If we were to take the first actor position line of the new setup as I provided:


ACTORS_POSITION = {               #Dir=2     #Dir=4    #Dir=6    #Dir=8      0 =>  [[148, 284],[150,300],[155,305],[160,310]],    }

What we have are 4 arrays for use as the direction positions.  Now any array list always starts at index 0.  So the first array ([148,284]) is actually index 0 of the array for the actor.

Because we have a set of very specific numbers for the directions (2,4,6 and 8) we need to translate each of those into an equally specific position with the array for actor 0.  So my whole divide by 2 process was to fit in with this new ACTORS_POSITION setup.  It works like this example:

1) We set our DIRECTION variable to be 4.

2) If we were just to use the existing method I had done, then this would become 3 (dir-1 = 3).  This would then look at the array with an index of 3, which is actually the 4th array in the list.  Arrays always start with an index of 0.  This therefore returns the wrong position array ([160,310]), instead of [150,300] (the 2nd array in the list as we are using the 2nd possible direction).

3) What I looked at doing instead was because we have 4 possible numbers that are used for the positions, we would need to look at how to align each number with the correct array for the actor.  This came down to looking like this:


Code:
Direction   Array #2             04             16             28             3
It is immediately apparent that these Directions are all divisible by 2.  If we were to take each Direction and divide it by 2, we would end up with:


Code:
Direction   After Division2               14               26               38               4
This is pretty close to what we need, but with arrays starting at index 0, we just need to do the -1 to get the correct array position:


Code:
After Division  After -11                  02                  13                  24                  3
 

Hopefully I'm actually making sense here, and not just disappearing down a deep dark corridor of horrible maths and programming.   :o

 

 Is it because the array-of-arrays has them ordered on a 1-to-1 basis and so that if, for example, a 6 goes in, it looks for the 6th array?  Thus /2 so that 6/2 = 3 (aka 3rd array)?
You're basically right here.  The only thing is 6/2 = 3, but that is actually the 4th array :)  Arrays start at 0, hence why I did the old divide by 2 and subtract 1 (6/2-1 = 2 which is the 3rd array)

 
 

Users Who Are Viewing This Thread (Users: 0, Guests: 1)

Latest Threads

Latest Posts

Latest Profile Posts

so hopefully tomorrow i get to go home from the hospital i've been here for 5 days already and it's driving me mad. I miss my family like crazy but at least I get to use my own toiletries and my own clothes. My mom is coming to visit soon i can't wait to see her cause i miss her the most. :kaojoy:
Couple hours of work. Might use in my game as a secret find or something. Not sure. Fancy though no? :D
Holy stink, where have I been? Well, I started my temporary job this week. So less time to spend on game design... :(
Cartoonier cloud cover that better fits the art style, as well as (slightly) improved blending/fading... fading clouds when there are larger patterns is still somewhat abrupt for some reason.
Do you Find Tilesetting or Looking for Tilesets/Plugins more fun? Personally I like making my tileset for my Game (Cretaceous Park TM) xD

Forum statistics

Threads
105,868
Messages
1,017,074
Members
137,578
Latest member
JamesLightning
Top