"Talking" to a unit.

blurished

Active Member
Reaction score
1
im making this small campaign map. i want to add a trigger where when u select unit A, while being 200 radius away from it and typing -ask in the chat box a game text will pop up saying blablabla
 

Infy

New Member
Reaction score
0
When you initialize the map, assign all the "talking" units an incremental custom value and some phrases

e.g.
Talking Footman: custom value 1
Talking Peasant: custom value 2
etc.

Then create a string array containing each message matching each unit.

e.g.
Phrases[1] = "Hi, I'm a footman!"
Phrases[2] = "No one notices me..."
etc.

Now, in a separate trigger, make an event for each player for when they say "-ask"

And for the actions:

Trigger:
  • Unit Group - Pick every unit in (Units currently selected by (Triggering player)) and do (Actions)
    • Loop - Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Custom value of (Picked unit)) Greater than 0
        • Then - Actions
          • Game - Display to (Player group((Triggering player))) the text: Phrases[(Custom value of (Picked unit))]
          • Skip remaining actions
        • Else - Actions
          • Do nothing


The skip remaining actions just means we found a unit that has an ask phrase and we can skip any more.
 

Accname

2D-Graphics enthusiast
Reaction score
1,462
or you could simply use hashtables and link the units handle to a string...
 
General chit-chat
Help Users
  • No one is chatting at the moment.

      The Helper Discord

      Members online

      No members online now.

      Affiliates

      Hive Workshop NUON Dome World Editor Tutorials

      Network Sponsors

      Apex Steel Pipe - Buys and sells Steel Pipe.
      Top