Skip to main content

Indie game storeFree gamesFun gamesHorror games
Game developmentAssetsComics
SalesBundles
Jobs
TagsGame Engines
(2 edits)

Hey how's it going?


I have a super specific question but I hope you can answer it, I'm using the menu commands to add a custom button that gives you the ability to talk to party members, this is the code so far:-


var target = $gameParty.members()[index];
target.addState(5);
$gameTemp.reserveCommonEvent(3);

I'm using a state to determine which party member was chosen, the problem is that i don't know how to get the chosen party member index using the Is Personal effect. How do i do that exactly?

I know the answer might be obvious but I'm braindead when it comes to coding


P.S: Sorry forgot to say that I want to replace the index in the first line of code with the chosen actor's index. Thought that i needed to specify.

Well, this question isn't obvious at all!

Fortunately, you can easily retrieve the selected actor using $gameParty.menuActor(), so your snippet will look like this:

$gameParty.members().forEach((actor) => actor.removeState(5));
var target = $gameParty.menuActor();
target.addState(5)
$gameTemp.reserveCommonEvent(3)

By the way, that's an RPG Maker core code function and not an MK exclusive.

PS:

I also added a one-liner at the top to clear the state from all other members, you can of course remove it if you don't need it :)

Yep it works perfectly now. TSYM! 🙏