I want to trigger an event if any of my party are standing in a particular region. After following this tutorial, I know how to do this for the player. But not for the entire party. How can I accomplish this? Thanks.
Region ID of entire party
RPG Maker MV SupportI don't have MV with me right now, but it'll be based on followers, and I'm not sure if that's $gameParty.followers() or if there's a $gameFollowers class.
Try this in the script section of a conditional branch:
replacing 15 with whatever region you're interested in.
Actually, I'm not sure if that's the correct way to get the actor that's attached to a follower. I'll take a look when I get home and come back & change it if it's not correct.
Try this in the script section of a conditional branch:
Code:
$gameParty.followers().any(function(follower) { return follower.actor().regionId() === 15; } )
replacing 15 with whatever region you're interested in.
Actually, I'm not sure if that's the correct way to get the actor that's attached to a follower. I'll take a look when I get home and come back & change it if it's not correct.
The correct array function in Javascript is "some" 🙂 From reading Ruby documentation, I believe "any" in Ruby fulfills exactly the same purpose.
Side note: The word "followers" looks stranger the more you look at it...
- An instance of the Game_Followers "wrapper" class is assigned as a property of Game_Player
- It can be accessed by the Game_Player '_followers' property (intended for internal) or the 'followers()' method (intended for external)
- Game_Followers contains an array of Game_Follower in its property '_data' (intended for internal)
- No method exists to give us the data intended for external, so we have to use the internal one
Code:
$gamePlayer.followers()._data.some(function(follower) { return follower.actor().regionId() === 15; } )
Side note: The word "followers" looks stranger the more you look at it...
Original thread: https://forums.rpgmakerweb.com/threads/region-id-of-entire-party.93581/