1. Updated Resource Submission Rules: All model & skin resource submissions must now include an in-game screenshot. This is to help speed up the moderation process and to show how the model and/or texture looks like from the in-game camera.
    Dismiss Notice
  2. DID YOU KNOW - That you can unlock new rank icons by posting on the forums or winning contests? Click here to customize your rank or read our User Rank Policy to see a list of ranks that you can unlock. Have you won a contest and still haven't received your rank award? Then please contact the administration.
    Dismiss Notice
  3. The reforging of the races is complete. Come see the 14th Techtree Contest Results.
    Dismiss Notice
  4. It's time to choose your horse in the race - the 32nd Modeling Contest Poll is up!
    Dismiss Notice
  5. Check out the Staff job openings thread.
    Dismiss Notice
Dismiss Notice
60,000 passwords have been reset on July 8, 2019. If you cannot login, read this.

[Solved] Make Player treat anothe player as bla bla Problem

Discussion in 'Triggers & Scripts' started by PantatKematian, Feb 19, 2013.

  1. PantatKematian

    PantatKematian

    Joined:
    Jul 16, 2010
    Messages:
    34
    Resources:
    2
    Maps:
    2
    Resources:
    2
    sooo... something bad happen to may map P-CTF lately, this never happened before but today when i tested the map suddenly Trigger that makes players treat another player as ally doesn't work, and because of that the fountain violently killed all the heroes that came to the base (this is very fatal you know)

    Can somebody please go check my map and maybe give sma advice.

    Thank you very much sorry for the bad English.

    Triggers are on the "Map Initialization" and "Player Setup Copy"
     

    Attached Files:

  2. DESTROYER123

    DESTROYER123

    Joined:
    Jul 12, 2011
    Messages:
    1,200
    Resources:
    0
    Resources:
    0
    Player 1 treats for examle player 2 as an ally.
    But does player 2 treat player 1 as an ally?
    You should make players treat EACH one as an ally like 1 with 2 and also 2 with 1.
    Happened to me once.
    However I didn't check your map.
     
  3. PantatKematian

    PantatKematian

    Joined:
    Jul 16, 2010
    Messages:
    34
    Resources:
    2
    Maps:
    2
    Resources:
    2
    • Setup Players Copy
      • Events
      • Conditions
      • Actions
        • Set NeutralType[1] = Murloc Tiderunner
        • Set NeutralType[3] = Murloc Nightcrawler
        • Set NeutralType[2] = Murloc Huntsman
        • Set NeutralType[4] = Satyr Trickster
        • Set NeutralType[5] = Satyr Shadowdancer
        • Set NeutralType[6] = Satyr Soulstealer
        • Set NeutralType[7] = Satyr Hellcaller
        • Player - Turn Gives bounty On for Neutral Passive
        • Player - Turn Gives bounty On for Player 1 (Red)
        • Player - Turn Gives bounty On for Player 2 (Blue)
        • Player - Turn Gives bounty On for Player 3 (Teal)
        • Player - Turn Gives bounty On for Player 4 (Purple)
        • Player - Turn Gives bounty On for Player 5 (Yellow)
        • Player - Turn Gives bounty On for Player 6 (Orange)
        • Player - Turn Gives bounty On for Player 7 (Green)
        • Player - Turn Gives bounty On for Player 8 (Pink)
        • Player - Turn Gives bounty On for Player 9 (Gray)
        • Player - Turn Gives bounty On for Player 10 (Light Blue)
        • Player - Turn Gives bounty On for Neutral Hostile
        • Player - Add (3800 / (Number of players in Taman_Player)) to Player 1 (Red) Current gold
        • Player - Add (3800 / (Number of players in Taman_Player)) to Player 2 (Blue) Current gold
        • Player - Add (3800 / (Number of players in Taman_Player)) to Player 3 (Teal) Current gold
        • Player - Add (3800 / (Number of players in Taman_Player)) to Player 4 (Purple) Current gold
        • Player - Add (3800 / (Number of players in Taman_Player)) to Player 5 (Yellow) Current gold
        • Player - Add (3800 / (Number of players in Kodok_Player)) to Player 6 (Orange) Current gold
        • Player - Add (3800 / (Number of players in Kodok_Player)) to Player 7 (Green) Current gold
        • Player - Add (3800 / (Number of players in Kodok_Player)) to Player 8 (Pink) Current gold
        • Player - Add (3800 / (Number of players in Kodok_Player)) to Player 9 (Gray) Current gold
        • Player - Add (3800 / (Number of players in Kodok_Player)) to Player 10 (Light Blue) Current gold
        • Player Group - Pick every player in Taman_Player and do (Actions)
          • Loop - Actions
            • Player - Make (Picked player) treat Player 11 (Dark Green) as an Ally with shared vision
            • Player - Make Player 11 (Dark Green) treat (Picked player) as an Ally with shared vision
        • Player Group - Pick every player in Kodok_Player and do (Actions)
          • Loop - Actions
            • Player - Make (Picked player) treat Player 12 (Brown) as an Ally with shared vision
            • Player - Make Player 12 (Brown) treat (Picked player) as an Ally with shared vision


    yap i've done that but still doesn't work.
     
  4. PantatKematian

    PantatKematian

    Joined:
    Jul 16, 2010
    Messages:
    34
    Resources:
    2
    Maps:
    2
    Resources:
    2
    and even i did this, it still doesn't work.

    • Setup Players Copy
      • Events
      • Conditions
      • Actions
        • Player - Make Player 1 (Red) treat Player 11 (Dark Green) as an Ally with shared vision
        • Player - Make Player 2 (Blue) treat Player 11 (Dark Green) as an Ally with shared vision
        • Player - Make Player 3 (Teal) treat Player 11 (Dark Green) as an Ally with shared vision
        • Player - Make Player 4 (Purple) treat Player 11 (Dark Green) as an Ally with shared vision
        • Player - Make Player 5 (Yellow) treat Player 11 (Dark Green) as an Ally with shared vision
        • Player - Make Player 11 (Dark Green) treat Player 1 (Red) as an Ally with shared vision
        • Player - Make Player 11 (Dark Green) treat Player 2 (Blue) as an Ally with shared vision
        • Player - Make Player 11 (Dark Green) treat Player 3 (Teal) as an Ally with shared vision
        • Player - Make Player 11 (Dark Green) treat Player 4 (Purple) as an Ally with shared vision
        • Player - Make Player 11 (Dark Green) treat Player 5 (Yellow) as an Ally with shared vision
        • Player - Make Player 6 (Orange) treat Player 12 (Brown) as an Ally with shared vision
        • Player - Make Player 7 (Green) treat Player 12 (Brown) as an Ally with shared vision
        • Player - Make Player 8 (Pink) treat Player 12 (Brown) as an Ally with shared vision
        • Player - Make Player 9 (Gray) treat Player 12 (Brown) as an Ally with shared vision
        • Player - Make Player 10 (Light Blue) treat Player 12 (Brown) as an Ally with shared vision
        • Player - Make Player 12 (Brown) treat Player 6 (Orange) as an Ally with shared vision
        • Player - Make Player 12 (Brown) treat Player 7 (Green) as an Ally with shared vision
        • Player - Make Player 12 (Brown) treat Player 8 (Pink) as an Ally with shared vision
        • Player - Make Player 12 (Brown) treat Player 9 (Gray) as an Ally with shared vision
        • Player - Make Player 12 (Brown) treat Player 10 (Light Blue) as an Ally with shared vision
     
  5. defskull

    defskull

    Joined:
    Mar 27, 2008
    Messages:
    7,979
    Resources:
    17
    Spells:
    17
    Resources:
    17
    It must uses nested loop algorithm (loop inside a loop - loopception).

    Trigger below is just an example (it will make all Players will be allies to each other);
    • For each (Integer Loop1) from 1 to 12, do (Actions)
      • Loop - Actions
        • For each (Integer Loop2) from 1 to 12, do (Actions)
          • Loop - Actions
            • Player - Make (Player(Loop1)) treat (Player(Loop2)) as an Ally with shared vision


    Although you can use the classic method (without loop), but I'm guessing you will hurt your eyes with tons of lines for a simple task that can be carried out by nested loop method.
     
  6. PantatKematian

    PantatKematian

    Joined:
    Jul 16, 2010
    Messages:
    34
    Resources:
    2
    Maps:
    2
    Resources:
    2
    • Setup Players Copy
      • Events
      • Conditions
      • Actions
        • For each (Integer A) from 1 to 5, do (Actions)
          • Loop - Actions
            • For each (Integer B) from 1 to 5, do (Actions)
              • Loop - Actions
                • Player - Make PlayerArray[(Integer A)] treat PlayerArray[(Integer B)] as an Ally with shared vision
                • Player - Make PlayerArray[(Integer B)] treat PlayerArray[(Integer A)] as an Ally with shared vision
                • Player - Make PlayerArray[(Integer A)] treat PlayerArray[11] as an Ally with shared vision
                • Player - Make PlayerArray[(Integer B)] treat PlayerArray[11] as an Ally with shared vision
                • Player - Make PlayerArray[11] treat PlayerArray[(Integer B)] as an Ally with shared vision
                • Player - Make PlayerArray[11] treat PlayerArray[(Integer A)] as an Ally with shared vision
        • For each (Integer A) from 6 to 10, do (Actions)
          • Loop - Actions
            • For each (Integer B) from 6 to 10, do (Actions)
              • Loop - Actions
                • Player - Make PlayerArray[(Integer A)] treat PlayerArray[(Integer B)] as an Ally with shared vision
                • Player - Make PlayerArray[(Integer B)] treat PlayerArray[(Integer A)] as an Ally with shared vision
                • Player - Make PlayerArray[(Integer A)] treat PlayerArray[12] as an Ally with shared vision
                • Player - Make PlayerArray[(Integer B)] treat PlayerArray[12] as an Ally with shared vision
                • Player - Make PlayerArray[12] treat PlayerArray[(Integer A)] as an Ally with shared vision
                • Player - Make PlayerArray[12] treat PlayerArray[(Integer B)] as an Ally with shared vision


    i've done this aaaaaand...... still doesn't work. the fountain still attacking every hero that comes to it. thanks for trying to help.
     
  7. PantatKematian

    PantatKematian

    Joined:
    Jul 16, 2010
    Messages:
    34
    Resources:
    2
    Maps:
    2
    Resources:
    2
    anyway this problem just occurred in single player game, when there are more than 1 player everything work fine.
     
  8. SeriousEnemy

    SeriousEnemy

    Joined:
    Nov 15, 2009
    Messages:
    219
    Resources:
    2
    Maps:
    1
    Template:
    1
    Resources:
    2
    Try this:

    • Setup Players Copy
      • Events
      • Conditions
      • Actions
        • For each (Integer A) from 1 to 5, do (Actions)
          • Loop - Actions
            • Player - Make PlayerArray[(Integer A)] treat PlayerArray[11] as an Ally with shared vision
            • Player - Make PlayerArray[11] treat PlayerArray[(Integer A)] as an Ally with shared vision
            • For each (Integer B) from 1 to 5, do (Actions)
              • Loop - Actions
                • Player - Make PlayerArray[(Integer A)] treat PlayerArray[(Integer B)] as an Ally with shared vision
        • For each (Integer A) from 6 to 10, do (Actions)
          • Loop - Actions
            • Player - Make PlayerArray[(Integer A)] treat PlayerArray[12] as an Ally with shared vision
            • Player - Make PlayerArray[12] treat PlayerArray[(Integer A)] as an Ally with shared vision
            • For each (Integer B) from 6 to 10, do (Actions)
              • Loop - Actions
                • Player - Make PlayerArray[(Integer A)] treat PlayerArray[(Integer B)] as an Ally with shared vision

    Edit: Checked your map (first post) and noticed that you've added player 1 to Taman_Player (map init).
    When running the settings you pick that group and make all players (in this case player 1) as a ally of player 11.

    Don't forget to add all players, or use my loop.
     
    Last edited: Feb 21, 2013
  9. Dr Super Good

    Dr Super Good

    Spell Reviewer

    Joined:
    Jan 18, 2005
    Messages:
    25,943
    Resources:
    3
    Maps:
    1
    Spells:
    2
    Resources:
    3
    Division by 0 thread crash. Number of players in Kodok_Player returns 0 and as such you evaluate (3800 / 0). JASS interpreter handles this error by crashing the script thread (so no further script is evaluated past where the division by 0 occured). As this happens before you set alliences it results in everyone not having their alliesnces set as that script does not get executed. In your multiplayer test (where I assume you had code to populate Kodok_Player) it performs a valid division (with a number >0) and so does get around to changing the alliences correctly. The same bug will also occur in multiplayer if 1 team has no players.

    The solution is to catch if a team has no players (both teams need this test as either could be empty) and not perform the gold set actions if that is the case. Put in other words, only perform the gold set actions if the team has more than 1 player. This will stop the division by 0 and so allow the thread to run to completion (and the alliences be properly set).
     
  10. PantatKematian

    PantatKematian

    Joined:
    Jul 16, 2010
    Messages:
    34
    Resources:
    2
    Maps:
    2
    Resources:
    2
    i changed the trigger with this and every thing works fine

    • Setup Players Copy
      • Events
      • Conditions
      • Actions
        • Set NeutralType[1] = Murloc Tiderunner
        • Set NeutralType[3] = Murloc Nightcrawler
        • Set NeutralType[2] = Murloc Huntsman
        • Set NeutralType[4] = Satyr Trickster
        • Set NeutralType[5] = Satyr Shadowdancer
        • Set NeutralType[6] = Satyr Soulstealer
        • Set NeutralType[7] = Satyr Hellcaller
        • Player - Turn Gives bounty On for Neutral Passive
        • Player - Turn Gives bounty On for Player 1 (Red)
        • Player - Turn Gives bounty On for Player 2 (Blue)
        • Player - Turn Gives bounty On for Player 3 (Teal)
        • Player - Turn Gives bounty On for Player 4 (Purple)
        • Player - Turn Gives bounty On for Player 5 (Yellow)
        • Player - Turn Gives bounty On for Player 6 (Orange)
        • Player - Turn Gives bounty On for Player 7 (Green)
        • Player - Turn Gives bounty On for Player 8 (Pink)
        • Player - Turn Gives bounty On for Player 9 (Gray)
        • Player - Turn Gives bounty On for Player 10 (Light Blue)
        • Player - Turn Gives bounty On for Neutral Hostile
        • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
          • If - Conditions
            • (Number of players in Taman_Player) Greater than 0
          • Then - Actions
            • Player Group - Pick every player in Taman_Player and do (Actions)
              • Loop - Actions
                • Player - Add (3800 / (Number of players in Taman_Player)) to (Picked player) Current gold
          • Else - Actions
        • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
          • If - Conditions
            • (Number of players in Kodok_Player) Greater than 0
          • Then - Actions
            • Player Group - Pick every player in Kodok_Player and do (Actions)
              • Loop - Actions
                • Player - Add (3800 / (Number of players in Kodok_Player)) to (Picked player) Current gold
          • Else - Actions
        • For each (Integer A) from 1 to 5, do (Actions)
          • Loop - Actions
            • For each (Integer B) from 1 to 5, do (Actions)
              • Loop - Actions
                • Player - Make PlayerArray[(Integer A)] treat PlayerArray[(Integer B)] as an Ally with shared vision
                • Player - Make PlayerArray[(Integer B)] treat PlayerArray[(Integer A)] as an Ally with shared vision
                • Player - Make PlayerArray[(Integer A)] treat PlayerArray[11] as an Ally with shared vision
                • Player - Make PlayerArray[(Integer B)] treat PlayerArray[11] as an Ally with shared vision
                • Player - Make PlayerArray[11] treat PlayerArray[(Integer B)] as an Ally with shared vision
                • Player - Make PlayerArray[11] treat PlayerArray[(Integer A)] as an Ally with shared vision
        • For each (Integer A) from 6 to 10, do (Actions)
          • Loop - Actions
            • For each (Integer B) from 6 to 10, do (Actions)
              • Loop - Actions
                • Player - Make PlayerArray[(Integer A)] treat PlayerArray[(Integer B)] as an Ally with shared vision
                • Player - Make PlayerArray[(Integer B)] treat PlayerArray[(Integer A)] as an Ally with shared vision
                • Player - Make PlayerArray[(Integer A)] treat PlayerArray[12] as an Ally with shared vision
                • Player - Make PlayerArray[(Integer B)] treat PlayerArray[12] as an Ally with shared vision
                • Player - Make PlayerArray[12] treat PlayerArray[(Integer A)] as an Ally with shared vision
                • Player - Make PlayerArray[12] treat PlayerArray[(Integer B)] as an Ally with shared vision


    thanks sir ! you're genius ! +rep