I’m working on an ability to deal damage over time. That was easy enough, i just invoke several more damage instances when the initial damage is applied. But i want this ability to be a projectile that causes damage and damage over time on impact. So i need to send an rpc to instantiate the projectile on all clients. But to call this rpc from the ability script, do all clients need to have the ability script applied to the gameObject? Because right now the ability script is only visibly on the client of the player who is using the ability. You start the game with no abilities and clicking a little UI button will add the script to your gameObject. When calling an RPC to everyone on the network, what is it that they’re replicating? They’re all replicating the function called right? Which would mean that the function needs to be visible to all clients. Which means i need to add the component in an rpc so every client knows that the gameObject has the new ability script. Is this correct?
Furthermore, gameobjects and transforms can’t be serialised. So how would i set the destination of the projectile on all clients? The destination is the clicked gameobject’s position regardless of where they move while the projectile is flying. The projectile tracks them by moving towards their position.
Maybe if all of the clients get a projectile instantiated, and that projectile is set to follow the (local/target in their game + do its effects)…As for how to set the destination: I’m not super familiar with the built-in networking stuff, but generally speaking, the gameobject would be identifiable in some manner, by id or in a list or something (something that is the same for everyone), so you’d send that, I’d imagine.
“follow” = “set the destination”. I wrote the code for the projectile telling it to move a certain distance towards the target per frame. That’s how it follows the target. I believe i can use PhotonView.Find (the gameobject’s photon id).gameObject.transform.position. Thank you, that’ll work since all my potential targets in the game have a PhotonView component.
Cool ![]()