Little Question


#1

Can we make the stat screen amount in decimal?
can we make sub stat? like main stat is strength and the sub is attack = quarter of strength, endurance = half of strength
how to make item that have effect (like boost strength by 5,etc) but when the item is removed the effect is removed as well, and new item effect is applied?


#2

I’ve seen it happen, so I guess so, but I don’t know how to specifically do so. I guess it would involve fractures.

You can use numerical variables to set other variables using basic math, so if you want attack to be a quarter of strength just do

*set attack (strength/4)

Never actually tried it, but in theory it should work that way.

Just add a certain amount to a stat whenever an item is equipped, and subtract the same amount when it is removed. That sounds to me like the easiest way to go about things like that.


#3

Mhm, when an effect is applied, set a boolean (true false) variable to true, and when a new effect is applied, set every other effect to false, with the corresponding stat changes.


#4

how should the code written? can you give example?


#5

This is how I have it set up for my game.

#[Item Name] - Damage (#) Cost: #
  *if gold > #
    *set weap_value #
    *set gold -#
    *set mainhand "[Item Name]"
    *set offhand ""
    *set dmg_type #
    *set magic_main #
    *set ench_type #
    *set damage (((damage_base + weap_value) + off_weap_value) + damage_bonus)
    *set offhand_na 0

When replacing or removing an item (in this case a weapon), simple set the value that determines the bonus stat (whether it be strength, bonus damage from the weapon, etc.) back to 0 (or if replacing, set it to the new value). In my case, removing a weapon that adds a bonus of 3 damage, I would simply code in *set weap_value 0. If replacing it with a weapon that adds a bonus of 5, I would code *set weap_value 5.

I would then need to include a line to set the damage, so I would write *set damage (((damage_base + weap_value) + off_weap_value) + damage_bonus)

Hope this helps.


#6

Of course, if your strength changes throughout the game, you’ll need to recalculate the attack value each time. Presumably you could have a subroutine in a separate file which is called before each battle, like so:

File battle_prep.txt:

*set endurance strength/2
*comment add as many other *set commands here as you want.
*return```

And the main file would contain the text `*gosub_scene battle_prep` at the start of each battle.

Note that this is probably somewhat memory intensive, so only do it if you're going to be using it a lot.