The RPG Maker Resource Kit

RMRK RPG Maker Creation => RPG Maker General => General Scripting => Topic started by: dudeguy119 on May 21, 2013, 07:08:01 PM

Title: [VX][SOLVED]Proper Script Call for Enemy Appear and Enemy Transform
Post by: dudeguy119 on May 21, 2013, 07:08:01 PM
I tried using the search function. As far as I know, no threads list script calls. Please correct me if I am wrong. Nothing in the "Read First" threads looked like what I was looking for. I also attempted to find it through $game_interpreter, but nothing I tried has worked. I need to be able to do it through script call as I can have more than 8 enemies/summoned allies on the screen at once and I need a way to access them (as you know the event for transform and appear only allow parameters up to 8.).

I tried several things, and I feel like I'm close, but it's a no-go so far. Any help would be appreciated, thank you.
Title: Re: [VX] Proper Script Call for Enemy Appear and Enemy Transform
Post by: LoganF on May 21, 2013, 09:02:50 PM
As a quick hint kind of thing:

With regards to Game_Interpreter:


      when 335  # Enemy Appear
        return command_335
      when 336  # Enemy Transform
        return command_336


If you look at those two commands, you can see what happens when the command is called when you trigger it with events.


  #--------------------------------------------------------------------------
  # * Enemy Appear
  #--------------------------------------------------------------------------
  def command_335
    enemy = $game_troop.members[@params[0]]
    if enemy != nil and enemy.hidden
      enemy.hidden = false
      $game_troop.make_unique_names
    end
    return true
  end
  #--------------------------------------------------------------------------
  # * Enemy Transform
  #--------------------------------------------------------------------------
  def command_336
    enemy = $game_troop.members[@params[0]]
    if enemy != nil
      enemy.transform(@params[1])
      $game_troop.make_unique_names
    end
    return true
  end


There's a few ways you can approach this to solve the problem. The limitation of the event command is that you are restricted to a drop down list that only goes up to 8, but you need a larger number. One way, then, would be to make a method that accesses the appropriate $game_troops.members value (assuming that whatever is letting you have more than 8 enemies still makes use of this property).

I'll let you continue to find a solution of your own. If you still can't find one, I'll help you out some more.
Title: Re: [VX] Proper Script Call for Enemy Appear and Enemy Transform
Post by: dudeguy119 on May 22, 2013, 02:38:13 AM
Okay. Thank you. I can work with this. And, yes, the game does assign troop values to the additional enemies starting with 8 and goes in order, so I can predict which values the additional troops are. I'm going to try some things tomorrow and I'll reply with my results soon. Again, thank you for your quick response and for helping me in a way that helps me learn/doesn't treat me like I can't learn. Much appreciation.
Title: Re:[SOLVED] [VX] Proper Script Call for Enemy Appear and Enemy Transform
Post by: dudeguy119 on June 26, 2013, 05:30:16 PM
This can be closed. Thanks again, LoganF!