• joeee19 said: Doing it this way causes the problem that the equipment is different from the instance of Select.
    Is it different equipment or is it just because it's a new instance of the same equipment?


    You can use item boxes as item bags - their Box ID makes them accessible and are saved with save games.
    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 March 2022
    gamingislove said: Is it different equipment or is it just because it's a new instance of the same equipment?
    It is the same equipment. It is a different instance.

    I don't know where the problem is, so if it's a screenshot, I don't know where to take it.
    I will send a smaller project file to your email.

    I have a problem with Schemics in EquipAfterCollect.
    I made a lot of changes yesterday and now all the Equipment's SelectData is stored in the player's ObjectVariable.
    It will not equip even if I AddInventory -> Equip in EquipAfterCollect.
    If I set the name of the SelectData to a variable, the name of the equipment appears normally, so the Select itself seems to succeed.

    Conversely, RecieveEquipmentFromTarget, equipped in the same way, succeeds as expected, including equipment and instance retention.
    This seems to be a bug in the InventoryDrop node or the SelectData node, what do you think?

    --- Comment Add ---
    Sent mail to contact@
    Post edited by joeee19 on
  • joeee19 said: It is the same equipment. It is a different instance.
    Yes, this is by design - certain operations (e.g. adding things to an inventory) will create a new instance/copy.
    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!
  • I am having trouble finding a way to keep both the Equipment body and the Combant instance to AddCombatant to an EquipmentObject without instantiating a new one after a Drop or Collect.
    Would it be difficult to add a FromSelectCombatant option to the AddCombatant node?
    I am having a hard time adding a SelectCombatant to a prefab game object that was instantiated after the Drop.

    It is also difficult to retrieve the prefab that was instantiated after Drop because it is also a Protected member of ItemCollector.
    The GameObject.Find system is also difficult to use because the instantiated prefabs are scattered all over the place.
    It would be easiest if it could be retrieved from ItemCollector.
    Can we make the PrefabInstance member of the ItemCollector Public?
    or Get function.
  • You can't have a combatant on an equipment.
    Yes, you can add a combatant to a game object, but that combatant is gone when the game object is gone - e.g. adding the combatant to the dropped equipment prefab instance will not be available after the equipment has been collected.

    I'll add a property to have the prefab from the item collector accessible in the next update.

    Can you give me a detailed description of what you want to do? Maybe there is a different way to do it.
    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 March 2022
    gamingislove said: Can you give me a detailed description of what you want to do? Maybe there is a different way to do it.
    Did you see the email I sent yesterday?
    I've written what I want to do in this thread and in that email.

    We are currently working on a custom script that will hold the Combatant and we are almost ready to make it happen.

    Q2: Is there a node that checks with CHeckEquipmentItemType against the EquipShortcut obtained by Select Item Collector?
    If CheckStatus, is it equipped or not? The only checks are such as
    I think this is a basic node, but I can't find it, so I'm asking just in case.
    If not, create a CustomFunction.

    Q3:Is there any way to pass SelectedData as an argument to CheckFunction node?
     I want to check the Type result of Select Item Collector into a CustomFunction that returns a Static bool, but the argument type is restricted and cannot be passed.
     I want to pass the EquipShortcut type.

    It's pretty aggressive, but it got the better of me for now.
    public static bool IsEquipmentItemType2(GameObject machineObject)
    {
    var currentEquipment = machineObject.GetComponent<ObjectVariablesComponent>().SelectedData.Get("CurrentEquipment")[0] as EquipShortcut;
    return currentEquipment.ItemType.RootType.ID == 2;
    }
    Post edited by joeee19 on
  • What I gathered from this thread and the email is that you want to transfer equipment from one combatant to another - and this seems to be working.
    However, it's not the same instance of the equipment, because adding it to the inventory or equipping it will create a new instance out of it. This is by design and will behave this way regardless of how you change the equipment.

    If you need a reference to the equipped equipment, you need to get it from the combatant after equipping.

    2) I don't think there's currently a node for that.
    I'll look into it.

    3) Looks good, but I'd recommend to do some additional checks to prevent errors (e.g. checking if the component was returned, etc.).
    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 March 2022
    I understand about the instances.
    I will deal with it somehow.

    In this thread and in your email you mention another problem.
    This one is more important.
    When I drop and put an ItemCollector in between, the transfer of Equipment is not working.
    AddInventory and Equip are ignored.

    Also
    Would it be difficult to add an option to the AddCombatant node source to select the results of the Select Combatant node retention?
    I have a situation where I want to AddCombatant to an existing game object.

    Q2:
    I would like to restore an instance of combatant, is this not possible?
    I tried this approach.
    When I tracked it in Mono's Debug, I found that the cached Combatant is successfully restored in the frame where it was restored.
    However, somewhere in subsequent frames, someone has rewritten it to a new instance.


    //cache instance
    var combatntComponent = GetComponent<CombatantComponent>();
    Combatant cachedCombatant = combatntComponent.Combatant;


    //restore instance
    var combatantComponent = gameobject.AddComponent<AddComponent<CombatantComponent>();
    yield return null;
    yield return null;
    combatntComponent.Combatant = cachedCombatant


    Q3
    The reason I am forcibly adding Combatant to Equipment without using ItemBox is because I thought I could not do the following.
    1: Portable ItemBag (dish) and the whole Bag can be thrown away. The Bag can be carried by other Combatant.
    2:Bag must be able to Research (Cooking) Equipment by itself.
    3:The Bag must be able to produce items using recipes on its own.
    Since these are necessary, we have no choice but to put Combatant on Equipment.
    By throwing items (ingredients) into the ItemBag (dish, pot, etc.), they are automatically cooked.
    It is just like applying the Combatant to the Trap Tutorial.
    Do you think these can be achieved in ItemBox?
    Post edited by joeee19 on
  • joeee19 said: When I drop and put an ItemCollector in between, the transfer of Equipment is not working.
    AddInventory and Equip are ignored.
    I didn't test your project yet, but I think using item drops here is not the best way. Since you want to store already selected equipment, you can just remove it from the inventory/combatant and e.g. spawn a prefab with object variable component and interaction machine already set up and add the selected data there.
    joeee19 said: Also
    Would it be difficult to add an option to the AddCombatant node source to select the results of the Select Combatant node retention?
    I have a situation where I want to AddCombatant to an existing game object.
    So, setting a game object to be a combatant's game object?
    I'll look into it - generally, this functionality is already available via scripting.
    joeee19 said: Q2:
    I would like to restore an instance of combatant, is this not possible?
    I tried this approach.
    When I tracked it in Mono's Debug, I found that the cached Combatant is successfully restored in the frame where it was restored.
    However, somewhere in subsequent frames, someone has rewritten it to a new instance.
    If you store the combatant into a global selected data it'll be kept alive there (but not in save games). You can later e.g. spawn it again via the selected data.
    Via scripting, if you keep the reference somewhere (e.g. a component that isn't destroyed/removed) it'll also be kept alive there.
    joeee19 said: Q3
    Hm, instead of adding a combatant to equipment, why not just use a combatant?
    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 March 2022
    Thanks again and again for your answers.
    And sorry for my poor English.
    gamingislove said: why not just use a combatant?
    The reason is that we want to be able to carry that Combatant(e.g.dish,pot,pizza dough,etc) equipped by Player Combatant and Equipment Combatant (e.g. Counter, GasStove, Oven, etc.) Combatant.

    The player can equip them in his right hand, left hand or (depending on the item)both hands, and since the EquipmentViewer is available, we thought it would be easy to handle the equipment.

    I thought it would be too much work if I only used the Combatant, because I would have to create the mounts and the management part myself.
    gamingislove said: If you store the combatant into a global selected data it'll be kept alive there (but not in save games). You can later e.g. spawn it again via the selected data.
    Via scripting, if you keep the reference somewhere (e.g. a component that isn't destroyed/removed) it'll also be kept alive there.
    Yes, I know the Select Combatant node.
    Use it as a source,
    CombatantComponent.Combatant = selectedCombatant
    but changes to another new instance in subsequent frames(dish A has changed to dish B. The item equipped by dish A becomes empty.).
    Can this be avoided? The question is.


    Spawning is not convenient because it creates a new game object.
    My question is to RestoreCombatant to an existing game object instead of Spawn.
    In short, I would like to know how to do the following from a node and from a script, respectively.
    gameObject.AddCombatant(Combatant cachedCombatant)

    AddCombatant node is close to it, but you can't choose SelectedData as the source.
    Post edited by joeee19 on
  • Hm ... as said, combatants on equipment will be gone when the game object is destroyed.
    However, you can maybe store them in global selected data and link them to the equipment via the equipment instance GUID.
    The Store Selected Data GUID stores the instance GUID of an equipment (or other things that use it, e.g. abilities) into a string variable. You can use that string variable as selected data key to store the combatant - that way you can get the combatant later for the same GUID again.
    However, the instance GUID will change when the equipment is equipped or put into a different inventory.


    Use this code instead of setting the CombatantComponent's combatant:
    combatant.GameObject = gameObject;

    I'll either add a new node or options to the Add Combatant node to use a different combatant instead of creating a new one.
    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 March 2022
    gamingislove said: combatant.GameObject = gameObject;
    The phenomenon did not improve and was the same.
    For some reason, it still changed to "dish B" in the next frame.
    Things are not going well, so I am changing my approach.
    I'm trying a different approach, which is to place a Combatant on the Equipment child object from the SpawnCombatant node.

    When I drop it, I do a SelectCombatant and save it to the ItemCollector.
    Global SelectedData, since there will be multiple instances of SelectedData during the game and it will be accessed by multiple players (up to 4), the only way seems to be to place the SelectedData on the game object in the ItemCollector.

    ---Comment add---
    The same phenomenon occurred when using SpawnNode.
    After trying various methods, I finally found the cause.
    It seems that the problem was that I had set RealTimeBattleArea。。。。
    I set all of the Comabtant's to Alliies and set RealTimeBattleArea to Disable, and that solved the problem.
    It seems that the EnemyCounter in the Battle settings was giving unexpected increments.
    I need to figure out what to do with IndividualTarget if I don't use battles, but for now I've made a step forward.
    Post edited by joeee19 on
Sign In or Register to comment.