Hello all, sorry if this is a dumb question but I'm new to multiplayer games in general so I just wanted to ask. I'm trying to have projectiles spawned in by one player damage another player using a fixed damage value determined by a variable contained in the script of the projectile. Here is the code for the player taking damage:
`@rpc("any_peer")
func take_damage(bullet_damage):
health -= bullet_damage
if health <= 0:
health = health_max
position = Vector3.ZERO
died.emit(name)
health_changed.emit(health)
`
And here is where the projectile will call this function when it hits a player:
`func _on_body_entered(body):
if body is CharacterBody3D:
body.take_damage.rpc_id(body.get_multiplayer_authority())
queue_free()`
My though is to just put the variable that contains the number for damage right after the first parameter, like so:
body.take_damage.rpc_id(body.get_multiplayer_authority(), damage)
I'm not sure if this would work though. Any suggestions or answers are appreciated, thank you very much. If I need to provide anything to clarify, just let me know!