Jump to content
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.

omard2000

Premium Member
  • Content count

    909
  • Joined

  • Last visited

  • Days Won

    10

omard2000 last won the day on July 1 2017

omard2000 had the most liked content!

Community Reputation

119 Excellent

About omard2000

  • Rank
    PHP, C#, Unity
  • Birthday 08/20/2000

Profile Information

  • Gender
    Not Telling
  • Location:
    United States
  • Interests
    - PHP and C#

Recent Profile Visitors

1,629 profile views
  1. Photon Damage

    @OneManArmy - Thank you so much! It worked perfectly!
  2. Photon Damage

    @OneManArmy - I'm confused now. Because two players take the damage (sometimes)? Here is my code: FPS_Shoot.cs public void Fire (){ RaycastHit hit; Ray ray = fpsCam.ScreenPointToRay (new Vector3 (Screen.width / 2, Screen.height / 2, 0)); if (Physics.Raycast (ray, out hit, range)) { if (hit.transform.tag == "Player") { if (this.gameObject.GetComponent <PhotonView> ().isMine) { hit.transform.GetComponent<PhotonView> ().RPC ("applyDamage", PhotonTargets.All, damage); Debug.Log (hit.transform.name); } } GameObject particleClone; // particleClone = PhotonNetwork.Instantiate (hitPar.name, hit.point, Quaternion.LookRotation (hit.normal), 0) as GameObject; // Destroy (particleClone, 2); } } FPS_Controller.cs [PunRPC] public void applyDamage(int dmg){ health = health -= dmg; } I don't know where I wen't wrong.
  3. Photon Damage

    Me neither Thanks OMA! I'll take a look at this rn!
  4. Photon Damage

    @OneManArmy - thanks for your reply! So I would use if (photonView.isMine) {the shooting code here}? I don't get how I would apply the damage to only one player?
  5. Photon Damage

    Hey guys, I was wondering how to add damage to only one player. I did call an RPC, but the RPC is called by every player in the room which leads to more damage being applied. So my question is how can I only apply the damage once? Thanks, Omard2000
  6. Photon Controlling Wrong Player

    Never mind, I found a solution. Thanks.
  7. Photon Controlling Wrong Player

    using System.Collections; using System.Collections.Generic; using UnityEngine; public class FPS_Controller : MonoBehaviour { public float speed = 6.0F; public float jumpSpeed = 8.0F; public float gravity = 20.0F; private Vector3 moveDirection = Vector3.zero; private Vector3 targetPosition; private Quaternion targetRotation; private PhotonView photonView; void Awake () { photonView = this.gameObject.GetComponent <PhotonView> (); PhotonNetwork.sendRate = 60; PhotonNetwork.sendRateOnSerialize = 30; } // Update is called once per frame void Update () { if (photonView.isMine) { MovePlayer (); } else { SmoothMove (); } } private void OnPhotonSerializeView (PhotonStream stream, PhotonMessageInfo info) { if (stream.isWriting) { stream.SendNext (transform.position); stream.SendNext (transform.rotation); } else { targetPosition = (Vector3)stream.ReceiveNext (); targetRotation = (Quaternion)stream.ReceiveNext (); } } private void SmoothMove () { transform.position = Vector3.Lerp (transform.position, targetPosition, 0.25f); transform.rotation = Quaternion.RotateTowards (transform.rotation, targetRotation, 500 * Time.deltaTime); } private void MovePlayer () { CharacterController controller = GetComponent<CharacterController>(); if (controller.isGrounded) { moveDirection = new Vector3(Input.GetAxis("Horizontal"), 0, Input.GetAxis("Vertical")); moveDirection = transform.TransformDirection(moveDirection); moveDirection *= speed; if (Input.GetButton("Jump")) moveDirection.y = jumpSpeed; } moveDirection.y -= gravity * Time.deltaTime; controller.Move(moveDirection * Time.deltaTime); } } Hey guys, whenever I make a build and play between two clients I am always controlling the opposite client, I don't know why though. Thanks, Omard2000
  8. PayPal Transactions?

    Sorry for another thread, I was wondering how to submit a PayPal payment through Unity? Would I have to use the WWW class? HTTP Requests? I want the user to be able to confirm the payment in game too. What is the best way to do this?
  9. Money Transactions (iOS)

    Thanks
  10. Money Transactions (iOS)

    There is a gambling service that is provided by Unity that offers a method of sending and receiving money. We would like to do this except that we are not gambling, it is the winning team (according to skill, not luck) that wins the $. Have you ever heard about this before?
  11. Money Transactions (iOS)

    Hey guys, Does anyone here know how to handle money transactions. The concept is that before the match starts both teams put in $1, and lets say that there are two teams. So the total money of both the teams would be $2. I want the winning team to get the $2. How would I do this using real money? I'd prefer not to use iTunes Credit. Any ideas? Thanks, Omard2000
  12. Photon Matchmaking Script

    It's not really that hard, and you can find them all over Google too if you searched for them. PhotonNetwork.CreateRoom (roomName); that's the basics to create a room. If you want to be able to set the room properties then you have to use RoomOptions. RoomOptions roomOptions = new RoomOptions (); roomOptions.MaxPlayers = (byte) maxPlayers; // Max Players roomOptions.isVisible = true; // Is visible (Server Browser) roomOptions.isOpen = true; // Players can join PhotonNetwork.CreateRoom (serverNameInput.text, roomOptions, TypedLobby.Default); // Create room You can also set Custom Properties for the room if you want to add a map name etc...
  13. PUN (PhotonTargets.AllBuffered RPC Calls)

    Thanks!
  14. PUN (PhotonTargets.AllBuffered RPC Calls)

    @OneManArmy - Like when the player leaves a room I need to update it in the hash table right? Sorry if it wasn't clear.
  15. PUN (PhotonTargets.AllBuffered RPC Calls)

    Thank you so much! One last question, how would I go about a player disconnected from the server? How would I update the teams when a player disconnects? @OneManArmy would I use the OnPhotonPlayerDisconnected function then just send an RPC call and save it in the HashTable again? Thanks again!
×