In my project, I want to create a "Steal" skill. I can make the basic mechanics of it, (Drop table, drop rate) however I want to have individual enemies to have separate drop tables.
My original plan was to make a list of each enemy ID in a common event, and use that to have the skill function. Unfortunately, I can't figure out a way to have the system identify an enemy ID, so when it returns a particular number I can use it in the common event to determine which drop table should be checked.
In short, I need some sort of script that would allow me to have the system check an enemy ID so that I can use the ID number in a common event.
The add-on and script calls do provide the database IDs for the target enemy, but I can't seem to figure out how to then use that ID.
I tried making conditional branches that say, "If target.id = 1" or "If target.id = 2" but then it crashes with a message saying
"NameError occurred while running script. Undefined local variable or method 'target' for #<Interpreter:0x5b78ac0>"
I'm confused as to why the variable is supposedly undefined when the script call itself can print the database ID number. Do I need to manually define 'target' as a variable in the common event alongside the script call? And if so, how do I do that?
Okay. Needed to know your rgss/scripting level. Gotcha.
The last part of the scriptette that I posted:
p target.id
Let's change that into something you can use in a Plain Jane 'conditional branch'.
Let us replace that single statement within that script call with:
$game_variables[1] = target.id
As a lesson, the Game_Variable class, which you access with $game_variables[numeric], is the data class which stores all your RMXP variables you would use in events and conditional branches. And in the above example, I set RMXP Variable #1 to store the data of the Target ID.
So when the common event is run, it won't print the target ID, but instead will store it in RMXP variable 1. After that, you can run your conditional branch based on the value stored in RMXP variable 1. Of course, this is up to you what variable you wanna use, just by changing the number between the brackets.
😛 Hey, tactician. You appreciate my ingenuity? ☺️
Ah, I get it now. I just didn't understand that I needed to convert the ID to an actual database variable.
The event runs exactly as intended now, thank you so much for your help.
Oh, and thanks for the cool limit break script you made too. :awink: