Scripts involving Action Times+

Hello everyone,

I have characters that take multiple turns using the Action Times+ feature, and I want to add events and scripts that vary depending on which action selection (first, second, etc.) the character is currently using during battles . The problem is, I have no idea what the variable keeping track of this is called or where it's stored.

Specifically, I have a character with two separate skill sets (physical and magical) and two actions per round. I'd like to apply states (sealing skills) so that he only has access to physical skills for his first action and magic skills for his second. I think I can run a parallel process while battle is going on and assign the states through that, but I don't know where to find the integer keeping track of how many actions a specific actor has already selected this round.

Any help would be appreciated. Thanks in advance.

I've moved this thread to Script Support. Thank you.



I think this is where it should be, maybe script request, but I figure we'll see how the topic plays out and move it again if necessary.
Thanks. Script Support does seem like the right place.

I think I've found what I was looking for in Game_actor, @action_input_index. Is getting the value as simple as setting a variable = $game_actor[n].@action_input_index ? It doesn't seem to be working when I try it.
No, @action_input_index is a variable that works in the class, but that's not how you use it outside the class. If it is like HP or MP, you remove the @ sign. If that doesn't work, the workaround is simply to create a method that returns the variable like so:
Code:
class Game_Actor < Game_Battler
def get_action_input_index
return @action_input_index
end
end
and do variable = $game_actor[n].get_action_input_index
That seems right, but I get a crash when I try to call it up as a variable (or anything else from $game_actor, like HP which should work.) It crashes between rounds, so I assume it has to do with $game_actor just not being initialised at that time.

I'm using a wonky setup with Tsukihime's global common events script and a parallel process event, but I think I need to get rid of that and just have a script that checks frame-by-frame during the action selection period. If my script is something like:

Code:
style_mode = $game_actor[1].action_input_index
actor = $game_actors[1]

if style_mode = 0
actor.add_state(4) 
actor.remove_state(5)
actor.result.clear
end

if style_mode = 1
actor.add_state(5) 
actor.remove_state(4)
actor.result.clear
end

(States 4 and 5 are the ones that seal magical and physical skills respectively.) How can I set this up to have it running in battle while $game_actor is open, but not when it's closed and trying to load something out of it will cause a crash? Do I put it in class game_actor < game_battler itself?
Hm, if it's in battle, $game_party.members[index] is probably a better bet. However, I do have an idea, based on what I did to determine "enemy defense" through the window:

---

Code:
class Window_ActorCommand < Window_Command

def dual_turn(stype_id)
 case @actor.action_input_index
 when 0
   return false if stype_id == 1
 when 1
   return false if stype_id == 2
 end
 return true
end

def add_skill_commands
  @actor.added_skill_types.sort.each do |stype_id|
    name = $data_system.skill_types[stype_id]
    add_command(name, :skill, dual_turn(stype_id), stype_id)
  end
end

end

I haven't tried this yet, but in theory, assume Magic is Skill Type 1 and Physical is Skill Type 2; The first "turn", Magic is disabled, and the second turn, Physical is disabled.
Just tested it now. It's perfect! I didn't think of using the command window scripts but that really is the most sensible way to do this.

Thanks a lot!

Original thread: https://forums.rpgmakerweb.com/threads/scripts-involving-action-times.77796/