So there are two scripts that I wrote that I've been trying to get to work, and they come up with various errors. One of them is newer, I haven't been banging my head against it for more than an hour. I just don't know exactly how BoA treats decimals (experimentation implies that using the "." at all in code comes up with an Improper Symbol error). If it divides, the documentation says it loses the remainder, which isn't helpful. But I can work around lack of decimals by changing some numbers around, that's annoying but not incomprehensible to me.
In any event, this code is in the outdoor script, called for certain creature encounters. It's supposed to decide whether or not to attack or run away based on the average level of the party. Under 10, it'll always attack, over 40, it'll always run, around 25 (roughly the level of the scenario) it's supposed to be 50/50. The code comes up with an Improper Command error in the first line. I'm sure the problem will be obvious to you veterans. This is of course in my outdoor script file.
beginstate 11;
if ((0 - 10 / 3) * ((get_level(0) + get_level(1) + get_level(2) + get_level(3)) / 4) + 133) > get_ran(1,1,100)) {
print_str("This group decides you look like too much trouble and avoids you.");
outdoor_enc_result(2);
}
break;
The other bit of script is one I've been bashing my head against for a couple days now, and I figure that as soon as I click the button to post this, I'm likely to come up with an answer on my own, because that's the way the world works.
In any event, it's supposed to be sort of reminiscent of the Talking Skull, in that there's a random chance of a thing happening as long as you hold the item, except instead of playing a message and a sound, it damages you.
This is in the main scenario script file.
beginstate START_STATE;
if (get_ran(1,1,100) == 1) && (has_item(473) == true) {
damage_char(0,10 * has_num_of_item(473),5);
damage_char(1,10 * has_num_of_item(473),5);
damage_char(2,10 * has_num_of_item(473),5);
damage_char(3,10 * has_num_of_item(473),5);
print_str_color("Something in your pack releases a burst of freezing energy!",2);
}
if (get_ran(1,1,100) == 1) && (has_item(474) == true) {
damage_char(0,10 * has_num_of_item(474),1);
damage_char(1,10 * has_num_of_item(474),1);
damage_char(2,10 * has_num_of_item(474),1);
damage_char(3,10 * has_num_of_item(474),1);
print_str_color("Something in your pack releases a burst of burning energy!",2);
}
break;
Does anybody have any insights on either of these problems? I would also be filled with glee if anybody has any better ideas for how to accomplish what I'm trying to do. Or even suggestions for cleaning up my probably messy code.