Hime party manager

Ah as I suspected $gameMap.idlePartyEvent(#) doesn't give the event ID but the entire object.
View attachment 146529

$gameMap.idlePartyEvent(#)._eventId is how you get the event ID for the other parties.

So for party 2 it would be....
JavaScript:
Math.round($gameMap.distance($gameMap.event(this._eventId).x, $gameMap.event(this._eventId).y, $gameMap.event($gameMap.idlePartyEvent(2)._eventId).x, $gameMap.event($gameMap.idlePartyEvent(2)._eventId).y) <= 1)

There is a problem here though. Any party the player is in control of no longer counts as an event but instead the player object. So if the player controls party 2, then this code would error as party no longer exists. So to get around that, you need to encase it in a conditional to check if the $gameMap.idlePartyEvent(#) is undefined.... Else you'll get an error every frame.

View attachment 146530


Finally, because the player object is a potential thing the enemy can encounter, you'll need a conditional statement just for that....
JavaScript:
Math.round($gameMap.distance($gameMap.event(this._eventId).x, $gameMap.event(this._eventId).y,
$gamePlayer.x, $gamePlayer.y) <= 1)
in a conditional will work. You don't have to worry about this one being undefined as the player is always somewhere on the map.
Okay I noticed one problem. When the enemy unit comes in contact with 1 of my idle parties a battle engages, but the party that is engaged in battle is the party under my control and not the idle party.
Add the party switch trigger to that party in the conditional statement.

This thread is being closed, due to being solved. If for some reason you would like this thread re-opened, please report this post and leave a message why. Thank you.

Reopening at OP's request.

After doing some game testing I realized that the idle party is engaging in battle twice so that means that the battle processing is going twice and I don't know why. Everything else is working perfectly. I tried all sorts of things to make it stop engaging in battle twice but nothing works. Here's how I have my parallel event working.
Code:
◆If:Script:$gameMap.idlePartyEvent(1) !== undefined
  ◆If:Script:Math.round($gameMap.distance($gameMap.event(this._eventId).x, $gameMap.event(this._eventId).y, $gameMap.event($gameMap.idlePartyEvent(1)._eventId).x, $gameMap.event($gameMap.idlePartyEvent(1)._eventId).y) <= 1)
    ◆Script:Party.switch(1);
    ◆Battle Processing:Advance Scout
    :If Win
      ◆Control Self Switch:A = ON
      ◆
    :If Escape
      ◆Set Movement Route:Player (Wait)
      :                  :◇Script:this.jump_to(4,0)
      ◆
    :If Lose
      ◆Set Movement Route:Player (Wait)
      :                  :◇Script:this.jump_to(4,0)
      ◆
    :End
    ◆
  :End
  ◆
:End
Trying showing a message before the party switch, after the party switch, and after the battle processing.

See how many messages get triggered.

The logic seems fine but parallel processing might do something weird.
Or it could be related to that Party.switch (when the player takes control of the party)

Anyways if it's executing twice, you should see two sets of messages.
If you disable the parallel process does nothing happen as expected?
Trying showing a message before the party switch, after the party switch, and after the battle processing.

See how many messages get triggered.

The logic seems fine but parallel processing might do something weird.
Or it could be related to that Party.switch (when the player takes control of the party)

Anyways if it's executing twice, you should see two sets of messages.
If you disable the parallel process does nothing happen as expected?
Code:
◆If:Script:$gameMap.idlePartyEvent(1) !== undefined
  ◆If:Script:Math.round($gameMap.distance($gameMap.event(this._eventId).x, $gameMap.event(this._eventId).y, $gameMap.event($gameMap.idlePartyEvent(1)._eventId).x, $gameMap.event($gameMap.idlePartyEvent(1)._eventId).y) <= 1)
    ◆Text:None, Window, Bottom
    :    :Come and join us. Ignorance is bliss when you are part
    :    :of the nexus.
    ◆Script:Party.switch(1);
    ◆Battle Processing:Advance Scout
    :If Win
      ◆Control Self Switch:A = ON
      ◆
    :If Escape
      ◆Set Movement Route:Player (Wait)
      :                  :◇Script:this.jump_to(4,0)
      ◆
    :If Lose
      ◆Set Movement Route:Player (Wait)
      :                  :◇Script:this.jump_to(4,0)
      ◆
    :End
    ◆
  :End
  ◆
:End
so I figured it out. I needed to insert a text box in front of the party switch script command. The text would read twice, once before the battle processing and again after the battle processing, but at least the player will not have to fight two battles.
I think we still need to figure out why parallel process event does that lol.

Game message processing basically interrupts it

Basically a parallel process should stop at the battle trigger. Once the battle is over, it will check the result and continue. If the battle gets called twice, there's something weird happening.
@Tsukihime: it might be related to the reserveTransfer call in Game_Player.prototype.refreshPartyLocation (HIME_PartyManager). Maybe try adding something like interpreter.setWaitMode('transfer'); immediately after so it pauses 1 frame for the transfer to complete? 😅

(Each parallel event runs through an interpreter attached to the event itself, so when the map changes, all parallel events stop where they are.)

Edit: oh wait, that's awkward because you don't know which interpreter to reference from that context... 😴
@Tsukihime: it might be related to the reserveTransfer call in Game_Player.prototype.refreshPartyLocation (HIME_PartyManager). Maybe try adding something like interpreter.setWaitMode('transfer'); immediately after so it pauses 1 frame for the transfer to complete? 😅

(Each parallel event runs through an interpreter attached to the event itself, so when the map changes, all parallel events stop where they are.)

Edit: oh wait, that's awkward because you don't know which interpreter to reference from that context... 😴

I set up a simple project. 2 MB.



One map, one event top-left

Page 1: create party 2 right below the event, turn on self switch A to go to page 2

Page 2: move event down (through on). Check if event position == party 2 position. If so, battle processing, then turn on self-switch B to go to page 3

Page 3: nothing

It only triggers it once for me though.

EDIT: wow you can actually browse the files right in the forum. Anyways pop it out to download as archive.
I tried setting up 1 of my enemy units according to the example that was given to me, but for some reason now the unit won't even engage in battle. If you have time please download my project and see. All you have to do is start on the map "Path to Ambush4"
One map, one event top-left

Page 1: create party 2 right below the event, turn on self switch A to go to page 2

Page 2: move event down (through on). Check if event position == party 2 position. If so, battle processing, then turn on self-switch B to go to page 3

Page 3: nothing

It only triggers it once for me though.
Yea, I can't get it to run twice either... 😴

I was focusing on the "runs twice" thing and thinking it was related to Scene_Map.prototype.updateMain updating in the order events > player > change scene. Not sure about that though.
If you have time please download my project and see.
Whoa, 1.2 GB! 👋 Can you maybe reproduce the effect by copying the relevant events into Hime's little sample project? 😅

Something you could try is turning off your other plugins, since this particular scenario only needs Hime's Party Manager (correct?). If it works OK with the other stuff turned off, it's probably a plugin compatibility or load order issue.

(An aside: I notice that amongst other things you seem to have my OverpassTileExt plugin in there. If you want to use it, I'd suggest naming the file Cae_OverpassTileExt, else it won't see its own plugin parameters. Also, I think it replaces all the methods from the original OverpassTile plugin. 🙂)
1.2 gigs is way too big for a simple example lol can you download the example I have and copy the event over.
Yea, I can't get it to run twice either... 😴

I was focusing on the "runs twice" thing and thinking it was related to Scene_Map.prototype.updateMain updating in the order events > player > change scene. Not sure about that though.

Whoa, 1.2 GB! 👋 Can you maybe reproduce the effect by copying the relevant events into Hime's little sample project? 😅

Something you could try is turning off your other plugins, since this particular scenario only needs Hime's Party Manager (correct?). If it works OK with the other stuff turned off, it's probably a plugin compatibility or load order issue.

(An aside: I notice that amongst other things you seem to have my OverpassTileExt plugin in there. If you want to use it, I'd suggest naming the file Cae_OverpassTileExt, else it won't see its own plugin parameters. Also, I think it replaces all the methods from the original OverpassTile plugin. 🙂)
Yeah I'll do that. My project when deployed is only 400 mb because I exclude unused files. I have a bunch of unused stuff in there 🙂 I'm a noob and this is my first project so I'm trying alot of crazy stuff that never works.
1.2 gigs is way too big for a simple example lol can you download the example I have and copy the event over.
Ok I figured it out. I have to set all my movement routes to through on then only will the battle engage. You know I was thinking, this plug-in can be used to do some really cool things. With some small tweaks like overhead map with pause option, a cursor to select parties, some minor AI for the enemy event parties, it would be easy to create a game like ogre battle. I don't think this would conflict with any other yanfly plug-in. Have you ever played ogre battle?
Ok I figured it out. I have to set all my movement routes to through on then only will the battle engage. You know I was thinking, this plug-in can be used to do some really cool things. With some small tweaks like overhead map with pause option, a cursor to select parties, some minor AI for the enemy event parties, it would be easy to create a game like ogre battle. I don't think this would conflict with any other yanfly plug-in. Have you ever played ogre battle?

I haven't played ogre battle but that sounds like a creative use of the plugin.
You can also bind party switch to a button like page up or page down to go through the parties on the map and try to do micro manage each party to optimize something

If you manage to get something working share a video it'd be interesting to watch.
I haven't played ogre battle but that sounds like a creative use of the plugin.
You can also bind party switch to a button like page up or page down to go through the parties on the map and try to do micro manage each party to optimize something

If you manage to get something working share a video it'd be interesting to watch.
In my game I already bound party switch to a button like page up. But I am only able to bind one script call to one button. Is it possible to bind more than one script call to one button. I would love for the player to able to scroll through their parties using just page up and page down. Right now I have page up bound to switch to party 1, page down party 2, shift-3, ok-4, and so on.
In my game I already bound party switch to a button like page up. But I am only able to bind one script call to one button. Is it possible to bind more than one script call to one button. I would love for the player to able to scroll through their parties using just page up and page down. Right now I have page up bound to switch to party 1, page down party 2, shift-3, ok-4, and so on.

You can have the script call check the current party number and increase or decrease by 1. If it's the smallest or largest ID, wrap around.
You can have the script call check the current party number and increase or decrease by 1. If it's the smallest or largest ID, wrap around.
I read and reread your help manual, but I didn't come across a script for checking current party number per se. I assume maybe you're speaking of "Active Party Variable" which I'm supposed to add and subtract from. Do you have a link or example I can follow. My mind is not the most mathematical mind and this stuff is really hard for me to understand. Thanks so much. Here's a link to Ogre Battle one of my fav old school rpgs .
I read and reread your help manual, but I didn't come across a script for checking current party number per se. I assume maybe you're speaking of "Active Party Variable" which I'm supposed to add and subtract from. Do you have a link or example I can follow. My mind is not the most mathematical mind and this stuff is really hard for me to understand. Thanks so much. Here's a link to Ogre Battle one of my fav old school rpgs .


I looked at the plugin and there isn't an easy to scroll between parties.
One way is this
Code:
var parties = $gameParties.parties();
var index = parties.indexOf($gameParty);
var newIndex = index + 1;
if (newIndex >= parties.length) {
   newIndex = 0;
}
var newPartyId = parties[newIndex].id;
Party.switch(newPartyId);

What this code does is first you grab all the parties in the game, which gives something like this

Code:
[Party1, Party2, Party3]

Then you figure out the position of the current party which is $gameParty.
Assuming we're currently Party 3, it will give you 2, because the index starts with 0 instead of 1

So now you have the index of the current party. You want to find the next party, which we'll assume is just index + 1

But because we're already the last party, we need to make sure we wrap around to the first in the list, which is what the condition check is for.

Finally, now you have the index of the party, you grab the party from the list, get the ID, and then call Party.switch as usual.

It's similar logic if you want to scroll backwards

Code:
var parties = $gameParties.parties();
var index = parties.indexOf($gameParty);
var newIndex = index - 1;
if (newIndex < 0) {
   newIndex = parties.length - 1;
}
var newPartyId = parties[newIndex].id;
Party.switch(newPartyId);

Now if you bind one to page up and the other to page down, now you should be able to scroll through all of your parties.

Original thread: https://forums.rpgmakerweb.com/threads/hime-party-manager.121551/