From my knowledge, I doubt, this is possible. Even, if you can modify the unit name field with CatalogSetValue (which might not even be possible), you can only add a text link string, which (afaik) cannot be created at runtime.
So, if CatalogSetValue works for the unit name, you would be able to do stuff like choose from a predefined list of names or something, but you have no direct access on the actual text, so you cannot modify it dynamically.
Oh it's possible, look at Cortex Roleplay, in it you can use a chat command to rename a unit but I am not exactly sure how to go about doing it and you could probably go to their forums and see if they can help you out.
The error is propably caused by the fact that the field Name should contain a link to a text, not the text itself. Or maybe it is just locked for editing.
I use the Unit - Set info text to change the unit's sub-name, don't know about the actual name...
Oh it's possible, look at Cortex Roleplay, in it you can use a chat command to rename a unit but I am not exactly sure how to go about doing it and you could probably go to their forums and see if they can help you out.
example for unit rename with chat command:
rename unit
Events
Game - Player Any Player types a chat message containing "-setname ", matching Partially
Local Variables
Conditions
Actions
Catalog - Set value of Units (String((Unit type of current target[(Triggering player)]))) "Name" for player (Triggering player) to (Substring((Entered chat string), 10, (Length of (Entered chat string))))
this will rename all units with the type of the selected unit to the entered name for the player that entered the message.
PS: catalog field value set requires a string, not a text.
Ah, I see. Technically, you don't set the name of the unit, you set the text path for the name of the unit. However, if this path does not contain text, it will show the path instead, the same issue, which causes the Param/Value/... thing with localizations.
In this case, you need to be careful with the text path values in your map, if you happen to enter a name, which matches a predefined path, it will show the contained text as the unit name instead. If you always use keys like "Abil/Name/x" and "Button/Tooltip/Y" you should be fine, though.
However, if you for example happen to have a spell called "Nova" and you were a little sloppy with your text keys and added just Nova for the tooltip, and someone wants to give the unit the name Nova, the name would show up as "Deals damage in an area" or something :D
Quote:
Catalog - Set value of Units (String(Civilian (Male))) "CUnit_Name" for player (Triggering player) to (Entered chat string)
Welcome to sc2mapster, Vituz! Feel free to PM me if you have any questions!
Anyways.. I am unaware of how you would do this. Although what about "catalog field value set". I am unaware of how that works specifically, but it may be what your looking for.
Might I recommend simply creating a text tag with triggers over the hero's head? It's very easy to do.
Rollback Post to RevisionRollBack
Feel free to Send me a PM if you have any questions/concerns!
To post a comment, please login or register a new account.
Can this be done? I want to take a unit and rename it whatever with triggers.
For instance, the player could enter a name for his unit and the unit would use that name.
How do I do this?
From my knowledge, I doubt, this is possible. Even, if you can modify the unit name field with CatalogSetValue (which might not even be possible), you can only add a text link string, which (afaik) cannot be created at runtime.
So, if CatalogSetValue works for the unit name, you would be able to do stuff like choose from a predefined list of names or something, but you have no direct access on the actual text, so you cannot modify it dynamically.
@Kueken531: Go
Here's what I have:
Catalog - Set value of Units (String(Civilian (Male))) "CUnit_Name" for player (Triggering player) to (Entered chat string)
This gives me an error at runtime, any ideas?
Oh it's possible, look at Cortex Roleplay, in it you can use a chat command to rename a unit but I am not exactly sure how to go about doing it and you could probably go to their forums and see if they can help you out.
The error is propably caused by the fact that the field Name should contain a link to a text, not the text itself. Or maybe it is just locked for editing.
I use the Unit - Set info text to change the unit's sub-name, don't know about the actual name...
try "Name" only. remove CUnit_
about the topic: its not possible to rename a SPECIFIC unit, but its possible to rename all units of a UNIT TYPE by using catalog field value set.
example for unit rename with chat command:
rename unit
Events
Game - Player Any Player types a chat message containing "-setname ", matching Partially
Local Variables
Conditions
Actions
Catalog - Set value of Units (String((Unit type of current target[(Triggering player)]))) "Name" for player (Triggering player) to (Substring((Entered chat string), 10, (Length of (Entered chat string))))
this will rename all units with the type of the selected unit to the entered name for the player that entered the message.
PS: catalog field value set requires a string, not a text.
Ah, I see. Technically, you don't set the name of the unit, you set the text path for the name of the unit. However, if this path does not contain text, it will show the path instead, the same issue, which causes the Param/Value/... thing with localizations.
In this case, you need to be careful with the text path values in your map, if you happen to enter a name, which matches a predefined path, it will show the contained text as the unit name instead. If you always use keys like "Abil/Name/x" and "Button/Tooltip/Y" you should be fine, though. However, if you for example happen to have a spell called "Nova" and you were a little sloppy with your text keys and added just Nova for the tooltip, and someone wants to give the unit the name Nova, the name would show up as "Deals damage in an area" or something :D
This should be correct.
what about for models?
bump@Kueken531: Go
bump@Mille25: Go
It would be great to rename a hero unit to the owners actual name...
I can't seem to find the right function to put in Player name in there.. like Text(name of player) etc...
Any ideas?
@Vituz: Go
Welcome to sc2mapster, Vituz! Feel free to PM me if you have any questions!
Anyways.. I am unaware of how you would do this. Although what about "catalog field value set". I am unaware of how that works specifically, but it may be what your looking for.
Might I recommend simply creating a text tag with triggers over the hero's head? It's very easy to do.