Just owner can change the value of the variables

Options
Hello, i am creating a enemy, a simple cube with a script, and the Script has a void called loseLife();
loseLife(int damage)
{
state.life -= damage;
}
and this void is called when i shot with my gun(Raycast), but in the log show this mensage
Only The Owner can change the life;
How i do it?
I bought Bolt yesterday. Thanks

Comments

  • stanchion
    stanchion mod
    edited March 2017
    Options
    As it says only owner can change properties. If your game is not authoritative you can use events to send damage. https://doc.photonengine.com/en-us/bolt/current/getting-started/bolt-103-events
    https://doc.photonengine.com/en-us/bolt/current/reference/events
  • It looks the right way, but there is a error
    I shot with my gun and i hit the Enemy, the gun call this void
    public void feelHit(int damage)
    {
    var _evnt = EnemyLoseLife.Create(entity);
    _evnt.lifeLosed = damage;
    _evnt.Send();

    }

    and the _evnt.send() call this

    public override void OnEvent(EnemyLoseLife evnt) {
    Debug.Log ("TEST_____________TEST");
    life -= evnt.lifeLosed;

    }
    but the console show this error

    `Enemy_Script.OnEvent(EnemyLoseLife)' is marked as an override but no suitable method found to override

    Can you help me?
  • stanchion
    Options
    Can you upload the full script or send the project to support@boltengine.com ?
  • Thanks, i send for then and they fix it
  • DirtyHippy
    Options
    Read the tutorials. You need to implement certain interfaces or inherit from GlobalEventListener in order to receive events. You can't just implement the receiver methods in any class and have it magically work.