SAVING HERO ID OF ACTOR USING SKILL

Posts

Pages: 1
Hello everyone. I have been working on a project (using VX Ace) and am having a problem with what I am trying to accomplish. I have searched through many posts here and cannot find what I am trying to do (aside from possibly scripting, which I have not tried yet and am new to scripting). I am trying to find a way to have a skill that when it is used, it will save the actor ID of the 'user'. I understand how to save a specific ID to a variable for a designated actor, but what I need is to save it for whomever 'uses' that skill.
For example: Actor 1 uses this particular skill, and it saves Actor 1's ID to variable X. Later, Actor 2 uses the same skill, and it now saves Actor 2's ID to variable X. I would like to be able to call variable X through events (focusing only on the last actor to use the particular skill, multiple actors will have the same skill).
I tried to even have it save the id through the damage calculation formula box (I found wonderful tutorials on the overall usage of that box), but those only had temporary variables. Is this even possible what I am attempting without learning to write custom scripts?

Addendum: I have been trying to respond to this thread for 2 days, and it keeps telling me "Hey, Hey, Hey, Slow down buddy!"
This was easy and I know a lot of people would find a use for it, so I decided to script it myself. Sadly, there is no way to do this without scripting it. Anyway, I submitted it to this website. It will be available at this link: http://rpgmaker.net/scripts/289/.

Let me know if there is any other things you would like for the script to be able to do.
Thank you for the quick reply. I was hoping that it wouldn't come down to scripting, but I'll work with what I get. I am watching video tutorials on scripting, and hoping to get a handle on how they function better. I can follow the basic commands and ideas easily enough (I used to poke around coding in C and Basic), but so far I am having problems getting the script to function.

I keep receiving this error message: Script 'Game_Interpreter' line 543: NoMethodError occured. undefined method 'id' for nil:NilClass

Steps I have done so far to install/run:

1. Taken the script graciously provided by MakoInfused (thanks again btw) and put it under the Materials section of the Script Editor .

2. Created a new skill as a testing point for the memorization of the battler to try and understand better how it works. Skill 154: TestingBattlerInfo; set to Combat(skill type, and my actor has all the proper access to the skill); hp damage and formula = "4"; effects calls a new Common Event created (009: TestingBattlerInfo).

3. Created Common Event TestingBattlerInfo. The flow of the event goes as such:
A. Text Window (Setting variable to ID, hopefully)
B. Control Variables: (0020:TestingBattlerInfo) = $battle_info_current_battler.id
C. Text Window (Set to Battler ID)
D. Change Level: Variable(0020:TestingBattlerInfo), +10


In the middle of combat, I select the skill, and it triggers. The round finishes with all participants using actions, and then the event triggers and text window from "A." shows on the screen. I press a button to continue, and that is the point it crashes. I am fairly certain that it is something simple I overlooked or misunderstood when trying to implement the script and/or script call.
It looks like it's a pretty simple problem, with a simple solution. You set the variable to "$battle_info_current_battler.id", right? However, in the directions it actually asks you to use "battle_info_current_battler.id". Notice there should be no "$" symbol before the script command. That should solve your problem!

I appreciate the thorough and detailed breakdown of what you did to get it to work, as that really made it easier to troubleshoot for you. Let me know if there is any further complications. Good luck!

Also, if there is any other form of information you would like to retrieve from the battle system (anything at all), feel free to suggest it. However, I would ask that you do that on the script page itself. We'll keep this DQ area strictly for helping you!
Moving some of the PM's to this public forum so that others may possibly benefit from the help/insight I was given! Thanks again MakoInfused.
----------------------------------------------------------

I am currently using the script calls in conjunction with a conditional statement to call the proper script whether in battle or in menu. I did some digging and found:

$game_party.in_battle

Works like a charm, once I: a. Figured out that it was a True/False condition, b. Remembered that True/False is 0/1, and did some testing to see which variable it was.

Now, a question about this next part-


author=MakoInfused
Well actually...there is a way to change that stuff via a variable. I could make a script, but it's actually not required since you can do that yourself. I don't have time to teach you scripting, unfortunately, but try this out in a script command:

$game_party.members[0].name = "Test"

As you can see, it's pretty straightforward, you're accessing the party, then each member starting with index 0 (the leader) and you're changing his name. Now if you wanted a variable to be responsible for the change, you could instead do:

$game_party.members[0].name = $game_variables[3]

That would make variable number 3, be responsible for setting the name of our party hero.

I understand the flow of what you posted. Party member "0" -> name is changed to whatever variable is in variable #3. But as I look through the default scripting and try to backtrack and find commands, I cannot seem to find an "easy" way to set equipment. The only option I deduced was to backtrack and find the code that sets equipment, and try and use that specific code if possible. Would you consider this the wrong approach, or do you perhaps know of an easier method that I have overlooked. Example of what I am trying to do: Character X uses "Magic Weapon", and it creates a weapon and sets Character X equipped with it. Multiple characters would have this ability, and so it isn't a simple event command to just equip a specific character.

This is one of the points that I needed a way of saving Character X's ID number, so that I can then take X and set the equipment to that hero.

On a side note, I figured out a way to do it via conditional statements... But I currently have 10 heroes, each one sharing multiple skills that another uses... I would like to try to avoid having to type up 10+ conditional statements on EACH individual skill that is "shared".

Again, thanks for the help so far, I am much further along than I could've possibly been on my own. And I am starting to grasp how some of the scripting works...I think.


author=MakoInfused
Ahh, your problem for finding an "easy" way is probably because you're looking in the wrong place. For instance, since each "member" is actually an actor, you have to look at the "Game_Actor" class to get the kind of results you're looking for. However, for your convenience-- I'll just let you know what you want, since you're looking for a specific thing such as changing an equip. In your case you need to do:

$game_party.members[$game_variables[2]].change_equip(0, $game_variables[3])
This would change the equipment of the actor whose id is currently drawn from variable 2. It would take his/her slot 0, or the first slot (the first weapon) to the weapon with the id of whatever variable 3 is currently.

Good luck!

That looks so much easier and less time consuming than all the conditional statements. I will definitely be trying this out now.
Thanks for posting here, and good work. Let me know how this turned out for you.
Pages: 1