• 🏆 Texturing Contest #33 is OPEN! Contestants must re-texture a SD unit model found in-game (Warcraft 3 Classic), recreating the unit into a peaceful NPC version. 🔗Click here to enter!
  • 🏆 Hive's 6th HD Modeling Contest: Mechanical is now open! Design and model a mechanical creature, mechanized animal, a futuristic robotic being, or anything else your imagination can tinker with! 📅 Submissions close on June 30, 2024. Don't miss this opportunity to let your creativity shine! Enter now and show us your mechanical masterpiece! 🔗 Click here to enter!

[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