RPC dont get to right destination...

Hi,

I got Player A and B.

When players attack they fire a function.
In this fonction there is that :

[code2=csharp]enemyTarget = hit.transform.gameObject;
photonView.RPC("LifebarUpdater", enemyTarget.GetComponent<PhotonView>().owner, -damageMade);[/code2]

On an other script:

[code2=csharp][RPC]
void LifebarUpdater( int changingAmount){

test = "touched!";
lifePercent = (changingAmount*100)/maxLife;
lifeBarXSize = lifeBarMaxXSize*(lifePercent/100);
}[/code2]

Problem:

When A attacks B on owned connection nothing happens.
But on remote connection, A seems to be touched, looks like A is sending to A the RPC instead of A to B.

Any help please ?

Paradoks

Comments

  • I am looking around on the Angrybot example and wonder why is the script asking for masterClient to update the HP:
    Health.JS - line 97

    [code2=as3]if(PhotonNetwork.isMasterClient){
    // Die if no health left
    if (health <= 0) {
    if(view.isSceneView){
    view.RPC("Die", PhotonTargets.AllBuffered);
    }else{
    view.RPC("Die", PhotonTargets.All);
    }
    }

    var diff : float = lastSharedHP - health;
    if(Mathf.Abs(diff)>5){
    view.RPC("SetHP", PhotonTargets.Others, health);
    }
    }[/code2]

    EDIT:
    and how is the information spread, as it looks like the "AutoFire.js" only changes the health on one Player, if this player is not masterClient, how is the changing health information sent ?