Need Help with Capture the Flag game where Flags are Scene Objects

Options
The flags are scene objects and don't have a set owner. I am solely concerned about getting these functions working correctly at the moment so if anyone has suggestions on the best way to incorporate this I will be more than happy to learn.
The scene has 2 flags, 2 flag spawns, and up to 6 players in it, in addition to the actual map.
The flag object has a PhotonView which is observing its PhotonTransformView and the Pickup script, and a PhotonTransformView(These dont seem to do anything since I am not instantiating them in as owned objects but leaving them as spawned in with the scene). The flag has this(https://hastebin.com/virifiyidu.cpp) script which allows:
RED team to pickup(become parent of) BLUE flag from spawn and visa versa.
RED team to return RED flag to spawn IF it is dropped and off its spawn, and visa versa.
Players to drop the flag(unparent and move) IF they possess it and they press "L", OR if they die.
Score iterates if the RED flag enters the BLUE score zone and visa versa.
All this works on a local game, but doesn't work on a networked game. The issues I am having are as follows, we will assume RED is the host/masterclient:
If BLUE picks up the RED flag, the RED flag is correctly parented and BLUE can see the flag but RED cannot see the RED flag. RED can still take the RED flag to BLUE score zone and score, even though it is not displayed on their screen.
BLUE cannot drop the RED flag, nothing happens when they press L.
If RED presses L while BLUE has the flag, BLUE drops the flag. The flag also appears suddenly on BLUES screen, which I find odd.
If RED picks up the BLUE flag then BLUE cannot see the flag held by RED.

Comments

  • HarbourT
    Options
    I made some updates to the code and how I am going to approach this and it is better but I am definitely missing something. I understand that I should really separate some of the functions from this, such as scoring and plan to do so.

    First of all, I need to clear up the problem. The known issues are:
    1) Master Client(MC) can follow all functionality as normal, Client(C) has issues tracking the state/position of flag
    1.a) If MC is holding flag, and drops it the flag object disappears from C's screen, however C can walk to the flag position represented on MC's screen to interact(send it back to base)
    1.b) if C is holding flag and attempts to drop it, the flag object disappears, on MC's screen the flag is still being held by C, and C can still score it which resets its position
    1.c) flag sometimes displays incorrect text label after some combination of picking up, dropping, and scoring (will display "!!!!" while at home, which should display "[teamColor] Flag")
    2) C can force MC to drop the flag if both are holding a flag and C presses "L" key.

    Secondly. Here(https://hastebin.com/zezikepopi.cpp) is the updated script. I have the flags now being instantiated as scene objects with this(https://hastebin.com/upehigiruq.cpp) script.

    The main issue seems to be in the OnTriggerStay( I'm not even sure this is the best way to do this, I had actually had it set here because before I was not parenting the flag to the flagHolder, I was just having it stay on the same transform,position as the flagHolder as you can see by the commented out code). If I could have the actual flag object show at the correct position on both(all) clients screens while it is being held, has been dropped, or is returned to base that would be beyond helpful.

    Thank you in advance!

  • HarbourT
    Options
    Bump

    @Tobias