• 🏆 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!

[Solved] Custom Script dont work

Status
Not open for further replies.
Level 5
Joined
Jan 12, 2010
Messages
132
So using this script ,things should happend only for the local player but amazing its happen for all players.
I have another trigger that create a multiboard and this trigger should update that multiboard with different value for different players.I mean players should not see same value in their multiboard.
I also tried to use picked player in a player group and still dont work.
  • xxx
    • Events
      • Time - Every 1.00 seconds of game time
    • Conditions
    • Actions
      • For each (Integer A) from 1 to 12, do (Actions)
        • Loop - Actions
          • Custom script: if ( not ( GetLocalPlayer() == ConvertedPlayer(GetForLoopIndexA()+1) ) ) then
          • Set Unit[1] = (Load 1 of (Key (Player((Integer A)))) in Hashtable)
          • Multiboard - Set the text for M_board item in column 1, row 1 to (Name of Unit[1])
          • Custom script: set udg_Hash_key = GetHandleId(udg_Unit[1])
          • Multiboard - Set the icon for M_board item in column 1, row 1 to (Load 1 of Hash_key from Hashtable)
          • -------- Life --------
          • Set Real[1] = (Percentage life of Unit[1])
          • Set Real[2] = ((Real[1] x 8.00) / 100.00)
          • Game - Display to (All players) the text: (String(Real[2]))
          • For each (Integer B) from 1 to 8, do (Actions)
            • Loop - Actions
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • (Real[2] + 0.50) Greater than or equal to (Real((Integer B)))
                • Then - Actions
                  • Multiboard - Set the icon for M_board item in column (Integer B), row 2 to HP_barr[3]
                • Else - Actions
                  • Multiboard - Set the icon for M_board item in column (Integer B), row 2 to HP_barr[5]
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • (Real[2] + 0.00) Greater than or equal to (Real((Integer B)))
                • Then - Actions
                  • Multiboard - Set the icon for M_board item in column (Integer B), row 2 to HP_barr[1]
                • Else - Actions
          • Custom script: endif
 
JASS:
 if ( not ( GetLocalPlayer() == ConvertedPlayer(GetForLoopIndexA()+1) ) )

This is saying that "if the player running this trigger is not Player(Integer A + 1 - 1) then perform the actions"

First of all, remove the not because you want to only run the actions for that player and ignore the others.

Second, the index is wrong. ConvertedPlayer() already returns the player index - 1, so you can just replace that with Player(GetForLoopIndexA() - 1). So change the line to become:
JASS:
if GetLocalPlayer() == Player(GetForLoopIndexA() - 1) then

And it should work.
 
Status
Not open for further replies.
Top