photonview with id has no method int32
Options
heres my code for damage CharacterStats script, the error n the title does not shows up all the time, just sometimes and i can not figure out why this is happening
and this one is the one triggers this rpc above
[PunRPC] protected void TakeDamage(float damage, DamageType damageType) //rakip ismi buraya { if (damageType == DamageType.Physical) { float takenDamage = (damage / 1 - PhysicalDefence) * 0.1618f; damageInfoDamageTemp = damage; Health -= takenDamage; Debug.Log("alınan damage " + takenDamage); // rakibin gördüğü damage _hpBar.value -= takenDamage; _hpValueText = $"{Health:00}"; _hpCurrentText.text = _hpValueText; SkillInfoMessage(takenDamage, " Hasar alındı", Color.red); // Info paneli burda işle string takenTemp= $"{takenDamage:00}"; photonView.RPC("HpBarCtrl", RpcTarget.Others, new object[] { MaxHealth, Health}); if (Health <= 0) { animator.SetBool("death", true); gameObject.GetComponent<CharacterMovement>().CanMove = false; GameManager.GetComponent<GameManager>().Loser(); EnemyDead = true; } } if (damageType == DamageType.Magical) { Health -= (damage / 1 - MagicalDefence) * 0.1618f; Debug.Log("Magical " + Health); } }
and this one is the one triggers this rpc above
int i = Random.Range(0, percentage.Count - 1); if (percentage[i] == 0) { Enemy.GetComponent<PhotonView>().RPC("TakeDamage", RpcTarget.Others, new object[] { SentDamage * 1.5f, CharacterStats.DamageType.Physical}); // SkillInfoMessageForEnemyLocal((SentDamage / 1 - Enemy.GetComponent<CharacterStats>().PhysicalDefence) * 0.1618f, " Hasar verildi",Color.white); Debug.Log("Critical); } if (percentage[i] == 1) { Enemy.GetComponent<PhotonView>().RPC("TakeDamage", RpcTarget.Others, new object[] { SentDamage, CharacterStats.DamageType.Physical }); //SkillInfoMessageForEnemyLocal((SentDamage / 1 - Enemy.GetComponent<CharacterStats>().PhysicalDefence) * 0.1618f, " Hasar verildi", Color.white); Debug.Log("Normal"); }
0
Comments
-
You should cast CharacterStats.DamageType.Physical to byte before you send it. Then, TakeDamage() uses byte as type of the second parameter and you cast it back to CharacterStats.DamageType.
0 -
Ok that sounds good, but I still can not understand why this is happenening from only one object to others, other characters have differend skills which are using the exact same method by only chancing first parameter damage, only this one gives error, I will still follow your advice but just trying to understand fully0
-
You should cast CharacterStats.DamageType.Physical to byte before you send it. Then, TakeDamage() uses byte as type of the second parameter and you cast it back to CharacterStats.DamageType.
PhotonView with ID 1001 has no (non-static) method "TakeDamage" that takes 2 argument(s): Double, Byte
now im getting this error , stilll0