• Listen to a special audio message from Bill Roper to the Hive Workshop community (Bill is a former Vice President of Blizzard Entertainment, Producer, Designer, Musician, Voice Actor) 🔗Click here to hear his message!
  • Read Evilhog's interview with Gregory Alper, the original composer of the music for WarCraft: Orcs & Humans 🔗Click here to read the full interview.

[General] Make effects and units only visible for one player?

Status
Not open for further replies.
Level 30
Joined
Jul 23, 2009
Messages
1,033
I'm getting a little hang of it but the only problem occurs when I try to remove an effect for one player only. This is my attempt at making an effect for each player and then removing it for the player that takes a quest. Causes desync..

Spawning the effect
  • Quest Marks
    • Events
      • Time - Elapsed game time is 0.00 seconds
    • Conditions
    • Actions
      • Set Quest_TalkToMe_Mark = Empty String
      • Player Group - Pick every player in (All players) and do (Actions)
        • Loop - Actions
          • Custom script: set udg_SYS_GetLocalPlayer = GetLocalPlayer()
            • Multiple FunctionsIf (All Conditions are True) then do (Then Actions) else do (Else Actions)
              • If - Conditions
                • SYS_GetLocalPlayer Equal to (==) (Picked player)
              • Then - Actions
                • Set Quest_TalkToMe_Mark = Abilities\Spells\Other\TalkToMe\TalkToMe.mdl
              • Else - Actions
      • Special Effect - Create a special effect attached to the overhead of Captain Ace NPC 0001 <gen> using Quest_TalkToMe_Mark
      • Set Quest_AceMark = (Last created special effect)
      • Special Effect - Create a special effect attached to the overhead of Burlo (NPC) 0013 <gen> using Abilities\Spells\Other\TalkToMe\TalkToMe.mdl
      • Set Quest_BurloMark = (Last created special effect)
Removing the effect
  • Summoned Accept
    • Events
      • Unit - A unit Sells a unit
    • Conditions
      • (Unit-type of (Sold unit)) Equal to (==) Captain Ace Quest
    • Actions
      • Custom script: set udg_SYS_GetLocalPlayer = GetLocalPlayer()
      • Unit - Remove (Sold unit) from the game
        • Multiple FunctionsIf (All Conditions are True) then do (Then Actions) else do (Else Actions)
          • If - Conditions
            • Quest_Summoned_Taken[(Player number of (Owner of (Buying unit)))] Equal to (==) False
          • Then - Actions
            • Multiple FunctionsIf (All Conditions are True) then do (Then Actions) else do (Else Actions)
              • If - Conditions
                • SYS_GetLocalPlayer Equal to (==) (Owner of (Buying unit))
              • Then - Actions
                • Quest - Enable Quest_Summoned
                • Sound - Play QuestNew <gen>
                • Set SYS_TempEffect = Quest_AceMark
              • Else - Actions
            • Special Effect - Destroy SYS_TempEffect
            • Set Quest_Summoned_Taken[(Player number of (Owner of (Buying unit)))] = True
          • Else - Actions
            • Player Group - Add (Owner of (Buying unit)) to Gen_TempPlayerForce
            • Game - Display to Gen_TempPlayerForce the text: You have already ac...
            • Player Group - Remove (Owner of (Buying unit)) from Gen_TempPlayerForce
 
The issue lies here:
  • Set SYS_TempEffect = Quest_AceMark
You set that locally for the owner of the buying unit. Thus, it points to that effect for that player, but for everyone else it points to null. It destroys the effect locally, and then it splits.

Instead, you should switch to an array, here:
  • Quest Marks
  • Events
    • Time - Elapsed game time is 0.00 seconds
  • Conditions
  • Actions
    • Set Quest_TalkToMe_Mark = Empty String
    • Player Group - Pick every player in (All players) and do (Actions)
      • Loop - Actions
        • Custom script: set udg_SYS_GetLocalPlayer = GetLocalPlayer()
        • Multiple FunctionsIf (All Conditions are True) then do (Then Actions) else do (Else Actions)
          • If - Conditions
            • SYS_GetLocalPlayer Equal to (==) (Picked player)
          • Then - Actions
            • Set Quest_TalkToMe_Mark = Abilities\Spells\Other\TalkToMe\TalkToMe.mdl
          • Else - Actions
        • Special Effect - Create a special effect attached to the overhead of Captain Ace NPC 0001 <gen> using Quest_TalkToMe_Mark
        • Set Quest_AceMark[Player Id of (Picked Player)] = (Last created special effect)
        • Special Effect - Create a special effect attached to the overhead of Burlo (NPC) 0013 <gen> using Abilities\Spells\Other\TalkToMe\TalkToMe.mdl
        • Set Quest_BurloMark[Player Id of (Picked Player)] = (Last created special effect)
Then later on, when you destroy the effect, just directly destroy Quest_AceMark[Player Id of (Owner of (Buying unit))]. Why? When you destroy it, you either destroy it for everyone or you destroy it for no one. Destroying it for one player will desync. That causes a dilemma, because you want to only destroy it for one player. Thus, you need to make 11 different effects -- 1 for each player. Only 1 will be visible to each player. That way, when you destroy that effect, you are destroying it for everyone--but it won't affect the other players. ;) They will still see that "1" effect that it assigned to them.

It is a bit confusing to understand. If you need a better explanation, let me know.
 
Status
Not open for further replies.
Top