Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. Dismiss Notice

FPS Kit | Version 2.0

Discussion in 'Assets and Asset Store' started by NSdesignGames, Oct 2, 2012.

  1. ThrillKill

    ThrillKill

    Joined:
    Apr 7, 2014
    Posts:
    80
    Hi Stan.

    How does this compare to how you have done it? I haven't been able to get the WKW working got any tips suggestions? I've tried scrollview textviews but they dont keep the whole string of WKW oddly enough.

    NGUI Code I've used. my script changes below.

    Code (csharp):
    1.     //NGUI Intregation
    2.     public UILabel roundTimeLabel = null;
    3.     public UILabel teamAScoreLabel = null;
    4.     public UILabel teamBScoreLabel = null;
    5.     public UILabel topPlayerLabel = null;
    6.     public UILabel finalTextLabel = null;
    7.     public UILabel finalText2Label = null;
    8.     public UILabel playerNameLabel = null;
    in onGUI ()
    Code (csharp):
    1. roundTimeLabel.text = niceTime;
    2. if(gameMode == "TDM"){
    3.             teamAScoreLabel.text = team_1.teamName + ": " + team1Score.ToString();
    4.             teamBScoreLabel.text = team_2.teamName + ": " + team2Score.ToString();
    in RoundEnded();
    Code (csharp):
    1. finalTextLabel.text = finalText;
    Then adding this in: SpawnPlayer()
    Code (csharp):
    1. void SpawnPlayer()
    2. playerNameLabel.text = "Name: " + Player.name;   // This gets the players name
    3.  
    Code (csharp):
    1. //New AmmoDisplay.cs redone with NGUI Integrated.  No textures yet.
    2.  
    3. using UnityEngine;
    4. using System.Collections;
    5.  
    6. public class AmmoDisplay : MonoBehaviour {
    7.  
    8.     //NGUI Code
    9.     public UILabel weaponNameLabel = null;
    10.     public UILabel clipsLabel = null;
    11.     public UILabel ammoLabel = null;
    12.     public bool display = true;
    13.  
    14.     [HideInInspector]
    15.     int bulletsLeft;
    16.     [HideInInspector]
    17.     float clips;
    18.     [HideInInspector]
    19.     WeaponScript weaponscript;
    20.     [HideInInspector]
    21.     WeaponManager weaponManager;
    22.     [HideInInspector]
    23.     WeaponScript currentWeapon;
    24.     [HideInInspector]
    25.     float color;   
    26.    
    27.     void Awake () {
    28.         weaponManager = gameObject.GetComponent<WeaponManager>();
    29.     }
    30.    
    31.     void Update(){
    32.         if(weaponManager.SelectedWeapon){
    33.             weaponscript = weaponManager.SelectedWeapon.GetComponent<WeaponScript>();
    34.         }
    35.         if(!weaponscript)
    36.             return;
    37.         if(weaponscript.GunType == WeaponScript.gunType.MACHINE_GUN){
    38.             bulletsLeft = weaponscript.machineGun.bulletsLeft;
    39.             clips = weaponscript.machineGun.clips;
    40.         }
    41.        
    42.         if(weaponscript.GunType == WeaponScript.gunType.SHOTGUN){
    43.             bulletsLeft = weaponscript.ShotGun.bulletsLeft;
    44.             clips = weaponscript.ShotGun.clips;
    45.         }
    46.        
    47.         if(weaponscript.GunType == WeaponScript.gunType.GRENADE_LAUNCHER){
    48.             clips = weaponscript.grenadeLauncher.ammoCount;
    49.         }
    50.        
    51.         if(currentWeapon != weaponManager.SelectedWeapon){
    52.             color = Mathf.Lerp(color, 0.3f, Time.deltaTime * 20);
    53.             if(color < 0.32f){
    54.                 currentWeapon = weaponManager.SelectedWeapon;
    55.             }
    56.         }
    57.     }
    58.    
    59.     void OnGUI (){
    60.         if(!display) return;
    61.        
    62.         if(weaponscript){
    63.             if(weaponscript.GunType != WeaponScript.gunType.KNIFE){
    64.                 if(weaponscript.GunType == WeaponScript.gunType.GRENADE_LAUNCHER){
    65.                     clipsLabel.text = "Ammo Left: " + clips;
    66.                     ammoLabel.text = "∞";
    67.                 }else{
    68.                     ammoLabel.text = "Clip Ammo Left: " + bulletsLeft;
    69.                     clipsLabel.text = "Ammo Left: " + clips;
    70.                 }
    71.             }else{
    72.                 ammoLabel.text = "∞";
    73.                 clipsLabel.text = "∞";
    74.             }
    75.             weaponNameLabel.text = currentWeapon.weaponName;
    76.         }
    77.     }
    78. }
    new DrawPlayerName.cs NGUI Integrated

    Code (csharp):
    1. using UnityEngine;
    2. using System.Collections;
    3. using System;
    4.  
    5. public class DrawPlayerName : MonoBehaviour {
    6.    
    7.     string playerName;
    8.     PlayerDamage pd;
    9.  
    10.     public UILabel healthLabel = null;
    11.     public UISlider healthSlider = null;
    12.     public UILabel nameLabel = null;
    13.  
    14.     void Awake(){
    15.         pd = gameObject.GetComponent<PlayerDamage>();
    16.         playerName = gameObject.name;
    17.     }
    18.    
    19.     void Update(){
    20.         playerName = gameObject.name;
    21.     }
    22.  
    23.     void OnGUI(){
    24.         nameLabel.text = "Name: " + playerName;
    25.         healthLabel.text =  (int)(pd.currentHp) + "%";
    26.         healthSlider.value = pd.currentHp / pd.hp;
    27.     }
    28. }

    Appreciate your insight.
     
    Last edited: May 7, 2014
  2. Steve-of-Construction

    Steve-of-Construction

    Joined:
    Jan 26, 2013
    Posts:
    67
    Can anyone say what the variable doDamage (=false) in Bullet.cs does?
    It's hidden in inspector and I can't find any script that refers or sets this var.
    Code (csharp):
    1. function Update () {
    2. ...
    3. //We cant hit ourselfs
    4. if(hit.transform.tag != "Player"  doDamage){
    5.     hit.transform.SendMessageUpwards("ApplyDamage", damage, SendMessageOptions.DontRequireReceiver);   
    6. }
    Btw. I still couldn't figure out why enemies report a kill if it was a team-kill and why I can team-kill at all :-(
     
    Last edited: May 7, 2014
  3. uhygygyy

    uhygygyy

    Joined:
    May 5, 2014
    Posts:
    5
    Hello ı just buyed your kit but i getting this issue : I build the game with no any changes. My friends downloaded it works. I make a game room they joined.
    I am seeing my friends as Clones they on map but they are only models. I can chat with they.

    $Last One MP 2014-05-07 22-57-35-71.jpg

    http://i.hizliresim.com/krGPm7.jpg
     

    Attached Files:

  4. ThrillKill

    ThrillKill

    Joined:
    Apr 7, 2014
    Posts:
    80
    Highly recommend you read through this forum. You will find answers to most of your questions you'll have just by reading through this forum.

    This is because you don't have a Remote tag in your list.
    Probally back in the first 20-30 pages there are like 20 people with same question.
     
  5. ThrillKill

    ThrillKill

    Joined:
    Apr 7, 2014
    Posts:
    80
    doDamage is pretty self explanatory = whether or not to do damage. <-- this is associated with the isRemote bool also which controls if you can get hurt. this is so you can't shoot or blow up yourself if its a local bullet/projectile because it will not doDamage.

    if doDamage is false -> then dont do any damage. Not to mention that part of the code.....I noticed it's not commented out. Are you using that code?

    ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
    //We cant hit ourselfs
    //if(hit.transform.tag != "Player" doDamage){
    //Debug.Log("message: " + hit.transform.GetComponent<HitBox>().message);
    // hit.transform.SendMessageUpwards("ApplyDamage", damage, SendMessageOptions.DontRequireReceiver);
    //}

    but i would guess since your using function your using Java. This is not used on the C# version. Add in a debug and see what it says. You may just end up having to go about this the hard way and add a debug log to everything associated with doing damage to find out when it changes to the wrong player as you've mentioned.
     
    Last edited: May 8, 2014
  6. ThrillKill

    ThrillKill

    Joined:
    Apr 7, 2014
    Posts:
    80
    Well you have a value at line 110 that your trying to access somewhere and the value is null. What do you have at line 110? What I have there was not originally there but I'll assume its probally the roundduration. Prolly just assign a temporary value to whatever it is before it gets changed to whatever calls it will at least have a value until its needed.
     
  7. ThrillKill

    ThrillKill

    Joined:
    Apr 7, 2014
    Posts:
    80
    Play sound on headshot

    heres my example .... change message == "HeadShot" to whatever you called the headshot hitbox.

    in PlayerDamage.cs
    networkObject.SendMessage("PlayerHeadShot" ==== change the PlayerHeadShot to whatever your going to call from wkw (ie. void PlayerHeadShot

    inside:
    Code (csharp):
    1. if(!photonView.isMine){
    Put this:
    Code (csharp):
    1. if (message == "HeadShot"){
    2.     networkObject.SendMessage("PlayerHeadShot", PhotonNetwork.player.name, SendMessageOptions.DontRequireReceiver);
    3. }

    Then in WhoKilledWho.cs

    Addin:
    Code (csharp):
    1. public AudioClip headShot;
    2. public bool isHeadShot = false;
    inside:
    Code (csharp):
    1. void OnGUI(){
    put this:
    Code (csharp):
    1. if (isHeadShot) {
    2.     StartCoroutine (PlayHeadShotClip ());
    3.     isHeadShot = false;
    4. }
    then somewhere at the bottom above say:
    Code (csharp):
    1. void OnPhotonPlayerDisconnected
    Need this. cant believe i forgot to post it. You need this. You can change this to be whatever message your sending. This is the name of the network message your calling. This sets it to be true and play headshot on gui

    Code (csharp):
    1.     void PlayerHeadShot(string playerName){
    2.         isHeadShot = true;
    3.     }
    4.  

    put this:
    Code (csharp):
    1. IEnumerator PlayHeadShotClip(){
    2.         AudioSource.PlayClipAtPoint(headShot, Camera.main.transform.position);
    3.         yield return new WaitForSeconds(headShot.length);
    4.     }
    You can modify this pretty easy and add in killing spree sounds textures when they launch etc.
     
    Last edited: May 9, 2014
  8. Le_Hieu

    Le_Hieu

    Joined:
    Mar 26, 2011
    Posts:
    31
    @ThrillKill: Thank you very much!
     
  9. uhygygyy

    uhygygyy

    Joined:
    May 5, 2014
    Posts:
    5

    Hey thanks ! It worked but i got 2 more problems.

    1-) Bullet firing weapons did not give damage. But Launchers ( RPG ) can give damage to other players.
    2-) When i came near to a other player i got a big jump out of map.

    Thanks for helping. I can't understand what people say in this threat i dont know english very well. So if you know the solition please answer.
     
  10. sezbladex

    sezbladex

    Joined:
    Sep 15, 2013
    Posts:
    22
    thank you thrillkill :)) send me pm i give you my weapon model :))
     
  11. ThrillKill

    ThrillKill

    Joined:
    Apr 7, 2014
    Posts:
    80
    Thanks appreciate it but I would really be interested in hearing how you did the animations. I tried with 3dsmax, found out its limited to only 1 animation edit for FBX, and I'm total beginner with 3ds. I know enough to link the weapons, break apart elements and move around bones and nodes to where I need them for a reload animation.

    I myself and no doubt others would like to hear a little about how you did the animations and got it linked. Granted there's a great setup how to implement the but creating the animations for whatever reason don't seem to find a lot on how to complete this. I've got litterly 100's of models.

    Theres a great site online for free assests. (I got my transformers from here for co-op mode) Not sure what the forum rules are for posting links but if you google search: tf3dm you'll find it.
     
  12. ThrillKill

    ThrillKill

    Joined:
    Apr 7, 2014
    Posts:
    80
    1. Did you change anything in the bullet or playerdamage? Just stock?

    2. On network controller prefab in character controller modify your Step Offset. There was a post a while back about it. I found doing what it said (i believe it was to make it 0) that made travel difficult on stairs and levels. I personally use: 0.05 and find that works well enough.
     
  13. uhygygyy

    uhygygyy

    Joined:
    May 5, 2014
    Posts:
    5

    1-) Yes i did not changed anythink. Just downloaded kit and opened kit in a blank project.
    2-) Yeah thanks changed it.
     
  14. Drymarti111

    Drymarti111

    Joined:
    Jun 23, 2013
    Posts:
    201
    I have in this line:
    " roundDuration = (int)PhotonNetwork.room.customProperties["RoundDuration"]; "

    Well what can i change here?
     
  15. Nexonity

    Nexonity

    Joined:
    Aug 2, 2013
    Posts:
    6
    How can i make so that a multiplayer character loose some lives when touching a object, like lava.
     
  16. ThrillKill

    ThrillKill

    Joined:
    Apr 7, 2014
    Posts:
    80
    Well with the original code this value is null when room muliplayer becomes awake because the value isnt set yet.

    my old code before i converted most things to NGUI

    in the connect.cs

    in the variable declaration part at the top add:
    Code (csharp):
    1. //Round Duration Settings
    2.     List<int> maxTimeOptions = new List <int>();
    in
    Code (csharp):
    1. void Start ()
    add:
    Code (csharp):
    1. //Setup possible numbers for max players in one room
    2.         maxPlayersOptions.Add(4);
    3.         maxPlayersOptions.Add(8);
    4.         maxPlayersOptions.Add(12);
    5.         maxPlayersOptions.Add(16);
    6.         maxPlayers = maxPlayersOptions[2];
    7.         selectedMap = 0;
    8.         //Setup possible numbers for max players in one room
    9.         maxTimeOptions.Add (200);
    10.         maxTimeOptions.Add (300);
    11.         maxTimeOptions.Add (500);
    12.         maxTimeOptions.Add (800);
    13.         //Prevent roundDuration being less than 0 and set default duration
    14.         roundDuration = maxTimeOptions [2];
    in: void ShowConnectMenu(){

    after this:
    Code (csharp):
    1. GUILayout.BeginHorizontal();
    2. GUILayout.Label("Max Players", GUILayout.Width(150));
    Add:
    Code (csharp):
    1. // Select Round Duration Time
    2. GUILayout.Space(5);
    3. GUILayout.BeginHorizontal();
    4. GUILayout.Label("Time", GUILayout.Width(130));
    5. for(int i = 0; i < maxTimeOptions.Count; i++){
    6.     if(roundDuration == maxTimeOptions[i]){
    7.     //Selected number is green
    8.     GUI.color = Color.green;
    9.     }else{
    10.     GUI.color = Color.white;
    11.     }
    12.     if(GUILayout.Button(maxTimeOptions[i].ToString(), GUILayout.Width(45), GUILayout.Height(28))){
    13.     roundDuration = maxTimeOptions[i];
    14.     }
    15. }
    16. GUI.color = Color.white;
    17. GUILayout.EndHorizontal();
    this way you can not only choose the time for round duration its set before RoomMultiplayer tried to pull the value from it.
     
  17. ThrillKill

    ThrillKill

    Joined:
    Apr 7, 2014
    Posts:
    80
    I would go through your scenes and make sure Remote tag is visible on all of them. This is normally the reason. Either that or something up with unity. I have had this happen to me before and it was nothing wrong with code unity somehow broke i reinstalled it and no issues since. Dunno if thats your case. You could also try to reimport it. Out of the box you should really only have the remote tag problem and the roundduration = null and the offset probs.
     
  18. KingofMk98

    KingofMk98

    Joined:
    Oct 10, 2013
    Posts:
    63
    Alright i need some help. In a built game, the tracer doesnt appear until the bullet is pretty far away, but in the editor, the tracer spawns where it should. I cant figure it out so any help is appreciated. $tracer.png
     
  19. CrimeR

    CrimeR

    Joined:
    May 10, 2014
    Posts:
    2
    Hello how to solve such a problem that will not do, either setting Projects immediately occurs:
    $51769_ph.jpg
     
  20. uhygygyy

    uhygygyy

    Joined:
    May 5, 2014
    Posts:
    5
    You need to add '' Remote '' to your tags.
     
  21. ik_jolan

    ik_jolan

    Joined:
    Jul 26, 2013
    Posts:
    15
    I use this very useful script to spawn health objects, but i can not manage to destroy the objects on the server when a player takes one...

    Code (csharp):
    1. function OnTriggerEnter (other : Collider) {
    2.     if (other.CompareTag ("Player")){
    3.         other.SendMessageUpwards("Medic", hitPoints, SendMessageOptions.DontRequireReceiver);
    4.         AudioSource.PlayClipAtPoint(sound, transform.position);
    5.         Destroy(gameObject);
    6.     }
    This is what I use to destroy it now, but the object only destroys on the client so every player can take the spawned object.
    How can I manage to destroy it over the server?
     
  22. CrimeR

    CrimeR

    Joined:
    May 10, 2014
    Posts:
    2
    I even change the pictures, any example window background and the same thing happens
     
  23. midorina

    midorina

    Joined:
    Jun 1, 2012
    Posts:
    131
    You are using Destroy(gameObject). You need to use PhotonNetwork.Destroy()
     
  24. ik_jolan

    ik_jolan

    Joined:
    Jul 26, 2013
    Posts:
    15
    But when I do that I get this error: Assets/Resources/NewScripts/Medic.js(9,17): BCE0005: Unknown identifier: 'PhotonNetwork'.
     
  25. Drymarti111

    Drymarti111

    Joined:
    Jun 23, 2013
    Posts:
    201
    Ou Thank You for that, but i have all the time problem with spawn.
    I made other project with only fps kit 2 from asset store and the same, when i want to spawn in map sometimes i cant, or when i want to respawn game has crashed and player have to leave from server.

    In 2.7 version of this pack i havnt got this problem
     
  26. uhygygyy

    uhygygyy

    Joined:
    May 5, 2014
    Posts:
    5

    Thanks all problems solved !
     
  27. Essekey

    Essekey

    Joined:
    Nov 6, 2013
    Posts:
    15
    Do not tell me how to raise impact Object y axis?
     
  28. ThrillKill

    ThrillKill

    Joined:
    Apr 7, 2014
    Posts:
    80
    I know exactly what your talking about but to be honest I haven't paid much attention to it as I've just attributed it to a issue with photonnetwork and realistically its really just for testing as you will want to host your own server. But I suspect its something to do with playerprefs and a photonnetwork conflict. I haven't updated the photon client so I dunno if that would fix it.
     
  29. drakekaz

    drakekaz

    Joined:
    Jan 16, 2014
    Posts:
    43

    Has anyone made a custom version of the WeaponAnimation script yet that allows for idle animations?
     
  30. KingofMk98

    KingofMk98

    Joined:
    Oct 10, 2013
    Posts:
    63
    There is no need as it already does, at least mine works as it should
     
  31. drakekaz

    drakekaz

    Joined:
    Jan 16, 2014
    Posts:
    43
    It's more of an idle pose not an animation. My idle doesn't seem to be animating at least.
     
  32. BHS

    BHS

    Joined:
    Dec 21, 2009
    Posts:
    4,725
    We're working on a matchmaking system with this kit. In order for teams to be evenly distributed we need to get the size of each team. Would anyone know how to do this?

    Getting the number of players in the room doesn't help because teams can be uneven and we need so auto-assign players to the team with the lowest amount of player when needed.

    There's a lack of documentation with this so I'm not really sure what to look for.

    Code (csharp):
    1. foreach (AllTeams team_1 in AllTeams.teamName)
    2.         {
    3.             team1Total += 1;
    4.         }
    5.  
    6.         foreach (AllTeams team_2 in AllTeams.teamName)
    7.         {
    8.             team2Total += 1;
    9.         }
     
    Last edited: May 11, 2014
  33. johnson07

    johnson07

    Joined:
    Oct 10, 2013
    Posts:
    15
    you should only get the list of all players in the room, and then the each team .. so:

    Code (csharp):
    1.  
    2.     int Team1Count = 0;
    3.         foreach (PhotonPlayer player in allPlayers) { //List of all players in the room
    4.             if ((string)player.customProperties ["TeamName"] == team_1.teamName) { //list of player in team 1
    5.                 Team1Count++;
    6.                         }
    7.                 }
    8.  
    then does the same with the other declaration.

    in the folder, "PhotonNetworking" comes a. PDF with some useful information.
     
  34. eliteslayer

    eliteslayer

    Joined:
    May 12, 2013
    Posts:
    64
    Hey NSdesign,

    For a future update would it be possible to add AI to scenes and the ability to add an amount on different teams and how hard they are like in the cods? I've tried that my self but i keep on getting errors with the scripts, plus my AI's aren't good at all and i need an expert for them. Just an idea for a future update, it would make the package a lot better and awesome. Something to consider please respond if you will be able to add this. Thank you.
     
  35. PhobicGunner

    PhobicGunner

    Joined:
    Jun 28, 2011
    Posts:
    1,813
    Sorry to burst your bubble, but you're not going to get anywhere if you can't code on your own.
    If you don't know enough to extend the FPS kit yourself, then maybe you just aren't ready to make an FPS. Start simpler, then work your way up.
     
  36. BHS

    BHS

    Joined:
    Dec 21, 2009
    Posts:
    4,725
    Thanks for the help. I can't seem to get it to work though. I'm not sure if it's properly counting the players. It just says 0 even though there are several players on team 1 in the scene online. The team name is exactly the same so I'm not sure what the problem is.
     
  37. johnson07

    johnson07

    Joined:
    Oct 10, 2013
    Posts:
    15
    @ThrillKill
    You gotten to deploy it (car) for the multiplayer mode.?
     
  38. Essekey

    Essekey

    Joined:
    Nov 6, 2013
    Posts:
    15
    If I shoot something on what the error object, and if the air is okay. Help fix.
    Code (csharp):
    1. NullReferenceException: Object reference not set to an instance of an object
    2. Bullet.Update () (at Assets/CustomAssets/Scripts/WeaponSystem/Bullet.cs:61)
    Bullet.cs
    Code (csharp):
    1. using UnityEngine;
    2. using System.Collections;
    3. using System.Collections.Generic;
    4.  
    5. //[AddComponentMenu ("FPS system/Weapon System/Bullet Controller")]
    6.  
    7. public class Bullet : MonoBehaviour {
    8.     public int speed = 500;
    9.     public float life = 3;
    10.     public float damage = 20;
    11.     public int impactForce = 10;
    12.     public bool impactHoles = true;
    13.    
    14.     public string weaponName = string.Empty;
    15.    
    16.     [HideInInspector]
    17.     public bool doDamage = false;
    18.     public List<GameObject> impactObjects = new List<GameObject>();
    19.    
    20.    
    21.     public Vector3 velocity;
    22.     public Vector3 newPos;
    23.     public Vector3 oldPos;
    24.     bool hasHit = false;
    25.    
    26.     void Start () {
    27.         newPos = transform.position;
    28.         oldPos = newPos;
    29.         velocity = speed * transform.forward;
    30.  
    31.         Destroy( gameObject, life );
    32.     }
    33.    
    34.     void Update () {
    35.         if( hasHit )
    36.             return;
    37.         newPos += velocity * Time.deltaTime;
    38.         Vector3 direction = newPos - oldPos;
    39.         float distance = direction.magnitude;
    40.        
    41.         if (distance > 0) {
    42.             RaycastHit hit;
    43.            
    44.             if (Physics.Raycast(oldPos, direction, out hit, distance)) {
    45.                 newPos = hit.point;
    46.                 hasHit = true;
    47.                 Quaternion rotation = Quaternion.FromToRotation(Vector3.up, hit.normal);
    48.                
    49.                 if (hit.rigidbody){
    50.                     hit.rigidbody.AddForce( transform.forward * impactForce, ForceMode.Impulse );
    51.                 }
    52.                
    53.                 if(impactHoles){
    54.                     for(int i = 0; i<impactObjects.Count; i++){
    55.                         if(hit.transform.tag == impactObjects[i].name){
    56.                             Instantiate(impactObjects[i], hit.point + new Vector3(0, +0.015f, 0), rotation);
    57.                         }
    58.                     }
    59.                 }
    60.                 if(hit.transform.tag != "Player"  doDamage){
    61.                     hit.transform.GetComponent<HitBox>().ApplyDamage(damage, weaponName);
    62.                 }
    63.                
    64.                 Destroy (gameObject, 1);
    65.             }
    66.         }
    67.        
    68.         oldPos = transform.position;
    69.         transform.position = newPos;
    70.     }
    71. }
    HitBox.cs
    Code (csharp):
    1. public float maxDamage;
    2.     public PlayerDamage playerDamage;
    3.     public string message;
    4.  
    5.     public void ApplyDamage(float damage, string weaponName){
    6.         playerDamage.TotalDamage(damage + maxDamage, weaponName, message);
    7.     }
    8.    
    9.     public void ApplyExplosiveDamage(float damage){
    10.         playerDamage.TotalDamage(damage + maxDamage, "", "Explosive");
    11.     }
     
    Last edited: May 12, 2014
  39. Le_Hieu

    Le_Hieu

    Joined:
    Mar 26, 2011
    Posts:
    31
    I have sentry gun and it worked, can rotate toward the player and shot. Is there any way to it can cause damage to both team A and team B? Use bullet?
     
    Last edited: May 12, 2014
  40. ik_jolan

    ik_jolan

    Joined:
    Jul 26, 2013
    Posts:
    15
    When I do this, I get this error:
    Destroy: Could not destroy view ID []. Does not exist, or is not ours!
    PhotonView is attached, everything seems ok
    Could someone help?
     
  41. PhobicGunner

    PhobicGunner

    Joined:
    Jun 28, 2011
    Posts:
    1,813
    Does the object you're trying to destroy belong to the client that is calling destroy?
     
  42. ik_jolan

    ik_jolan

    Joined:
    Jul 26, 2013
    Posts:
    15
    I don't know what you mean,
    I have
    Code (csharp):
    1. PhotonNetwork.Instantiate(HealthBox.name, SpawnPosition, transform.rotation, 0);
    in RoomMultiplayerMenu
    and in a trigger with the player :
    Code (csharp):
    1. PhotonNetwork.Destroy(this.gameobject);
    I get the error when the player makes collision, like it's supposed to
     
  43. PhobicGunner

    PhobicGunner

    Joined:
    Jun 28, 2011
    Posts:
    1,813
    Try this instead.

    Code (csharp):
    1.  
    2. if( PhotonView.Get( this.gameObject ).isMine )
    3. {
    4.     PhotonNetwork.Destroy( this.gameObject );
    5. }
    6.  
     
  44. ebenpower

    ebenpower

    Joined:
    May 12, 2014
    Posts:
    2
    Hello, how can i add my new map to map select menu ?

    EDIT : Forget it i founded after some mins :) :mrgreen:
     
    Last edited: May 12, 2014
  45. ik_jolan

    ik_jolan

    Joined:
    Jul 26, 2013
    Posts:
    15
    Thanks, that'll do
     
  46. ThrillKill

    ThrillKill

    Joined:
    Apr 7, 2014
    Posts:
    80

    Your error at line 61. Why do you have this? Are you aware of what it's doing?

    Code (csharp):
    1.                 if(hit.transform.tag != "Player"  doDamage){
    2.  
    3.                     hit.transform.GetComponent<HitBox>().ApplyDamage(damage, weaponName);
    4.  
    5.                 }
    so if the bullet hits something that's not a player but still do damage to the object. Do you have hitboxes for these non player objects your telling it to do damage to on said hitboxes? Cause it looks like it say's you don't and value is NULL.
     
  47. ThrillKill

    ThrillKill

    Joined:
    Apr 7, 2014
    Posts:
    80
    re vehicle script...

    I haven't gotten back to this yet as I am just finishing off removing all the ongui and using NGUI which eliminates a tonne of code and scripts. Hard to believe there is that much wasted code and draw calls but there is. ongui is brutal. But yes, you gotta put photonview on the car. The animations didn't sync though but they would move. Problem I had (now i know why it wasnt working) I didnt have the proper triggers and colliders which I figured out converting the ladder script into a teleport script. It would spawn a car for each player but they wouldnt be inside of it but they could control it. So while you were running around there was this car driving out there moving just like you were. The funny part was you could run the person over and kill them.
     
  48. ThrillKill

    ThrillKill

    Joined:
    Apr 7, 2014
    Posts:
    80

    Creating AI is really not that difficult. If your not great or whatever theres lots of cheap AI assets that can easily be modified.
    This kit isn't all that difficult to understand if you understand how to read the code. Even a novice who couldn't come up with this framework on their own can read through the code, adding comments debugs etc to what everything is doing and modify and create from there well enough knowing how it all works.

    There is a whole tutorial for BergZerg Arcade which will give you the basics and foundations for coding a basic RPG if you dont really know a lot about unity and c#. You will learn basic scripts like AI. Its an older unity but the basic concepts and foundations are the same. I recommend this for any who want to get started creating something while learning as fast as you can go through the videos.

    Personally I would prefer a more optimized game code as opposed to AI. ie) The whole sendmessage thing is not really the best way to go about things, throw in some static variables and only use getcomponent and no send message LOL but then the code wouldn't be as easy as it is to understand as it is now.

    Like PhobicGunner said you gotta be able to at least understand the code enough to modify it.
     
  49. Le_Hieu

    Le_Hieu

    Joined:
    Mar 26, 2011
    Posts:
    31
    @ThrillKill: Could you help me this problem?
     
  50. Steve-of-Construction

    Steve-of-Construction

    Joined:
    Jan 26, 2013
    Posts:
    67
    Hey guys after weeks I'm still running crazy with the whokilledwho error if players from the same team shoot each other.

    What I could figure out is:

    the players PlayerDamage-script is doing everything fine!

    BUT

    somehow the game doesn't notice who has shot the BULLET and so everyone in game does the PlayerDamage code and the player gets damage though one teammate shot another teammate.
    And so all the players from the other team report (RPC) it was their shot (but it wasn't!).

    What I couldn't figure out is how the Hitbox or the PlayerDamage notices who REALLY has shot the bullet ^^

    Can someone explain how I can check (Debug) who exactly has shot the bullet?