• 🏆 Texturing Contest #33 is OPEN! Contestants must re-texture a SD unit model found in-game (Warcraft 3 Classic), recreating the unit into a peaceful NPC version. 🔗Click here to enter!
  • It's time for the first HD Modeling Contest of 2024. Join the theme discussion for Hive's HD Modeling Contest #6! Click here to post your idea!

Could this desync?

Status
Not open for further replies.
Level 20
Joined
Jul 14, 2011
Messages
3,213
Hi!

In my map all quest are created at the beginning and are enabled for players as they discover them, but I want to display stats of quest if they are enabled at the time for that playe.

Stats enabled so far are: Evasion, Faith Points, and LifeDustCollected Only if the quest is enabled for triggering player)

so I use:

  • Stats command
    • Events
      • Player - Player 1 (Red) types a chat message containing -stats as An exact match
      • Player - Player 2 (Blue) types a chat message containing -stats as An exact match
      • Player - Player 3 (Teal) types a chat message containing -stats as An exact match
      • Player - Player 4 (Purple) types a chat message containing -stats as An exact match
      • Player - Player 5 (Yellow) types a chat message containing -stats as An exact match
    • Conditions
    • Actions
      • Custom script: if GetLocalPlayer() == GetTriggerPlayer() then
      • Custom script: call ClearTextMessages()
      • Custom script: endif
      • Set PNOBU = (Player number of (Triggering player))
      • Set TempUnit = Heroes[PNOBU]
      • Set TempForce = (Player group((Triggering player)))
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Level of Evasion for TempUnit) Greater than 1
        • Then - Actions
          • Game - Display to TempForce the text: (|cfffff700Evasion|r: + (String((((Level of Evasion for TempUnit) x 2) - 2))))
        • Else - Actions
          • Game - Display to TempForce the text: (|cfffff700Evasion|r: + 0)
      • Custom script: if GetLocalPlayer() == GetTriggerPlayer() then
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Quests[3] is enabled) Equal to True
          • (Quests[3] is completed) Equal to False
        • Then - Actions
          • Game - Display to TempForce the text: (|cfffff700Amos Life Essences|r: + (String(LifeDustCount[PNOBU])))
        • Else - Actions
      • Custom script: endif
      • Game - Display to TempForce the text: (|cfffff700Faith Points|r: + (String(FP[(Player number of (Triggering player))])))
      • Custom script: call DestroyForce(udg_TempForce)
This is the part that 'scares me'

  • Custom script: if GetLocalPlayer() == GetTriggerPlayer() then
  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
    • If - Conditions
      • (Quests[3] is enabled) Equal to True
      • (Quests[3] is completed) Equal to False
    • Then - Actions
      • Game - Display to TempForce the text: (|cfffff700Amos Life Essences|r: + (String(LifeDustCount[PNOBU])))
    • Else - Actions
  • Custom script: endif
 
Level 8
Joined
Apr 26, 2011
Messages
403
JASS:
native ClearTextMessages            takes nothing returns nothing


native DisplayTextToPlayer          takes player toPlayer, real x, real y, string message returns nothing

both are safe to use by local player. because I didn't modified any value that share with other player.
 
Level 20
Joined
Jul 14, 2011
Messages
3,213
But checking condition of the 'If then else' if quest is enabled inside the 'If GetLocalPlayer() == GetTriggerPlayer() then' ?
 
Yes, it should be fine unless you happen to create/destroy something within the block or do anything else that would cause a desync.

For displaying messages, it will be fine. HOWEVER, you might want to try setting a variable outside the if-block, just in case:
  • Set TempString = (|cfffff700Amos Life Essences|r + (String(LifeDustCount[PNOBU])))
  • Custom script: if GetLocalPlayer() == GetTriggerPlayer() then
    • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
      • If - Conditions
        • (Quests[3] is enabled) Equal to True
        • (Quests[3] is completed) Equal to False
    • Then - Actions
      • Game - Display to TempForce the text: TempString
    • Else - Actions
  • Custom script: endif
Just in case. Sometimes when you use a new string that has not been entered into the string table yet (i.e. it hasn't been used yet) then sometimes the string table will desync and it might cause problems later on, especially with GUI. So just in case, you'll want to use a temporary string variable and assign it to the string you want to use. :)
 
Status
Not open for further replies.
Top