i want change the inventory size,please help me.Code:string chest = "LootCache"; Vector3 randposition = session.WorldPlayerEntity.transform.position; RaycastHit hitInfo; if (Physics.Raycast(randposition, Vector3.down, out hitInfo)) { Quaternion rotation = Quaternion.Euler(0.0f, (float)UnityEngine.Random.Range(0f, 360f), 0.0f); rotation = Quaternion.FromToRotation(Vector3.down, hitInfo.normal) * rotation; if(!hitInfo.collider.gameObject.name.Contains("UV") && !hitInfo.collider.gameObject.name.Contains("Cliff") && !hitInfo.collider.gameObject.name.Contains("Zone") && !hitInfo.collider.gameObject.name.Contains("Cube") && !hitInfo.collider.gameObject.name.Contains("Build")) { GameObject Obj = Singleton<HNetworkManager>.Instance.NetInstantiate(chest, hitInfo.point, Quaternion.identity, GameManager.GetSceneTime()); Inventory inv = Obj.GetComponent<Inventory>() as Inventory; uLink.NetworkView nwv = uLink.NetworkView.Get(Obj); Puts(inv.GetDefaultCapacity().ToString()); } }
Solved Spawn a "LootCache" how change this Inventory size?
Discussion in 'Hurtworld Development' started by 不是很会玩, Oct 31, 2016.
-
@Noviets please help!
-
You were so close!
you want inv.StartingFreeSlots = 10; (Int)
Code:string chest = "LootCache"; Vector3 randposition = session.WorldPlayerEntity.transform.position; RaycastHit hitInfo; if (Physics.Raycast(randposition, Vector3.down, out hitInfo)) { Quaternion rotation = Quaternion.Euler(0.0f, (float)UnityEngine.Random.Range(0f, 360f), 0.0f); rotation = Quaternion.FromToRotation(Vector3.down, hitInfo.normal) * rotation; if(!hitInfo.collider.gameObject.name.Contains("UV") && !hitInfo.collider.gameObject.name.Contains("Cliff") && !hitInfo.collider.gameObject.name.Contains("Zone") && !hitInfo.collider.gameObject.name.Contains("Cube") && !hitInfo.collider.gameObject.name.Contains("Build")) { GameObject Obj = Singleton<HNetworkManager>.Instance.NetInstantiate(chest, hitInfo.point, Quaternion.identity, GameManager.GetSceneTime()); Inventory inv = Obj.GetComponent<Inventory>() as Inventory; uLink.NetworkView nwv = uLink.NetworkView.Get(Obj); inv.StartingFreeSlots = 10; Puts(inv.GetDefaultCapacity().ToString()); } }
-
spawn "LootCache"Inventory Number just only 1
[DOUBLEPOST=1477968315][/DOUBLEPOST]