Hi,
First of all thank you Chris for an outstanding framework, it is easily my favourite asset on the Asset Store.
I had planned to develop a standard point and click adventure (and I still will), until I found the combat demo. It is stunning to see how simple it is to add this extra functionality, but retain all the power of the engine.
I was hoping to ask for some help while I still get to grips with the amazing framework.
What I was looking to do is make it so that the shotgun ammo has an interaction called 'Reload' instead of 'Combine', which in turn would add the shells to the shotgun. I understand that there is a GetCount method in InvCollection which is used for the display on the Ammo menu (menu 8), so was considering adding another method called 'SetCount'. Not sure if that is a sensible approach.
However, I'd like to also make the item disappear from the inventory when 'Reload' is selected as above.
I tried to create an ObjectList for this, but wasn't sure how to remove the current item from the inventory and have the inventory ui update. Is there a straightforward way of getting a handle on the object that triggered the interaction in an ObjectList, or is there a better way to do this?
Lastly I'd also like to be able to 'Reload' the shotgun as well as/instead of reloading ammo, which would also use up an existing ammo item. This should only appear as an option if ammo exists in the inventory, or even better greyed out if no ammo exists.
I hope someone may be able to give me a few pointers.
Thanks,
Tuybrush
It looks like you're new here. If you want to get involved, click one of these buttons!
Comments
Welcome to the community, @TuybrushGhreepwood.
The combat example is fairly rudimentary, and will certainly need to be extended through further custom scripting in order to be made a proper game.
Currently, the ammo system is very simple. The shotgun itself does not have its own ammo count, each shot just depletes the amount of shotgun ammo being carried. The "combine" interaction on the ammo box is misleading, I'll admit.
Before the concept of reloading could be introduced, you'd first have to add a "loaded ammo" property to the weapons category, which would then be a separate record of ammo to the "shells" item. The PlayerCombat's Attack function could then be updated to reduce this property count by 1, and a Reload function could then be added to transfer ammo from the item to the property.
I can see this being of a wider benefit as part of the example goes, however, so I'll see if this can be added into the package itself.
Do you mean an InventoryBox element? AC's event system can be used for such things - and is used as part of the example's scripts.
The OnMenuElementClick event, for example, is triggered whenever a menu element is interacted with - you can read the passed parameters to determine what exactly was clicked.
More on this topic can be found in the Manual's "Custom events" chapter.
Inventory items are not stored within the InventoryBox menu element - this is just for display purposes. To modify the inventory itself, you can access it from:
Hi Chris,
Thank you for the welcome. I appreciate it, and also for the timely response.
I appreciate the suggestions, and have since looked at the Inventory manager. I assume you are referring to the 'Categories' and 'Properties' panels. It seems like the properties defined in the demo are (1) Attack rate (2) Ammo ID (4) Aim anim and (5) Attack anim. So I assume that I could add (3) Loaded ammo in there?
Thanks also for the link to the Events documentation, that seems like a very powerful feature.
For adding ammo after using it, I had assumed that 'AC.KickStarter.runtimeInventory.PlayerInvCollection' would be the correct way of updating the total for this ammo type, since I'd noticed this in PlayerCombat:
bool hasAmmo = KickStarter.runtimeInventory.PlayerInvCollection.GetCount (ammoID) > 0;However, since there is no 'SetCount' method would I need to add that as well?
Static classes are very familiar to me, and something I have used in many of my own Unity and further back Flash games, so it is great to see them in use here.
Finally as there are only predefined Interactions ('Use', 'Equip', 'Unequip' etc), how easy/hard would it be to either rename one or add another ('Reload')?
It would be great to see the demo updated as you suggested, if so I'd love to hear about it and take a look.
I appreciate your help and thanks again for making such a fantastic framework.
Regards,
Tuybrush
Yes - along with another Integer parameter for the weapons ammo capacity, if you wanted that to be variable as well.
I have now updated the example with a reload system.
To reduce an item's count, you can call the Delete function:
Interaction types are defined in the Cursor Manager - you can modify or create new ones there. A "Reload" interaction, along with the ability to combine ammo with weapons, is now provided as part of the updated package.