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

[Trigger] Chat trigger functions

Status
Not open for further replies.
Level 9
Joined
Jun 7, 2008
Messages
440
Im looking for the swap function for my map. Im kinds stuck on the entire thing. Perhaps theres a tutorial on how to do this and similar features?
  • Events
  • Player - Player X (color) types -swap as an exact match
or

  • Events
  • Player - Player X (color) types -displaygametime
  • [/trigger ]
  • Ect.
  • If not i kinda know how to display the gametime one. But other than that... im kinda clueless :(
 
Level 9
Joined
Jun 7, 2008
Messages
440
  • -swap
Is meant to switch heros with other players. There are 2 teams of 5. For example, if i had Illidan and i wanted Tyrande (tyrande was owned by my teammate (say player 3 Teal)) what trigger(s) would i need to complete this hero switch?
 

Dr Super Good

Spell Reviewer
Level 64
Joined
Jan 18, 2005
Messages
27,258
1 trigger which fires on chat messages for all players and a system which keeps track of who says the commands and who owns the heroes. For easier coding you could go with 2 triggers, 1 per team.

As long as you go about the code in a structured way, it should be easy.

1. valadate the command (check syntax)
2. check if anyone else is swapping and if so skip to 5 else continue.
3. set it so that the player is willing to swap (keep track of it in variable)
4. skip remaining actions.
5. swap heroes with other player who is swapping.
6. Clear it so that no one is currently swapping.
 
Level 9
Joined
Jun 7, 2008
Messages
440
OK. So how would i make it so i could select another Player then?
I kinda understand what you said...
  • Events
  • Player - Player X (color) types -swap as an exact match
  • Conditions
  • Swap = 0
  • Actions
  • -----I would also need dialogue buttons im guessing----
  • Set swap = Swap + 1
  • Game - Display to triggering player Dialogue[5]
Then i would have to make 4 dialogue buttons for the player who typed "-swap". I would also have to make 2 dialogue buttons for the person who is being targeted [yes]/[no]. As well as setting "set swap = 0"..Am i seeing what your saying?? Or am i completely offbase?

On another note... How would i check to see if the selected player would have a hero?
 
Level 8
Joined
Mar 12, 2008
Messages
437
Either, you can use "...types -swap as a substring", and instead of showing dialogue buttons, you can check if the player typed "-switch 6" or "-switch 2" etc.

For the hero thing, do an integer comparison:

  • (Number of units in (Units owned by Player 1 (Red) matching (((Matching unit) is A Hero) Equal to True))) Equal to 1
^ Will check if the player has one hero.
 
Status
Not open for further replies.
Top