• 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.

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

Status
Not open for further replies.
Level 4
Joined
Jul 16, 2010
Messages
33
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"
 

Attachments

  • Pantat-CTF 0.14.w3x
    917.9 KB · Views: 44
Level 4
Joined
Jul 16, 2010
Messages
33
  • 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.
 
Level 4
Joined
Jul 16, 2010
Messages
33
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
 
Level 33
Joined
Mar 27, 2008
Messages
8,035
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.
 
Level 4
Joined
Jul 16, 2010
Messages
33
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.

  • 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.
 
Level 7
Joined
Nov 15, 2009
Messages
225
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:

Dr Super Good

Spell Reviewer
Level 64
Joined
Jan 18, 2005
Messages
27,255
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

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).
 
Level 4
Joined
Jul 16, 2010
Messages
33
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).

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
 
Status
Not open for further replies.
Top