The RPG Maker Resource Kit

RMRK RPG Maker Creation => RPG Maker General => General Tutorials and Eventing => Topic started by: jfjohnny5 on December 01, 2009, 12:55:54 AM

Title: Does "Position" really DO anything?
Post by: jfjohnny5 on December 01, 2009, 12:55:54 AM
Front, Middle, Rear position. Seriously...so far they seem to do the opposite of what I'd expect in testing. I just finished another test combat. 4 enemies vs 2 PCs (1 Front position, 1 Rear position). Of the 6 attacks dealt to the PCs, 5 went to the "Rear position". This seems to happen a LOT. Is something actually wrong? Or am I just witnessing an astounding failure of probability?
Title: Re: Does "Position" really DO anything?
Post by: Grafikal on December 01, 2009, 01:35:14 AM
What are you talking about?
Title: Re: Does "Position" really DO anything?
Post by: modern algebra on December 01, 2009, 01:46:54 AM
Failure isn't a correct term - and while 5/6 attacks is unlikely, it's not astounding. In any case, the chance depends in part on the composition of the party. The way random targetting works is the actor is added to the array (4 - position) times. Front is 0, so that actor is added to the array four times. Rear is 2, so that actor is added twice.

Thus, there is a 1/3 chance that the rear actor would be targetted by random targetting. So it's unlikely, but not impossible. Also, it is not linear with the number of people in the party. In a party with one front character and three rear characters, the chance that a specific rear character will be hit is 1/5. In a party with three front characters and one rear character, the chance the rear character would be hit is 1/7. And in a party with only one front character and one rear character, the chance is 1/3, which isn't that unlikely.


One thing to note, a sample size of six is not a reliable sample size.
Title: Re: Does "Position" really DO anything?
Post by: jfjohnny5 on December 01, 2009, 01:51:26 AM
Gotcha. Thanks for explaining the background math. Kinda wish they gave us the option to weight a little more heavily one way or the other.
Title: Re: Does "Position" really DO anything?
Post by: modern algebra on December 01, 2009, 01:55:39 AM
Well, if you wanted to, you could change the odds method of Game_Actor, which is here:




  #--------------------------------------------------------------------------
  # * Get Ease of Hitting
  #--------------------------------------------------------------------------
  def odds
    return 4 - self.class.position
  end


If, for instance, you wanted it weighted heavier so that front classes are more likely to get attacked you could have something like this:



  #--------------------------------------------------------------------------
  # * Get Ease of Hitting
  #--------------------------------------------------------------------------
  def odds
    return 5 - (self.class.position*2)
  end


Then, in a party of one rear actor and one front actor, the chance the rear actor would be attacked is 1/6 and the chance the front actor is attacked would be 5/6. In a party with three rear actors and one front actor, the chance the front actor would be attacked is 5/8