|
Post by naohisa on Apr 6, 2018 5:39:11 GMT
I wanna change weapon by script. For example, from gun to Katana.
Tell me how can I change it. Thanks.
|
|
|
Post by naohisa on Apr 9, 2018 0:57:29 GMT
I'm in trouble. I am waiting for your reply.
|
|
|
Post by Invector on Apr 9, 2018 2:01:53 GMT
Did you check our vInventory demo scene? there are several examples there of how to manipulate items though script.
|
|
|
Post by naohisa on Apr 10, 2018 0:42:46 GMT
Hi! Thank you for your reply!
I checked some scene, but I can't find it. Which demo scene is it?
|
|
|
Post by Invector on Apr 10, 2018 1:45:56 GMT
It's the "vInventory_Examples" scene, you can use the find tool or go into Invector/ItemManager
|
|
|
Post by naohisa on Apr 11, 2018 1:30:38 GMT
Thank you!
I can't have joystick. I want to open chest in "vInventory_Examples" scene. I'm trying to push any keyboard button, but I can't open chest. How can I open chest?
'c' is crouch. 'space' is jumping. '??????' is open chest. What is '???????'?
Sorry, I can't write English very well.
|
|
|
Post by naohisa on Apr 11, 2018 8:06:58 GMT
Hi, I could open chest in "vInvetory_Examples" scene!! Thanks!! Invector system said to me that "You Need A Weapon". Right, default character doesn't have a weapon. So, I want to select weapon, but I cannot select equipments. I touch "Enter" keyboard on this image, but I cannot select them. I think default character doesn't have a weapon in inventory, so I cannot select equipments. Did I get that right? So, I put sword and shield on the ground. I instantiated the prefab "Invector/MeleeCombat/Weapons/NoInventory/SwordV_long_Collectable" in the scene. But I cannot pick up, although I press "E" keyboard. Why do you know? Anyway, I want to know how to use ItemManager and change weapon by script. Do you have any documents about ItemManager? Thanks.
|
|
|
Post by Invector on Apr 11, 2018 15:09:49 GMT
Right... I think you miss the point of this scene, it contains several examples of how to add/remove/equip/unequip/destroy items using simple scripts.
With those examples, you will get the idea of how the itemManager works.
Take a look at this video:
|
|
|
Post by naohisa on Apr 12, 2018 7:41:39 GMT
Thanks!!
I could change weapon by script!!!!!!!!!!
I implemented the code below: This is correct?
=======================-
int indexOfEquipPoint = 1; int indexOfSlot = 1;
var item = itemManager.items.FirstOrDefault((c) => c.id == 1); itemManager.equipPoints[indexOfEquipPoint].area.ValidSlots[indexOfSlot].item = item; itemManager.equipPoints[indexOfEquipPoint].area.SetEquipSlot(indexOfSlot); itemManager.EquipItem(itemManager.equipPoints[indexOfEquipPoint].area, item);
|
|