In my game, player can only have one identical piece of equipment, and if he acquires an equipment he already has, the value of the equipment's name is increased by +1 and its Status bonuses are changed to value*number.
(e.g. sword+1(ATK+5) → sword+2(ATK+10))

(at the time the equipment is acquired)
[check if you already have] → [Rename equipment you already own] → [Remove acquired equipment].
I could have done up to the above.

and I want to change the status bonus from the script from Call Function node.

for (int s = 0; s < StatusValueCounts; s++) 
{
int bonus = TargetItem.GetStatusValueBonus(player, ORK.StatusValues.Get(s)));
if (bonus != 0)
{
//***want to change Status Bonuses to bonus * number***
{
}

However, I could do GetStatusValueBonus but could not figure out how to do ChangeStatusBonus.

One more thing.
On Schematic, I am changing the name of the equipment in the ChangeSelectedDataName node, but the change is not reflected in the HUD Equipment List, and I would like to know how to solve that problem as well.
  • The EquipShortcut (which represents an instance of an equipment) gives you access to the StatusValue property, an int array to give bonuses to the individual status values (based on their index in the editor).
    This can also be changed via the Change Equip Status Value node (for equipment stored in selected data, e.g. via the Select Equipment node for equipped things of the Select Item node for equipment from inventory).

    There are 2 different bonuses involved for the total bonus of an equipment - the StatusValue property stored on the equipment's instance (which is also set by the random status value bonuses) and the bonuses coming from Status Bonus templates and custom bonuses set up in the equipment. The template/custom bonuses can't be changed like that (without changing it for all of those equipments), only the StatusValue property can be changed for an individual equipment.
    Please consider rating/reviewing my products on the Asset Store (hopefully positively), as that helps tremendously with getting found.
    If you're enjoying my products, updates and support, please consider supporting me on patreon.com!
  • edited June 29
    @GIL
    Thanks!
    I could update the status of equipment.

    One more thing I want to know, as I mentioned earlier, if I change the name and status of a equipment that player currently have equipped, it is not reflected in the display.

    I'm using HUD content - Equipment List and Status Value to show equipment name and player status.
    In the HUD Equipment List, the name of the equipment is <name>, and in the HUD Status Value , the player's status is <value> . (value origin setting is "Current")

    And the log output result of the following code is as follows:

    for (int s = 0; s < StatusIndexCounts; s++)
    {
    int bonus = GetItem.GetStatusValueBonus(player, ORK.StatusValues.Get(s));
    if (bonus != 0)
    {
    TargetItem.StatusValue[s] = bonus * number;
    }
    }

    //Status Check
    Debug.Log(OldName + " → " + NewName);
    Debug.Log("DefBonus = " + TargetItem.StatusValue[7]);
    Debug.Log("PlayerDef = " + player.Status.Get(ORK.StatusValues.Get(7)).GetValue());

    https://imgur.com/VcxjBaz
    https://imgur.com/dSM2lMm

    Player's base Def=80 with leather armor+1 (Def bonus=15) (=PlayerDef: 95)

    As shown in the image above, The status of the leather armor is updated but is not reflected in the player's status.
    So maybe it is not a problem on the UI side, but maybe I need a manual update of the player's status, or something like that.
    Do you have any suggestions for a solution?
    Post edited by modot on
  • You need to let the combatant know about the changes to recalculate the stats:
    combatant.Status.MarkResetStatus();

    And the equipment changes also need to do this (to let the HUD know about changed content):
    combatant.Equipment.FireChanged();
    Please consider rating/reviewing my products on the Asset Store (hopefully positively), as that helps tremendously with getting found.
    If you're enjoying my products, updates and support, please consider supporting me on patreon.com!
  • edited June 30
    Thanks for the reply gaminislove!

    But I still don't have the behavior I wanted, so let me ask a few more questions.
    I'm really sorry to take up your time.

    1.
    player.Status.MarkResetStatus();
    yield return null;
    player.Equipment.FireChanged();

    Debug.Log("DefBonus = "+TargetItem.StatusValue[7]);
    Debug.Log("PlayerBaseDef = "+ player.Status.Get(ORK.StatusValues.Get(7)).GetBaseValue());
    Debug.Log("PlayerDef = "+player.Status.Get(ORK.StatusValues.Get(7)).GetValue());

    The log result of the above code is,

    (e.g. Update DefBonus+15 equipment to DefBonus+30)
    DefBonus = 30, PlayerBaseDef =80, PlayerDef = 125(expected 110),

    Like this, [PlayerDEF = PlayerBaseDEF + DEFBonus + initialDEFBonus],
    Why not [PlayerBaseDEF + DEFBonus]?
    There is only one equipment, and no other status effects that affect status.

    2.
    combatant.Status.MarkResetStatus();
    combatant.Equipment.FireChanged();

    As I was taught, I executed the above code at the end of the Schematic, but still not reflected in the displayed status and name. (To be precise, sometimes reflected, sometimes not). I also tried executing it at the timing just before the status display process, but it was still not reflected.

    I should have noticed this in the first place, but without equipment update, it seems that simply replacing equipment is not reflected properly in the display.
    (My game is a turn-based grid battle, and equipment can be replaced at any time during the battle)
    Do you have any idea of the solution?
    Again, I'm really sorry to take up your time.
    Post edited by modot on
  • 1) MarkResetStatus will recalculate the stats in the next frame (which will also trigger any UI updates displaying the stats). This is used by all recalculation causing changes to limit it to happen once per frame max, otherwise things like equipping something would cause multiple updates, e.g. from first unequipping the old thing, etc.

    If you want to immediately update the stats, use the ResetStatus(true) function instead.

    2) Are you using ORK's built-in HUD components to display the information?
    Please consider rating/reviewing my products on the Asset Store (hopefully positively), as that helps tremendously with getting found.
    If you're enjoying my products, updates and support, please consider supporting me on patreon.com!
  • edited July 1
    @gamingislove
    yeah...I'm using Built-in HUD and HUD Content(Status Value and Equipment List),
    and when the "Check Status" button is pressed on the screen, the game state of "ShowingStatus" is turned on to open the HUD.

    So basically, I am changing equipment while the HUD is hidden, so some changes may not be detected while the HUD is hidden?
    As a test, I made an equipment exchange with the HUD displayed, and the HUD immediately reflected the change correctly. (However, if the current equipment is updated, the name of the equipment is not reflected.)

    ・When exchanging equipment while the HUD is displayed → both the equipment name and player status are reflected in the HUD.
    ・When exchanging equipment while the HUD is not displayed → The equipment name is reflected, but the player status is not.
    ・Update the name and status of the current equipment while the HUD is displayed → The player status is reflected, but the equipment name is not.

    Sorry for the confusion, but this is how it works.
    Post edited by modot on
  • Thanks for the details - I'll do some tests.
    Please consider rating/reviewing my products on the Asset Store (hopefully positively), as that helps tremendously with getting found.
    If you're enjoying my products, updates and support, please consider supporting me on patreon.com!
Sign In or Register to comment.