Basic replication issue i cant understand.

Im struggling with some basic replication, I feel like this should be obvious but I’m missing something (or maybe something else is wrong)

I have a flashlight item that players can toggle on or off,

image
This is the event I have for using the item (the flashlights bp is a parent of this bp)
Its on multicast currently but does not replicate to anyone else when called form client (which makes sense) but if I do an event run on server and then make that run a multicast event it only runs on server and the client cant call event.
Example below:

image

Put a bool in your flashlight. Set it to on rep notify.
In the on rep notify turn the light on or off depending on the bool value.

Add a command to toggle light on the server

Server then tells the clients the state of the bool and replicates it to them triggering the accompanying function

1 Like

also make sure you have ownership of the flashlight or call the RPC from your character

1 Like

Im not interested in using rep notify and variables because of the way i want my system set up, future items won’t be able to run with rep notifs. (such as firing guns) I tried it anyways, and it’s still not working properly, so i think there is an underlying issue.

i dont know your game but you really do need RepNotify for this, multicast can fail, simplest example is if its not relevant to a player at that time

If you use just replicated variables you will get desynchronized states with late joining players and when relevance changes.

It will become a desync mess

Alright, Ill try again with rep notify, but how am I supposed to do other items in the future that wouldn’t quite work with that? For example, firing a gun would have to run off an event it wouldn’t make sense for a variable to carry that logic.

Firing guns would most likely be done with event calls to the server => spawn bullet on server / do line trace => multicast effects (play sound show muzzle flash).
Damage would also have to be registered on the server.

If you are using a weapon with rapid fire it would probably be better to replicate the state of the gun

  • if firing
  • is stopped firing
    (so basically a single bool)

Otherwise you will saturate your network rather fast