- Joined
- Jan 6, 2013
- Messages
- 1,726
- Reaction score
- 275
- First Language
- English
- Primarily Uses
- RMMV
So the following is supposed to, when an enemy chooses a random target for their skills, check the TGR first (like the default engine), and then if there's no mutations (tgr_rand not making the choice to Return member), the enemy will be checked for 4 possible states, each check checking each alive member for a specific actor id, and then Return that member to target for its skill. if none of the 4 checks apply, then it just does alive_members[0] at the very end. (like the default engine)
Each of my actors have a standard 100% TGR rate, no other changes. Right now i'm checking the aggro affect with 2 actors VS 2 enemies, but it's not working properly and they're still targeting whoever. The state work is completely fine, but there must be something wrong with this code logic that i'm not grasping. Oh and this is an overwrite by the way.
Each of my actors have a standard 100% TGR rate, no other changes. Right now i'm checking the aggro affect with 2 actors VS 2 enemies, but it's not working properly and they're still targeting whoever. The state work is completely fine, but there must be something wrong with this code logic that i'm not grasping. Oh and this is an overwrite by the way.
Code:
#-------------------------------------------------------------------------- # * Random Selection of Target with Aggro State Check #-------------------------------------------------------------------------- def random_target tgr_rand = rand * tgr_sum alive_members.each do |member| tgr_rand -= member.tgr return member if tgr_rand < 0 end if tgr_rand == 0 #Probably might be cause of this, idunno how the calculations work if not self.actor? #Check if enemy if self.state?(116) #Check if enemy has aggro state alive_members.each do |member| if member.id == $game_actors[1] #Or maybe these aren't working like I expected return member end end elsif self.state?(117) alive_members.each do |member| if member.id == $game_actors[2] return member end end elsif self.state?(118) alive_members.each do |member| if member.id == $game_actors[3] return member end end elsif self.state?(119) alive_members.each do |member| if member.id == $game_actors[4] return member end end end end end alive_members[0] end
Last edited by a moderator:
