RMRK is retiring.
Server is paid up for the rest of 2026, but the forum may go after that. See here for more information. Please archive or save anything you would like to keep before 2027.
Main Menu
  • Welcome to The RPG Maker Resource Kit.

VXA] Check Monster # in Troop?

Started by mr.watson, August 24, 2014, 09:50:25 PM

0 Members and 1 Guest are viewing this topic.

mr.watson

This has been driving me crazy for a little while. I'm trying to make a system where you can talk to the enemies during battle and convince them to join you. i want to have "affection" of enemies increase if you give them what they want, and I would use variables for the affection. What I'm having trouble with is how to keep track of which enemy has how much affection.

Is there a way I can check a monsters number within the troop? For example, if I want to add 5 affection to monster 1, how would I go about saying "if target monster is #1 in the troop, then variable a. =+5". I'm setting this up within a common event as well.

Zexion

$game_troop.members[#].enemy_id
# is the enemies index.

mr.watson

#2
Thanks for such a prompt reply!

I have it set up as $game_variables[4] = $game_troop.members[1].enemy_id but it's coming up with the error undefined method 'enemy_id' for nil:nilclass

Am I doing something stupid?

Edit: The explanation may have been poorly worded. I'm looking to make it so if I use this skill on "enemy 1", then the variable associated with enemy 1 increases. Is there a way I can make it so "if skill a. hits enemy 1, variable x is set to 1. But if skill a. hits enemy 2, variable x is set to 2."?

Zexion

#3
Do you have 2 or more enemies? $game_troop.members[1].enemy_id is the second enemy. $game_troop.members[0].enemy_id is the first enemy.
Also, then I think your request is a bit more complicated. I'm making a script for you right now
Edit: I actually might not be able to do this o.o
I have no idea how to get the last skill used, or the skill ID in general lol

mr.watson

You're right, that was the reason for the error :/ Still can't make it accomplish exactly what I'm looking for unfortunately, so I would really appreciate a script. Thanks for taking the time =)

Euphoria

What features do you want in the script? If it's something short I'll write it up for you when I get the time. If it's longer but interesting to me, I'll still probably write it, it just might take a bit longer since I start school tomorrow.
My Website:

:tinysmile:

mr.watson

The way I want the enemy trust system to work is you use a talk skill on an enemy, and he tells you what he wants. If you give him what he wants, his trust of you will increase, which I'm going to use a variable for.

So the script would be to take the index of the enemy you use the skill on into a variable. For example, if I use the skill on the first enemy in the troop, then when his trust goes up it will increase variable a. If I use the skill on the second enemy in the troop however, then variable b. will increase. I'll be using 4 variables, which is the max number of enemies I'm going to have in a single battle.

Euphoria

I'll look into writing it, but I have a large list of stuff to do, so I hope it's not urgent.
My Website:

:tinysmile:

mr.watson

Nope, whenever you get a chance is great, thanks =)

Euphoria

Gonna give it a shot right now. Most likely won't finish it for a bit though. Just gonna get started and gauge how much work this will take.
My Website:

:tinysmile: