This site uses cookies! Learn More

This site uses cookies!

armedunity.com uses cookies to improve user experience.

By continuing to use this site, you agree to allow us to store cookies on your computer.

fpsarmedunity

Member
  • Content count

    57
  • Joined

  • Last visited

  • Days Won

    2

fpsarmedunity last won the day on October 25 2016

fpsarmedunity had the most liked content!

Community Reputation

4 Neutral

About fpsarmedunity

  • Rank
    Member
  • Birthday 11/20/1950

Profile Information

  • Gender
    Male
  • Location:
    World
  1. very useful .. many thanks ..really many thanks..
  2. got i converted Transform bulletshell = Instantiate(bulletPrefab, shellspawn.position, bulletPrefab.rotation); bulletshell.GetComponent<Rigidbody>().AddForce(transform.up * Random.Range(1.0f, 2.0f) * 75); bulletshell.GetComponent<Rigidbody>().AddForce(transform.right * Random.Range(1.0f, 2.0f) * 75); and working on c# version of fpskit 1.5 put after void FireOneBullet() and this script must be attached to yout bullet prefab...now with sound on bullet impact with terrain.. "" solved.. SIMPLY used destroy after from oma fpskit free on bulleshell prefab.. thEre is a known bug...with audio since bullet dont disapper ( i cannot figured how to make them disapper until now) so shell impact audio loop when shells are on terrain.. LOL "" using UnityEngine; using System.Collections; public class BulletShell : MonoBehaviour { public AudioClip impact; AudioSource audio; void Start() { audio = GetComponent<AudioSource>(); } void OnCollisionEnter() { audio.PlayOneShot(impact, 0.7F); } void Update() { if (Time.timeScale != 0) { transform.Rotate(new Vector3(Random.value * 40, Random.value * 40, Random.value * 30) * 0.1f /* * Time.deltaTime*/); } } } so thanks to Ocualarcash and UnityGamesRoland( as you can see i dont want you or everyone else write the scritps for me....i only need some hints) . and how make bullets stop rotate when on terrain disapper after few seconds the are fired? sOLVED
  3. I never asked to make scripts for me... i only aksed the correct syntax of the same script in c# since i'm new to coding and i could make mistakes converting form js to c# btw i think first part of the mothod is correclty converted to c# ... Transform bulletshell = Instantiate(bulletPrefab, shellspawn.position, bulletPrefab.rotation); bulletshell.GetComponent<Rigidbody>().AddForce(transform.up * Random.Range(1.0f, 2.0f) * 75); bulletshell.GetComponent<Rigidbody>().AddForce(transform.right * Random.Range(1.0f, 2.0f) * 75); and i'm following this tutorial and i put these lines after https://armedunity.com/topic/1280-adding-bulletshells-tutorial/#comment-12130 void FireOneBullet() but about second part i must create a new script and put it on my bullet prefab?
  4. are you referring to me?? if yes i didnt undertand what you said
  5. can please someone make a c# conversion of the scripts and explain how the procedure must be done?? thanks.
  6. hi have over 350 games in library ..played maybe 20
  7. got it thanks again... I'll try to ask to oma.. who knows...??
  8. ok understood... thanks again for your time.. could you advise me another good weapon system to start with and expand with my own code??
  9. thanks again for your reply and the explaination it is how i was supposing ... btw i was thinking there was a way thias could be solved even with this ammo system.. is there any workaround to bypass this into fpskit as you know??
  10. thanks for your reply but i cannot figured what you wrote this is the weapon manager script i'm using using UnityEngine; using System.Collections; public class WeaponManager : MonoBehaviour { // FPS KIT [www.armedunity.com] public GameObject[] weaponsInUse; public GameObject[] weaponsInGame; public Rigidbody[] worldModels; public RaycastHit hit; private float dis = 3.0f; public LayerMask layerMaskWeapon; public LayerMask layerMaskAmmo; public Transform dropPosition; private float switchWeaponTime = 0.25f; //[HideInInspector] public bool canSwitch = true; [HideInInspector] public bool showWepGui = false; [HideInInspector] public bool showAmmoGui = false; private bool equipped = false; [HideInInspector] public int weaponToSelect; [HideInInspector] public int setElement; [HideInInspector] public int weaponToDrop; public GUISkin mySkin; public AudioClip pickupSound; public AudioSource aSource; public HealthScript hs; private string textFromPickupScript = ""; private string notes = ""; private string note = "Press key <color=#88FF6AFF> << E >> </color> to pick up Ammo"; private string wrongType = "Select appropriate weapon to pick up"; public int selectWepSlot1 = 0; public int selectWepSlot2 = 0; void Start() { for (int h = 0; h < worldModels.Length; h++) { weaponsInGame[h].SetActive(false); } weaponsInUse[0] = weaponsInGame[selectWepSlot1]; weaponsInUse[1] = weaponsInGame[selectWepSlot2]; weaponToSelect = 0; StartCoroutine(DeselectWeapon()); } void Update() { if (Cursor.lockState == CursorLockMode.None) return; if (Input.GetKeyDown("1") && weaponsInUse.Length >= 1 && canSwitch && weaponToSelect != 0) { StartCoroutine(DeselectWeapon()); weaponToSelect = 0; } else if (Input.GetKeyDown("2") && weaponsInUse.Length >= 2 && canSwitch && weaponToSelect != 1) { StartCoroutine(DeselectWeapon()); weaponToSelect = 1; } if (Input.GetAxis("Mouse ScrollWheel") > 0 && canSwitch) { weaponToSelect++; if (weaponToSelect > (weaponsInUse.Length - 1)) { weaponToSelect = 0; } StartCoroutine(DeselectWeapon()); } if (Input.GetAxis("Mouse ScrollWheel") < 0 && canSwitch) { weaponToSelect--; if (weaponToSelect < 0) { weaponToSelect = weaponsInUse.Length - 1; } StartCoroutine(DeselectWeapon()); } Vector3 pos = transform.parent.position; Vector3 dir = transform.TransformDirection(Vector3.forward); if (Physics.Raycast(pos, dir, out hit, dis, layerMaskWeapon)) { WeaponIndex pre = hit.transform.GetComponent<WeaponIndex>(); setElement = pre.setWeapon; showWepGui = true; if (weaponsInUse[0] != weaponsInGame[setElement] && weaponsInUse[1] != weaponsInGame[setElement]) { equipped = false; } else { equipped = true; } if (canSwitch && !equipped) { if (Input.GetKeyDown("e")) { DropWeapon(weaponToDrop); StartCoroutine(DeselectWeapon()); weaponsInUse[weaponToSelect] = weaponsInGame[setElement]; Destroy(hit.transform.gameObject); } } } else { showWepGui = false; } if (Physics.Raycast(pos, dir, out hit, dis, layerMaskAmmo)) { showAmmoGui = true; if (hit.transform.CompareTag("Ammo")) { Pickup pickupGO = hit.transform.GetComponent<Pickup>(); //bullets/magazines if (pickupGO.pickupType == PickupType.Magazines) { WeaponScriptNEW mags = weaponsInUse[weaponToSelect].transform.GetComponent<WeaponScriptNEW>(); /* if (mags == null) { textFromPickupScript = ""; return; } */ if (mags == null) { notes = ""; textFromPickupScript = pickupGO.AmmoInfo; notes = wrongType; return; } if (mags.firstMode != fireMode.launcher) { notes = ""; textFromPickupScript = note; if (Input.GetKeyDown("e")) { if (mags.ammoMode == Ammo.Magazines) mags.magazines += pickupGO.amount; else mags.magazines += pickupGO.amount * mags.bulletsPerMag; aSource.PlayOneShot(pickupSound, 0.3f); Destroy(hit.transform.gameObject); } } else { textFromPickupScript = pickupGO.AmmoInfo; notes = wrongType; } } //projectiles/rockets if (pickupGO.pickupType == PickupType.Projectiles) { WeaponScriptNEW projectile = weaponsInUse[weaponToSelect].transform.GetComponent<WeaponScriptNEW>(); if (projectile == null) { textFromPickupScript = ""; return; } if (projectile.secondMode == fireMode.launcher || projectile.firstMode == fireMode.launcher) { notes = ""; textFromPickupScript = note; if (Input.GetKeyDown("e")) { projectile.projectiles += pickupGO.amount; aSource.PlayOneShot(pickupSound, 0.3f); Destroy(hit.transform.gameObject); } } else { textFromPickupScript = pickupGO.AmmoInfo; notes = wrongType; } } //health if (pickupGO.pickupType == PickupType.Health) { textFromPickupScript = pickupGO.AmmoInfo; notes = ""; if (Input.GetKeyDown("e")) { hs.Medic(pickupGO.amount); aSource.PlayOneShot(pickupSound, 0.3f); Destroy(hit.transform.gameObject); } } } } else { showAmmoGui = false; } } void OnGUI() { GUI.skin = mySkin; if (showWepGui) { if (!equipped) GUI.Label(new Rect(Screen.width / 2 - 400, Screen.height - (Screen.height / 1.4f), 800, 100), "Press key <color=#88FF6AFF> << E >> </color> to pickup weapon", mySkin.customStyles[1]); else GUI.Label(new Rect(Screen.width / 2 - 400, Screen.height - (Screen.height / 1.4f), 800, 100), "Weapon is already equipped", mySkin.customStyles[1]); } if (showAmmoGui) GUI.Label(new Rect(Screen.width / 2 - 400, Screen.height - (Screen.height / 1.4f), 800, 200), notes + "\n" + textFromPickupScript, mySkin.customStyles[1]); } IEnumerator DeselectWeapon() { canSwitch = false; for (int i = 0; i < weaponsInUse.Length; i++) { weaponsInUse[i].SendMessage("Deselect", SendMessageOptions.DontRequireReceiver); weaponsInUse[i].gameObject.SetActive(false); } yield return new WaitForSeconds(switchWeaponTime); SelectWeapon(weaponToSelect); yield return new WaitForSeconds(switchWeaponTime); canSwitch = true; } void SelectWeapon(int i) { weaponsInUse[i].gameObject.SetActive(true); weaponsInUse[i].SendMessage("DrawWeapon", SendMessageOptions.DontRequireReceiver); WeaponIndex temp = weaponsInUse[i].transform.GetComponent<WeaponIndex>(); weaponToDrop = temp.setWeapon; } void DropWeapon(int index) { if (index == 0) return; for (int i = 0; i < worldModels.Length; i++) { if (i == index) { Rigidbody drop = Instantiate(worldModels[i], dropPosition.transform.position, dropPosition.transform.rotation) as Rigidbody; drop.AddRelativeForce(0, 250, Random.Range(100, 200)); drop.AddTorque(-transform.up * 40); } } } public void EnterWater() { canSwitch = false; for (int i = 0; i < weaponsInUse.Length; i++) { weaponsInUse[i].SendMessage("Deselect", SendMessageOptions.DontRequireReceiver); weaponsInUse[i].gameObject.SetActive(false); } } public void ExitWater() { canSwitch = true; SelectWeapon(weaponToSelect); } } can you explain me better please..? thaks in advance
  11. Hi to all.. i have a maybe simple question for you.. I noticed taht with oma fpskit 1.5 (c# version) if i approach to an ammo pickup i cannot pickup it if i havent a weapon pickuped yet (eg. sniper rifle) and ammo pickup prompt (press e key to puckup) will not shown .. but even if i have a weapon yet i can only pickup the ammo for the weapon i have.. i want to be able to pickup ammo even if i have not a weapon picked up yet and even if i dot have the correct weapon for ammo type... how can i manage to accomplish this?' many thanks in advance
  12. could you explain me better please..waht do you mean abut creating a box for the item description under the inventory?' are you referring to ui or the script?
  13. THANKS for the link.. isaw it yet ,, but my problem is that i have an inventory system that use a texturev for diplay object in it so i want to have a tooltip diplaying the object description(e.g. this is a pizza it restores 20 hp points etc) when mouse is over the texture in the inventory that is dynamic in tis postion.. could someone help?
  14. thanks for the tup.. but obviusly i googled a lot and read a lot of resources.. but me bad i canot figured how to manage it correclty