• 🏆 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!
  • ✅ Time to vote for the top 3 models! The POLL for Hive's 6th HD Modeling Contest: Mechanical is now open! 📅 Poll close on July 16, 2024! 🔗 Cast your vote now!
  • ✅ The POLL for Hive's Texturing Contest #33 is OPEN! Vote for the TOP 3 SKINS! 🔗Click here to cast your vote!

Trigger Editor,how to do an action to more then a player

Status
Not open for further replies.
Level 16
Joined
May 2, 2011
Messages
1,345
hi guys
What I am trying to do is to run an attached AI to all the players(1 to 12) using trigger editor
I don't want to use the long way which is to put 12 actions each running the AI for A player
I want to use A variable to do this ,but I don't know how to do it
the other thing is that (in future) I want to have multiple AIs ,each for his race and I want to run the AI for orcs if the player is computer and his race is orc,the night elf AI if the player is CPU and his race is Night elf ....etc
your help will appreciated
thank you
 
Level 20
Joined
Jul 6, 2009
Messages
1,885
  • For each (Integer A) from 1 to 12, do (Actions)
    • Loop - Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Race of (Player((Integer A)))) Equal to Human
        • Then - Actions
          • AI - Start melee AI script for (Player((Integer A))): Human.ai
        • Else - Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Race of (Player((Integer A)))) Equal to Orc
        • Then - Actions
          • AI - Start melee AI script for (Player((Integer A))): Orc.ai
        • Else - Actions
      • -------- ...Do this for each race --------
 
Level 16
Joined
May 2, 2011
Messages
1,345
AI - Start melee AI script for (Player((Integer A))): Human.ai
I a got stuck here
how do I write [for (Player((Integer A)))], it only let me choose from preset players or variables or a function
what should I do, custom script or......???
the same thing is for the race condition[(Race of (Player((Integer A)))) Equal to Human]
thank you for the reply
 
Level 20
Joined
Jul 6, 2009
Messages
1,885
What is it that you don't understand?
This is how it works:
  • For each (Integer A) from 1 to 12, do (Actions)
is a loop that is executed 12 times and each time integer A is increased by 1. Now, since all players have their indexes/player numbers (for example, Player red's index in GUI is 1,blue's 2,teal's 3 etc) we check each player during this loop. Each time integer A increases, we check another player since we use integer A to get a player. (by 'check' i mean those If/Then/Else-es are executed)
First time loop is executed, it checks player red since integer A is 1, on second execution,it checks blue and so on 'till brown/player 12.
 
Status
Not open for further replies.
Top