After a successful event send on your server, the callback function callback_ReceivedEvent() is called. So under Scripts/Rocket Networking/Callback Functions , you can edit this to do whatever you want…

Example Implementation of callback

  • In a shooter game, if you hit another player, you want to inform them that their health reduced right?

  • You can send an event with the eventName "damage"

  • And in the message struct you can put some specifics, like how much damage should be dealt

  • The receiver can see the message and use the switch statement to reude their player's health by whatever is asked in the messageStruct, and also get the attacker's name directly.

function callback_ReceivedEvent(eventName, theMessageStruct , senderClientId){
		case "damage":   
		health -= theMessageStruct.damageDealt ;
		show_message("You were attached by "+ theMessageStruct.attackerName)


Last updated