movespeed detection system on highlighted unit... how?

snmiglight

Active Member
Reaction score
3
once i've downloaded an unofficial dota map. in official dota map, when you entered "-ms"; there's a prompt that shows your hero's movespeed. but in the unofficial map, though, when you type it, the prompt shows the highlighted unit's movespeed. how is it done?
 

Nerfpl

New Member
Reaction score
53
i would make it in 2 triggers.

1
Event - unit is selected
actions - set X = selected unit

2
event - game chat msg = -ms
action - show curnet movement speed of X
 

Exfyre

hmm...
Reaction score
60
that only works for one player.

for multi players:

event
player 1 types "-ms"
player 2 types "-ms"
...
player 12 types "-ms"
cond
act
pick every unit in (units currently selected by triggering player)
game text (move speed of (picked unit))
 

snmiglight

Active Member
Reaction score
3
how about if i want it to show the unit's name together with its movespeed?

something like this:

(Unit's Name)'s movespeed is (N)

ohhh.. wait what kind of variable should i use? unit or unit group?
 

istar

New Member
Reaction score
31
game display text, use substrings
like
substring(Get unit name)+" current movespeed is "+value of ms
theres a get unit name function in GUI somewhere, go find it
 

Curo

Why am I still playing this game...?
Reaction score
109
Here's the trigger I use in my map:
Trigger:
  • Ms
    • Events
      • Player - Player 1 (Red) types a chat message containing -ms as An exact match
      • Player - Player 2 (Blue) types a chat message containing -ms as An exact match
      • Player - Player 3 (Teal) types a chat message containing -ms as An exact match
      • Player - Player 4 (Purple) types a chat message containing -ms as An exact match
      • Player - Player 5 (Yellow) types a chat message containing -ms as An exact match
      • Player - Player 6 (Orange) types a chat message containing -ms as An exact match
      • Player - Player 7 (Green) types a chat message containing -ms as An exact match
      • Player - Player 8 (Pink) types a chat message containing -ms as An exact match
    • Conditions
    • Actions
      • Set TempGroup = (Units in (Playable map area) matching (((Matching unit) is selected by (Triggering player)) Equal to True))
      • Set TempPlayerGroup = (Player group((Triggering player)))
      • Unit Group - Pick every unit in TempGroup and do (Game - Display to TempPlayerGroup for 5.00 seconds the text: (Movespeed of + ((Proper name of (Picked unit)) + <img src="data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7" class="smilie smilie--sprite smilie--sprite1" alt=":)" title="Smile :)" loading="lazy" data-shortname=":)" /> + (String((Integer((Current movement speed of (Picked unit))))))))))
      • Custom script: call DestroyForce (udg_TempPlayerGroup)
      • Custom script: call DestroyGroup (udg_TempGroup)


If you only want to display the movespeed of the hero (not other units), then just add the condition "Matching unit is a hero" when you set the group.
 

snmiglight

Active Member
Reaction score
3
are these correct?

Trigger:
  • Select Unit
    • Events
      • Player - Player 1 (Red) Selects a unit
    • Conditions
    • Actions
      • Set Movespeed_Group = (Units currently selected by (Triggering player))
      • Set Movespeed_Typer = (Triggering player)



Trigger:
  • Movespeed is Typed
    • Events
      • Player - Player 1 (Red) types a chat message containing -ms as A substring
    • Conditions
    • Actions
      • Unit Group - Pick every unit in Movespeed_Group and do (Actions)
        • Loop - Actions
          • Game - Display to (Player group(Movespeed_Typer)) the text: (((Name of (Picked unit)) + &#039;s movespeed is ) + (String((Current movement speed of (Picked unit)))))
      • Custom script: call DestroyGroup(udg_Movespeed_Group)



EDIT: wow it works... but how can i remove the .000? (it shows blah-blah's movespeed is 300.000)
 

istar

New Member
Reaction score
31
you dont have to set them as 2 separate triggers
the first event triggers every time the player selects a unit, and if the player selects a unit to do other actions other than -ms(which is pretty often) the actions are redundant
also, you didnt remove units from the group
if player selects A,deselects A ,then B, then C.....then Z, all 26 units are in inside as you didnt remove the deselected units
just
Code:
Set Movespeed_Group = (Units currently selected by (Triggering player))
just add this to the second trigger
 

istar

New Member
Reaction score
31
just a reminder, also put a error msg if player didnt selects any when he type -ms
if you want
 

Curo

Why am I still playing this game...?
Reaction score
109
Did you totally just skip over the fully working trigger I gave you?
 

Curo

Why am I still playing this game...?
Reaction score
109
Lol, well he can at least refer to my trigger to answer his questions.

To get rid of the ".000", convert the real to an integer.
 

SerraAvenger

Cuz I can
Reaction score
234
that only works for one player.

for multi players:

event
player 1 types "-ms"
player 2 types "-ms"
...
player 12 types "-ms"
cond
act
pick every unit in (units currently selected by triggering player)
game text (move speed of (picked unit))
Leaks too much ; )

Use what the first one supposed, just with X being an array and using
X[ player number of triggering player ] instead of just X.
EDIT: Curos system is fine too, for sure. But IDK if that loop through all units is equally as efficient.
 

SerraAvenger

Cuz I can
Reaction score
234
And running a trigger EVERY time someone selects a unit IS efficient? Sorry if I misunderstood :p

Well the problem Is that the trigger run everytime someone selects a unit will only have a low amount of operations at once, while yours will have more => There's a risk for reaching the OP_LIMIT.
 

snmiglight

Active Member
Reaction score
3
EXCUSE ME... CAN SOMEONE TELL ME HOW TO GET RID OF THE ".000" I CAN'T SEE WHERE TO CONVERT REAL TO INTEGER. (sorry for the all caps; for nobody seems to hear me.)
 

AceHart

Your Friendly Neighborhood Admin
Reaction score
1,497
It's simple though,
where it waits for you to enter a string, use "conversion - convert integer to string",
that integer will be "conversion - convert real to integer",
the real being whatever you want to show there.

Will look somthing like this:
String(Integer(Movespeed ...))
 
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