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

Chat message trigger--Help!

Status
Not open for further replies.
Level 2
Joined
Apr 25, 2009
Messages
20
im trying to make a trigger that is based on a player chat message.
the chat message needs to be used to create units.
basically the player would say a1-11 or a1-24
a1 would just mean area 1, thats definite, so im just putting a1- as the first string as a value.
the second part is two numbers. the first is suposed to be a unit type.
1 might mean footman, 2 might mean grunt, and 3 rifleman, etc.
and the second for how many, a number between 1 and 10, if possible.

Im trying to get the trigger to look something like this

Events -
Player Red types a1-((variable here... Integer?)(variable here Unit type?))
Player blue types a1-((variable here... Integer?)(variable here Unit type?))
Player teal types a1-((variable here... Integer?)(variable here Unit type?))
(etc.)
Conditions -
Actions
create (variable ... integer?) (variable - unittype?) for player neutral hostile at Area 1

I guess the trigger would work i could figure out how to set the variable depending on the chat message...

Im pretty sure the best way to do this is with variables, but as im pretty new to using warcraft editor, i dont really know what to do.
i dont no much about setting variables and such, and i dont no when or how to use array. If any1 could please help
 
Level 4
Joined
Dec 9, 2008
Messages
52
What you need are substrings. Here's an example of a trigger that can be expanded and generalized.
  • Events
    • Player - Player 1 (Red) types a chat message containing a as A substring
  • Conditions
  • Actions
    • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
      • If - Conditions
        • (Substring((Entered chat string), 1, 2)) Equal to a1
      • Then - Actions
        • Set pickedarea = area1
      • Else - Actions
    • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
      • If - Conditions
        • (Substring((Entered chat string), 1, 2)) Equal to a2
      • Then - Actions
        • Set pickedarea = area2
      • Else - Actions
    • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
      • If - Conditions
        • (Substring((Entered chat string), 4, 4)) Equal to 1
      • Then - Actions
        • Set pickedunittype = Footman
      • Else - Actions
    • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
      • If - Conditions
        • (Substring((Entered chat string), 4, 4)) Equal to 2
      • Then - Actions
        • Set pickedunittype = Knight
      • Else - Actions
    • Set pickedamount = (Integer((Substring((Entered chat string), 5, 5))))
    • Unit - Create pickedamount pickedunittype for (Triggering player) at (Center of pickedarea) facing Default building facing degrees
 
Last edited:
Level 2
Joined
Apr 25, 2009
Messages
20
If you could explain what the numbers after "substring" do it would be a great help, so that i can adjust your trigger to my game.
ex:(Substring((Entered chat string), 1, 2)) .... ( the 1 and 2)
 
Status
Not open for further replies.
Top