The RPG Maker Resource Kit

RMRK RPG Maker Creation => VX Ace => Topic started by: mr.watson on August 24, 2014, 09:50:25 PM

Title: VXA] Check Monster # in Troop?
Post by: mr.watson on August 24, 2014, 09:50:25 PM
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.
Title: Re: VXA] Check Monster # in Troop?
Post by: Zexion on August 24, 2014, 10:04:32 PM
Code: [Select]
$game_troop.members[#].enemy_id
# is the enemies index.
Title: Re: VXA] Check Monster # in Troop?
Post by: mr.watson on August 24, 2014, 11:02:27 PM
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."?
Title: Re: VXA] Check Monster # in Troop?
Post by: Zexion on August 25, 2014, 12:28:51 AM
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
Title: Re: VXA] Check Monster # in Troop?
Post by: mr.watson on August 25, 2014, 05:24:58 PM
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 =)
Title: Re: VXA] Check Monster # in Troop?
Post by: Euphoria on August 26, 2014, 12:51:46 AM
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.
Title: Re: VXA] Check Monster # in Troop?
Post by: mr.watson on August 26, 2014, 11:18:17 AM
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.
Title: Re: VXA] Check Monster # in Troop?
Post by: Euphoria on August 26, 2014, 01:49:28 PM
I'll look into writing it, but I have a large list of stuff to do, so I hope it's not urgent.
Title: Re: VXA] Check Monster # in Troop?
Post by: mr.watson on August 28, 2014, 11:55:21 PM
Nope, whenever you get a chance is great, thanks =)
Title: Re: VXA] Check Monster # in Troop?
Post by: Euphoria on August 29, 2014, 10:36:17 PM
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.