In schematics there's the Spawn Combatant node for that - but it spawns a selected combatant or combatant group. So, you can't type in an ID or something like that, just regular popup selection :)
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!
Well, yeah, most data can be accessed like that and used to do stuff.
Some things are no longer referenced by the main project, though, and can only be accessed via their individual data assets. Check out the scripting overview documentation for details.
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!
Thanks, can I get a more detailed explanation please? The api and scripting documents may be fine for a seasoned coder but I can’t seem to get things to work via their index number.
E.g. adding an item to a combatant's inventory: combatant.Inventory.Add(new ItemShortcut(ORK.Items.Get(index), quantity), true, true, true); combatant is the instance of the combatant. index is the ID/index of the item. quantity is, well, the quantity :) The rest of the parameters are just for showing notifications, console texts and marking the item as new.
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!
You're missing the new before EquipShortcut to instantiate it :) Also, you need to do this on an instance of a combatant, e.g. like this: combatant.Equipment.Equip(null, new EquipShortcut(ORK.Equipment.Get(index), 1, 1), null, combatant.Inventory, true);
The first argument (null in this case) would be the equipment slot, passing null will use the first matching slot.
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!
Ah, yeah, you can just pass the combatant, not the inventory - there was a change :) So, this doesn't take it from inventory and puts whatever is currently equipped into the combatant's inventory: combatant.Equipment.Equip(null, new EquipShortcut(ORK.Equipment.Get(index), 1, 1), null, combatant, true);
Post edited by gamingislove on
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!
You can directly access the equipment slots and their equipment via: combatant.Equipment[index] index being the ID/index of the equipment slot.
E.g. access to the equipped equipment: combatant.Equipment[index].Equipment
And getting it's ID/index: combatant.Equipment[index].Equipment.ID
Do a null check on the Equipment first, or check if the slot is equipped (does the same thing): if(combatant.Equipment[index].Equipped)
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!
Via code is also possible, check out the combatant scripting documentation.
If you're enjoying my products, updates and support, please consider supporting me on patreon.com!
Some things are no longer referenced by the main project, though, and can only be accessed via their individual data assets. Check out the scripting overview documentation for details.
If you're enjoying my products, updates and support, please consider supporting me on patreon.com!
E.g. adding an item to a combatant's inventory:
combatant.Inventory.Add(new ItemShortcut(ORK.Items.Get(index), quantity), true, true, true);
combatant is the instance of the combatant.
index is the ID/index of the item.
quantity is, well, the quantity :)
The rest of the parameters are just for showing notifications, console texts and marking the item as new.
If you're enjoying my products, updates and support, please consider supporting me on patreon.com!
GamingIsLove.ORKFramework.Combatants.CombatantsEquipment.Equip(-1, EquipShortcut(ORK.Equipment.Get(2), 1, 1), combatant, combatant, true);
combatant being the current selected combatant component on the game object.
Also, you need to do this on an instance of a combatant, e.g. like this:
combatant.Equipment.Equip(null, new EquipShortcut(ORK.Equipment.Get(index), 1, 1), null, combatant.Inventory, true);
The first argument (null in this case) would be the equipment slot, passing null will use the first matching slot.
If you're enjoying my products, updates and support, please consider supporting me on patreon.com!
I’m getting: cannot convert GamingIsLove.ORKFramework.Inventory to GamingIsLove.ORKFramework.Combatant
Also, can we bypass taking it from the inventory and giving directly to the combatant or do I need to add it to the inventory first?
So, this doesn't take it from inventory and puts whatever is currently equipped into the combatant's inventory:
combatant.Equipment.Equip(null, new EquipShortcut(ORK.Equipment.Get(index), 1, 1), null, combatant, true);
If you're enjoying my products, updates and support, please consider supporting me on patreon.com!
How do I retrieve the index number of an equipped item. I know how to assign to a shortcut but how do I get the index number of item?
combatant.Equipment[index]
index being the ID/index of the equipment slot.
E.g. access to the equipped equipment:
combatant.Equipment[index].Equipment
And getting it's ID/index:
combatant.Equipment[index].Equipment.ID
Do a null check on the Equipment first, or check if the slot is equipped (does the same thing):
if(combatant.Equipment[index].Equipped)
If you're enjoying my products, updates and support, please consider supporting me on patreon.com!