|
Post by Frosted Brain on Jan 27, 2018 0:51:48 GMT
Is there a way to have different grenade types using the vThrow Object
|
|
|
Post by jrackley on Jan 27, 2018 1:50:30 GMT
Is there a way to have different grenade types using the vThrow Object I actually wrote a script for this, I will see if I can hunt it down
|
|
|
Post by Frosted Brain on Jan 27, 2018 2:46:02 GMT
Is there a way to have different grenade types using the vThrow Object I actually wrote a script for this, I will see if I can hunt it down Cool thanks
|
|
|
Post by Jader on Jun 10, 2018 2:38:15 GMT
Hello,
here a script that i using to make this, i hope it helps:
using System.Collections; using UnityEngine; using Invector.CharacterController;
public class BombManager : MonoBehaviour {
vThrowObject vThrowScript;
public static string NameOfSelected;
public Rigidbody BombImpact; public Rigidbody BombSmoke;
// Use this for initialization void Start () {
vThrowScript = GetComponent<vThrowObject>();
}
public void OnSelect(){
if (NameOfSelected == "Bomba de Impacto") { vThrowScript.objectToThrow = BombImpact; Debug.Log ("Bomba de Impacto"); } if (NameOfSelected == "Bomba de Fumaça") { vThrowScript.objectToThrow = BombSmoke; Debug.Log ("Bomba de Fumaça"); } } }
"Bomba de Impacto" e "Bomba de Fumaça" is the names of the weapons on inventory manager.
I add this after line 515 of the InventoryWheel.cs from sickscore to select it:
BombManager.NameOfSelected = selectedItem.Item.name; But you can adapt for your own way.
|
|
|
Post by Jader on Jun 10, 2018 2:55:03 GMT
Ah, i call the OnSelect() function in vItemManager event On Equip Item.
|
|
azul
Junior vMember
Posts: 38
|
Post by azul on Jan 8, 2021 15:46:47 GMT
I hate to resurrect such an old thread, but I can't seem to get this to work with the latest version of the controller. I also don't see how this controls the amount of grenades per type (public int currentThrowObject;). Wouldn't that have to be stored somewhere separately? Also, wouldn't it be better to use vItems for this instead (similar to how weapons are handled)? Has anyone figured out a work around for this? I thought a saw Invector post that they will be adding this functionality but that was back in 2018. I also don't use sickscore's InventoryWheel, so I'm not sure if Jader's script dependent on that.
|
|
|
Post by Yort_Draeb on Jan 10, 2021 9:29:34 GMT
I hate to resurrect such an old thread, but I can't seem to get this to work with the latest version of the controller. I also don't see how this controls the amount of grenades per type (public int currentThrowObject;). Wouldn't that have to be stored somewhere separately? Also, wouldn't it be better to use vItems for this instead (similar to how weapons are handled)? Has anyone figured out a work around for this? I thought a saw Invector post that they will be adding this functionality but that was back in 2018. I also don't use sickscore's InventoryWheel, so I'm not sure if Jader's script dependent on that. well i believe if you dont have any of the item. it doesnt show up. so you cant use it. but you could also sync ammo to current throw object if needed
|
|