I'm looking to find a script call that swaps the actor in slot 3 with whatever actor id is stored in variable 5:
This is the script I'm using:
$game_party.swap(3,$game_variables[5].index)
And this is the error that I get:
Script 'Game_Interpreter' line 1411: NoMethodError occured
undefined method 'index' for 12:Fixnum
12 is the number of the actor stored in the variable at the time of when the error occurs.
why do you add "index"? If you want the number stored in the game variable, you need to use $game_variables[5] directly, without anything behind it.
How did you store the ID into the variable? I think that's where the problem is caused, and not where you try to access it.
yes it is, because enemy ID is not the same as actor ID - unless you have absolutely no actors in your database and the script you're using projects the IDs identical.
And all script that I've seen for capturing enemies create new actor IDs that are NOT identical to the enemy ID when capturing an enemy.
Please link to the script you're using to capture an enemy so that we can check which IDs it creates.
I also suggest you check which number is stored in the variable before using the swap command, that will proof if the variable is correct or not and where you'll have to look for the problem
I got help from HimeWorks.
In case someone else has my issue, this was the working script:
$game_party.add_actor($game_variables[5])
$game_party.swap_order(3, $game_actors[$game_variables[5]].index)
Basically what I was trying to do was set a variable, then add whatever actor was the stored variable number, then swap out the last member in formation for the new actor.
Thanks for the assistance. Sorry if I worded my question poorly.