[ACE] Getting user id when executing an action

Gleen

Veteran
Veteran
Joined
Jun 14, 2012
Messages
98
Reaction score
21
First Language
portuguese
Primarily Uses
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!
 

Dr.Yami

。◕‿◕。
Developer
Joined
Mar 5, 2012
Messages
1,003
Reaction score
757
First Language
Vietnamese
Primarily Uses
Other
You can use user.index
 

Gleen

Veteran
Veteran
Joined
Jun 14, 2012
Messages
98
Reaction score
21
First Language
portuguese
Primarily Uses
Holy moly, thanks!

I'm having so much trouble understanding Game_Battler and Game_BattlerBase T.T
 

Tsukihime

Veteran
Veteran
Joined
Jun 30, 2012
Messages
8,564
Reaction score
3,846
First Language
English
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.
 

Gleen

Veteran
Veteran
Joined
Jun 14, 2012
Messages
98
Reaction score
21
First Language
portuguese
Primarily Uses
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.
 

Users Who Are Viewing This Thread (Users: 0, Guests: 1)

Latest Threads

Latest Posts

Latest Profile Posts

Holy stink, where have I been? Well, I started my temporary job this week. So less time to spend on game design... :(
Cartoonier cloud cover that better fits the art style, as well as (slightly) improved blending/fading... fading clouds when there are larger patterns is still somewhat abrupt for some reason.
Do you Find Tilesetting or Looking for Tilesets/Plugins more fun? Personally I like making my tileset for my Game (Cretaceous Park TM) xD
How many parameters is 'too many'??
Yay, now back in action Happy Christmas time, coming back!






Back in action to develop the indie game that has been long overdue... Final Fallacy. A game that keeps on giving! The development never ends as the developer thinks to be the smart cookie by coming back and beginning by saying... "Oh bother, this indie game has been long overdue..." How could one resist such? No-one c

Forum statistics

Threads
105,857
Messages
1,017,019
Members
137,564
Latest member
McFinnaPants
Top