Message that shows life

EoW.chips

New Member
Reaction score
2
Hello,
i am trying to do a trigger that when u type "-hp" then u get the currently selected unit's Life. It should show up with a text message.

I tried this:
Code:
Hit Points
    Ereignisse
        Spieler - Spieler 1 (Rot) types a chat message containing -hp as Exakte Ãœbereinstimmung
    Bedingungen
    Aktionen
        Set SelectedUnits = (Units currently selected by (Triggering player))
        Spiel - Display to Spielergruppe - Spieler 1 (Rot) the text: (|cffFF0000Hit points:|r + ((String((Leben of (Triggering unit)))) + ( /  + (String((Max. Leben of (Triggering unit)))))))
        Custom script:   call DestroyGroup (udg_SelectedUnits)

It should be like in vampirism beast.
 

HellCraft

Member
Reaction score
19
Code:
hp
    Events
        Player - Player 1 (Red) types a chat message containing -hp as An exact match
    Conditions
    Actions
        Set SelectedUnits = (Units currently selected by (Triggering player))
        Unit Group - Pick every unit in SelectedUnits and do (Actions)
            Loop - Actions
                Game - Display to Player Group - Player 1 (Red) the text: ((String((Life of (Picked unit)))) + (/ + (String((Max life of (Picked unit))))))
        Custom script:   call DestroyGroup (udg_SelectedUnits)

Should work, whats the problem?
 

EoW.chips

New Member
Reaction score
2
Okay, that works so far, but there is one think i dont like. For example an unit with 300 Life: It shows the Life like 300.000 / 300.000
I just want to show up 300 / 300, no zeros after the comma
 

0WN3D

New Member
Reaction score
15
Try using this
Game - Display to Player Group - Player 1 (Red) the text: ((String((Consversion of Real to Integer(Life of (Picked unit))))) + (/ + (String((Consversion of Real to Integer(Max life of (Picked unit)))))))

Or something along the lines.... I need to go to school soon so i dun rly have much time.... But im sure you nid to convert the real into integer then display it as real hp will always have decimal.....
 

akuzaid93

New Member
Reaction score
3
use an integer variable. before displaying the message, set that variable (ie, TempLife) to real life of picked unit.
so it should be,

this is my trigger to show movement speed,
Trigger:
  • Actions
    • Unit Group - Pick every unit in (Units owned by (Triggering player)) and do (Actions)
      • Loop - Actions
        • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
          • If - Conditions
            • ((Picked unit) is A Hero) Equal to True
          • Then - Actions
            • Set MovespeedTemp = (Integer((Current movement speed of (Picked unit))))
            • Game - Display to PGroup[(Player number of (Triggering player))] the text: (Movement speed is + (String(MovespeedTemp)))
          • Else - Actions


**edit
PGroup is just an array variable that makes sure that the message is only shown to triggering player.
MovespeesTemp is an integer variable.
 
General chit-chat
Help Users
  • No one is chatting at the moment.

      The Helper Discord

      Staff online

      Members online

      Affiliates

      Hive Workshop NUON Dome World Editor Tutorials

      Network Sponsors

      Apex Steel Pipe - Buys and sells Steel Pipe.
      Top