Include Nonon Zone Inventory

CharacterController Version 5.0.0 and higher

The Nonon Zone Inventory is another Asset that can be purchased from Unity Asset Store.

The CharacterController Asset is now prepared to run with the Inventory Asset together. As soon as you purchase and install the Inventory, the CharacterController runs with the Inventory.

Add the Inventory to the PlayerPrefab

As soon as you imported the Inventory Asset, you have another menu item available: “Tools –> Nonon Zone –> SinglePlayer/Multiplayer –> Add Inventory to player.”

Navigate to Assets/NononCharController/Prefabs/Player and open up either the PlayerPrefab or PlayerPrefabNetwork1. Then choose the Menu “Add Inventory to player”. After that a Wizard will open up.

Create another entry for 1HRight and 1HLeft and wire up all the transform holder as shown in the picture here.

Choose “Add to player”. With this the Prefab NononInventoryUI will be added to the PlayerPrefab and two components are added to the top most transform “PlayerPrefab”.

If you do this for PlayerPrefabNetwork, the Network variants are added to the Prefab.

Extend the playground Singleplayer

If you run now the playground, you can open up the inventory by pressing “i”

The CharacterController will not pickup anymore the default loot bubbles, as you can see if you run through the bubbles. This is because the inventory needs “Ground Items” to be able to pickup the items into the Inventory.

The following preconditions need to be met:

  • An item with the “NononGroundItem” component on it needs to be added to a transform with a collider.
  • The Item on NononGround item needs to be an ItemObject from the Inventory Asset
  • The Item Object itself needs to have a prefab on the “CharacterDisplay” item on it, that has a “AWeapon” and a “IWeaponAnimatorInventory” component on it

With these preconditions the item can be picked up, equipped and used

Examples with existing ressources

Navigate to the Assets/NononInventory/Prefabs/LootBeam in the Projec Navigator and Drag and Drop the LootBeamYellow into the scene

In the hierarchy select the newly inserted LootBeamYellow and choose on the NononGroundItem the circle on the right of the item that lets you choose an ItemObject. Choose “SwordOfTheUgu”.

Select the ItemObject and the project explorer will show you the right location in the project: Assets/NononInventory/Scripts/Item Assets/SwordOfTheUgu. Choose the ItemObject.

In the Inspector click on the circle on the “CharacterDisplay” anc Choose “SwordBigYellowInventory” from the list.

Now you’re ready to pickup the item and use it:

Extend the playground Multiplayer

If you run the playground with the Multiplayer Inventory added to the PlayerPrefabNetwork1, you can open up the inventory by pressing “i” in multiplayer mode. It’s the exact same process, but choosing Multiplayer from the menu.

The CharacterControllerNetwork will not pickup anymore the default loot bubbles, as you can see if you run through the bubbles. This is because the inventory needs “Ground Items” to be able to pickup the items into the Inventory.

The following preconditions need to be met:

  • An item with the “NononGroundItemNetwork” component on it needs to be added to a transform with a collider.
  • The Item on NononGround item needs to be an ItemObject from the Inventory Asset
  • The Item Object itself needs to have a prefab on the “CharacterDisplay” item on it, that has a “AWeapon” and a “IWeaponAnimatorNetworkInventory” component on it

With these preconditions the item can be picked up, equipped and used

Examples with existing ressources

In this example we are gonna modify the the Sword and Dagger Loot, so that you can pickup, equip and use it with the inventory asset for multiplayer.

Be Aware: We will change here the ItemObject again. So if you need it for Single- and multiplayer, you need to create two different Item Objects.

Navigate to the folder “Assets/NononInventory/Scripts/Item Assets

Choose the ItemObject “SwordOfTheUgu” select in the CharacterDisplay the circle on the right and choose “SwordBigYellowNetworkInventory“.

Choose for “SwordOfTheHugo” “DaggerYellowNetworkInventory
Choose for “SwordOfTheFish” “DaggerGreenNetworkInventory
Choose for “SwordOfTheBeagle” “SwordBigGreenNetworkInventory

Navigate to the folder “Assets/NononInventory/Prefabs/Loot

Select the “PrefabDirectory” element from the project hierarchy

Drag for the Element4 the Prefab “SwordOfTheUgu” inside
Drag for the Element5 the Prefab “SwordOfTheHugo” inside
Drag for the Element6 the Prefab “SwordOfTheBeagle” inside
Drag for the Element7 the Prefab “SwordOfTheFish” inside

Select the “NononNetworkspawner” element from the project hierarchy

Change for the elements 4-7 the Nw Object Type to NW_OBJECT

Select the “NononNetworkManagerPlayground” element from the project hierarchy

Add 4 new entries in the NetworkPrefabs list.

Drag in again the SwordOfTheUgu, SwordOfTheHugo, SwordOfTheBeagle, SwordOfTheFish from the Assets/NononInventory/Prefabs/Loot into the emtpy slots.

Hit run and enjoy


    0 Comments

    Leave a Reply

    Avatar placeholder