• 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 Message + Selected Unit Event

Status
Not open for further replies.
Level 1
Joined
Sep 12, 2007
Messages
5
Hi, I need help with a trigger. I've tried searching the forums to no avail as I don't know what the search term would be. What the trigger does is that when a unit is selected and the player types a message, the 'Actions' will trigger. But having 2 events won't work as only one is needed to trigger the Actions. How do you make it so that when you select a unit and type a message like '-sethealth 1000', it will set the selected unit's maximum health to 1000? Thanks. :grin:
 
I got this much for you, but i cant seem to find how to set the max hp to the value, however it can set the selected unit to any life below its max hp.

  • Select
    • Events
      • Player - Player 1 (Red) types a chat message containing -sethealth as A substring
    • Conditions
    • Actions
      • For each (Integer A) from 1 to (Length of (Entered chat string)), do (Actions)
        • Loop - Actions
          • Set String = (Substring((Entered chat string), 11, (Integer((Entered chat string)))))
          • Set Integer = (Real(String))
      • Unit Group - Pick every unit in (Units currently selected by (Triggering player)) and do (Actions)
        • Loop - Actions
          • Unit - Set life of (Picked unit) to Integer
 
Level 5
Joined
Jan 15, 2007
Messages
199
  • For each (Integer A) from 1 to (Length of (Entered chat string)), do (Actions)
  • Loop - Actions
  • Set String = (Substring((Entered chat string), 11, (Integer((Entered chat string)))))
  • Set Integer = (Real(String))
  • Unit Group - Pick every unit in (Units currently selected by (Triggering player)) and do (Actions)
  • Loop - Actions
  • Unit - Set life of (Picked unit) to Integer
You can just replace that with
  • Unit Group - Pick every unit in (Units currently selected by (Triggering player)) and do (Actions)
  • Loop - Actions
  • Unit - Set life of (Picked unit) to Real( Substring((Entered chat string), 12, (Length of (Entered chat string))
 
Level 1
Joined
Sep 12, 2007
Messages
5
Well since I don't seem to be able to set max hp, I will probaly assume it requires Jass, which I won't do in the near future. Thanks all for the help.
 
Status
Not open for further replies.
Top