Getting stats to work for you

Kit_sune
22 Oct 2012, 01:27
I'm very happy with the current progress on my project. But now it's time to tackle the next piece of the agenda. Character stats.

It's one of the areas I've always had trouble wrapping my head around. How exactly do the numbers work together? Obviously specific stats affect certain outcomes, but how? Does anyone know of any helpful resources I an read that might help me to understand these things a little better?

Even though I'm an analyst by trade, and I understand how rates are formulated, and I've played around with my share of excel formulas, I feel like I just need a little push so I can get around this roadblock.

Thanks again

edit -

I get that you generally take one number, and perform a calculation on it with another number, and then have the system check the result , and if it's one thing, do one thing, and if it's another thing do something else.

I'll keep pressing with it and I'll throw a bunch of numbers at it and see what I get.

The Pixie
22 Oct 2012, 07:13
I am not too clear what you mean, so apologies if this is way off.

If the character is attacking a monster, then you might determine the outcome like this:


<!--Saved by Quest 5.2.4515.34846-->
<asl version="520">
<include ref="English.aslx" />
<include ref="Core.aslx" />
<game name="attack">
<gameid>94174176-4256-46bf-a867-fd8d14eab408</gameid>
<version>1.0</version>
</game>
<object name="room">
<inherit name="editor_room" />
<object name="player">
<inherit name="defaultplayer" />
<to_hit_bonus type="int">2</to_hit_bonus>
<damage_die type="int">12</damage_die>
</object>
<object name="monster">
<inherit name="editor_object" />
<hit_points type="int">30</hit_points>
<defensive_bonus type="int">12</defensive_bonus>
<attack type="script"><![CDATA[
if (player.to_hit_bonus + GetRandomInt (1, 20) > this.defensive_bonus) {
damage = GetRandomInt (1, player.damage_die)
msg ("You hit for " + damage + " points of damage.")
this.hit_points = this.hit_points - damage
if (0 > this.hit_points) {
msg ("It is dead!")
}
}
else {
msg ("You attack, but miss.")
}
]]></attack>
<displayverbs>Look at; Attack</displayverbs>
</object>
</object>
<verb>
<property>attack</property>
<pattern>attack</pattern>
<defaultexpression>"You can't attack " + object.article + "."</defaultexpression>
</verb>
</asl>


For a proper game, you would be better creating a monster type, and attaching the script to that, by the way.

Kit_sune
22 Oct 2012, 16:35
You're not terribly off, but to help illustrate what I mean I have an example that I was working on this morning.

Let's say there are two characters fighting. One of them has a speed of 5, while the other one has a speed of 11. Obviously, the one with speed = 11 is faster, and therefore would be able to strike first.
However, I want to incorporate that into a turn system, where those who are twice as fast get 2 turns instead of one.
So the battle starts, the speed variables are checked, and the quickest one makes the move first.
But then, if the slower one is REALLY slow in comparison, the quicker one could possibly go again this turn, or maybe next turn.
CharA.SPD = 20 CharB.SPD = 50
I need to gauge these numbers against something, for instance time, so I’m thinking I’ll need to create a hidden variable called action that stores a value of how much of an action you have in comparison to the other character. So for instance, when the battle begins you determine which character has the lowest speed, and use that as an action cap (the most points you need to perform an action). So in this scenario every 2 points of speed would earn you an action. Since CharB.SPD = 50, and 50/20=2.5, character B gets to start the battle, AND perform two actions before character A. The remainder of .5 would then be carried over, and added to the result of the next calculation. But how do I determine when to do the calculation? When the turns of both players are < 1? I guess that could work…
Ok, so B hits A 2 times, lowering the action stat by 2, and now has a .5 action stat. A has a 0 action stat after performing 1 action. Both are less than 1, so perform the calculation.
I guess I kind of figured this one out all by myself, so now I’ll try to implement something.

Kitsune

Kit_sune
22 Oct 2012, 18:27
Actually, I do have a question regarding the bit of code here.
Let's say I wanted to turn the code for "attack" into a function to be called instead of a script for a monster. How could I do that? The part that I'm not sure about is how you used "this.attribute", how would I be able to call up the monster object's name properly?

The Pixie wrote:

if (player.to_hit_bonus + GetRandomInt (1, 20) > this.defensive_bonus) {

this.hit_points = this.hit_points - damage



Would it be something with the Function Parameters? That's an area I'm currently trying to wrap my head around.