[ACE] Getting user id when executing an action

● ARCHIVED · READ-ONLY
Started by Gleen 5 posts View original ↗
  1. I need to add some value to an atribute wich i created in Game_Actor when an actor does a simple attack in battle, i found where i need to edit but now i don't know how to get the actor ID wich is executing the action. Any help?



    Code:
    def item_apply(user, item)
        @result.clear
        @result.used = item_test(user, item)
        @result.missed = (@result.used && rand >= item_hit(user, item))
        @result.evaded = (!@result.missed && rand < item_eva(user, item))
        if @result.hit?
    	  if user.actor?
    	    if item.id == attack_skill_id # Normal attack
    		  [b]$game_party.members[id].myvar += xx[/b] # How do i get the actor id doing this action?
    	    else # Skills
    	    end
    	  end
    	  unless item.damage.none?
    	    @result.critical = (rand < item_cri(user, item))
    	    make_damage_value(user, item)
    	    execute_damage(user)
    	  end
    	  item.effects.each {|effect| item_effect_apply(user, item, effect) }
    	  item_user_effect(user, item)
        end
      end
    Thanks in advice!
  2. You can use user.index
  3. Holy moly, thanks!

    I'm having so much trouble understanding Game_Battler and Game_BattlerBase T.T
  4. Yuhmee said:
    You can use user.index
    Game_Actor#Index returns the position of the actor in the party, same with Game_Troop#Index



    Code:
    user.actor_id if user.is_a?(Game_Actor)
    would get the actual actor ID. But because the method is used for both enemies and actors a check is necessary.
  5. Interesting, yuhmee solution suited me because i needed only to check party position but knowing that i can find an actual actor_id is nice.

    Thanks.