(Help) What is the error in this call command? How can I solve?

● ARCHIVED · READ-ONLY
Started by tiagoms 8 posts View original ↗
  1. What is the error in this command? How can I solve?

    $game_troop.members[$game_party.battle_members[0].last_target_index] == $game_enemy[2]
  2. It might help us if you could post the error message you are getting, as well as what you are trying to do with this. I think you are trying to see if the last target by the 1st party member is the second enemy in the database, but could you clarify so we are sure?
  3. You are trying to set $game_troop.members to $game_enemy[2]? Why? What are you trying to achieve?


    There is no such thing as $game_enemy. I don't have Ace with me right now so I can't check, but it'd either be $game_enemies, or more likely $data_enemies. But that is not how you assign an enemy id. Hence, what are you trying to achieve?
  4. Positive.
    I wonder if the last target of the actor "position 0" is the enemy of "ID 2"

    The error is this:

    "Script 'Game_Interpreter' line 454: NoMethodError Ocurred

    undefined Method '[]' for nil:NilClass"

    I'm doing an event that will have this condition.

    Common Event:

    Condition: $game_troop.members[$game_party.battle_members[0].last_target_index] == $game_enemy[2]

    True = Switch 1 (exemple)

    False = text  (exemple)
  5. Try changing it to $data_enemies[2] instead, and see if that works. If that fails, it might be because $game_party.battle_members starts at 1, not 0. Try 1 for first position if it still fails after my first suggestion.
  6. If you're trying to see if the enemy is Enemy 2, change it to this:

    $game_troop.members[$game_party.battle_members[0].last_target_index].id == 2Though I have a feeling it could be even shorter. Wish I had it here.
    And sorry for the previous post's assumption that you were trying to SET an enemy id - I misread the == and took it for =.
  7. It worked perfectly! Thank you =)

    === EDIT ===

     

    How should I proceed to check the amount of a status of this enemy?

     

     

    $game_troop.members[$game_party.battle_members[0].last_target_index].MP >= 20 ?

    $game_troop.members[$game_party.battle_members[0].last_target_index].MHP <= 2000 ?

    $game_troop.members[$game_party.battle_members[0].last_target_index].others == ???



    === Edit ===

    Work! =)

    mp, not "MP".
  8. If you want to do a lot of checks one after another, do this:

    Code:
    enemy = $game_troop.members[$game_party.battle_members[0].last_target_index]enemy.mp >= 20enemy.mhp <= 2000enemy.???