How to manage AI actions based on percentages
<p>I am looking now for some time about how can a programmer simulate a AI decision based on percentages of actions for the final fantasy tactic-like games (strategy game).</p>

<p>Say for example that the AI character has the following actions:</p>

<p>Attack 1: 10%<br />
Attack 2: 9%<br />
Magic : 4%<br />
Move : 1%</p>

<p>All of this is far from equaling 100%</p>

<p>Now at first I though about having an array with 100 empty slots, attack would have 10 slots, attack 2 9 slots on the array. Combining random I could get the action to do then. My problem here is it is not really efficient, or doesn't seem to be. Also important thing, what do I do if I get on an empty slot. Do I have to calculate for each character all actions based on 100% or define maybe a "default" action for everyone ? </p>

<p>Or maybe there is a more efficient way to see all of this ? I think that percentage is the easiest way to implement an AI.</p>
