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

AI and ally system

Status
Not open for further replies.
Level 7
Joined
Dec 28, 2009
Messages
257
yo again. i would like to ask:

how im supposed to make an AI trought triggers? im just looking for some ideas.
i would like to make AI in sort of survival game, and he should also build buildings and train units. and if its possible- he should create "alliances" with other players.

and second- how can i make a system, that when players 1types: x2x, he becames ally with player 2.

i tried something like: player 1types "2", player 2becames his friend. but that should take around.. 81triggers. thats enormous.
 
Level 9
Joined
Mar 10, 2005
Messages
326
For alliance:
Try downloading Jass New Gen World Editor and implementing this code:
http://www.hiveworkshop.com/forums/spells-569/alliance-system-155912/


Or if you want to gui the hard way...

Ally Blue
AllyBlue
Events
Player - Player 1 (Red) types a chat message containing -ally blue as An exact match
Player - Player 3 (Teal) types a chat message containing -ally blue as An exact match
Player - Player 4 (Purple) types a chat message containing -ally blue as An exact match
Player - Player 6 (Orange) types a chat message containing -ally blue as An exact match
Player - Player 7 (Green) types a chat message containing -ally blue as An exact match
Player - Player 8 (Pink) types a chat message containing -ally blue as An exact match
Player - Player 9 (Gray) types a chat message containing -ally blue as An exact match
Conditions
Actions
Player - Make (Triggering player) treat Player 2 (Blue) as an Ally with shared vision
Game - Display to (All players) the text: (((Name of (Triggering player)) + has allied with ) + (Name of Player 2 (Blue)))
Sound - Play QuestLog <gen>


Unally Blue
Unallyblue
Events
Player - Player 1 (Red) types a chat message containing -unally blue as An exact match
Player - Player 3 (Teal) types a chat message containing -unally blue as An exact match
Player - Player 4 (Purple) types a chat message containing -unally blue as An exact match
Player - Player 6 (Orange) types a chat message containing -unally blue as An exact match
Player - Player 7 (Green) types a chat message containing -unally blue as An exact match
Player - Player 8 (Pink) types a chat message containing -unally blue as An exact match
Player - Player 9 (Gray) types a chat message containing -unally blue as An exact match
Conditions
Actions
Player - Make (Triggering player) treat Player 2 (Blue) as an Enemy
Player - Make Player 2 (Blue) treat (Triggering player) as an Enemy
Sound - Play UpkeepRing <gen>
Game - Display to (All players) the text: (((Name of (Triggering player)) + declared war on ) + (Name of Player 2 (Blue)))

Repeat that for each color. 9 players, 18 triggers
That's what my map (bottom link) is currently using because I wanted to customize some sound effects etc. You can take a look at the Alliance Folder of the trigger editor for further information. You can feel free to copy and paste the 18 triggers if it saves you time.
 
Level 5
Joined
Apr 8, 2008
Messages
88
You can put all ally options in one trigger also, as shown below.
The reason why there are events for 4 players are that it works for well... four players instead of 1. Alot easier then creating 4 triggers for it, (or how many players you want it to work for) :thumbs_up:


  • Ally players
    • Events
      • Player - Player 1 (Red) types a chat message containing -ally as A substring
      • Player - Player 2 (Blue) types a chat message containing -ally as A substring
      • Player - Player 3 (Teal) types a chat message containing -ally as A substring
      • Player - Player 4 (Purple) types a chat message containing -ally as A substring
    • Conditions
    • Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Entered chat string) Equal to (-ally + 2)
        • Then - Actions
          • Player - Make (Triggering player) treat Player 2 (Blue) as an Ally
          • Game - Display to (All players) for 5.00 seconds the text: ((Name of (Triggering player)) + ( allied + (Name of Player 2 (Blue))))
        • Else - Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Entered chat string) Equal to (-ally + 3)
        • Then - Actions
          • Player - Make (Triggering player) treat Player 3 (Teal) as an Ally
          • Game - Display to (All players) for 5.00 seconds the text: ((Name of (Triggering player)) + ( allied + (Name of Player 3 (Teal))))
        • Else - Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Entered chat string) Equal to (-ally + 4)
        • Then - Actions
          • Player - Make (Triggering player) treat Player 4 (Purple) as an Ally
          • Game - Display to (All players) for 5.00 seconds the text: ((Name of (Triggering player)) + ( allied + (Name of Player 4 (Purple))))
        • Else - Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Entered chat string) Equal to (-ally + 1)
        • Then - Actions
          • Player - Make (Triggering player) treat Player 1 (Red) as an Ally
          • Game - Display to (All players) for 5.00 seconds the text: ((Name of (Triggering player)) + ( allied + (Name of Player 1 (Red))))
        • Else - Actions
 
Level 7
Joined
Dec 28, 2009
Messages
257
ah, i just played some map with spell, and it worked like:

unit casts spell
Spell is equal to "Peace"
Make (owner of casting unit) treat (owner of unit ability being cast) as ally.
something like this. it only needs to cast some ability instead of writing.
but thanks, anyway! +rep :D

and now, about AI- any idead?
 
Status
Not open for further replies.
Top