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
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
0
Comments
-
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/events0 -
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?0 -
Can you upload the full script or send the project to support@boltengine.com ?0
-
Thanks, i send for then and they fix it
0 -
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.
0