I've been searching about for this topic quite a bit, and I've found a few resources - albeit a bit vague.
A good reference I've found to start from is here.
In this thread, my question is tackled sorta - but I'm curious as to how exactly to implement either of the solutions provided:
Should be possible with a global unit array and by hooking up layout files, specifically GameUI/UIContainer/ConsoleUIContainer/InfoPanel/InfoPaneUnit/NameLabel
If not you could hide the default unit label and create your own with dialogs and recreate the same functionality.
I'm curious about what he means by using a dialog to emulate this. Is it possible to actually overlay text in the position of the unit name, cleanly? I've heard this doesn't work when different resolutions are involved.
I'm also unsure about what was meant by using a global unit array and layout files. I'm not well-versed with either and it'd be super awesome if someone could clarify how I could use them to achieve this.
My end goal is to be able to give nameless units a particular name up until a trigger decides for a new name to be given (from a player), which will be applied ONLY to future units of that type that are produced, not every single unit. I've seen upgrades be referenced as a method for doing this, sorta, but I'm unsure if it will be as practical given I need to allow for limitless name changes.
I have a couple of wheels spinning, but to be honest I don't have it in me to dig into something I know so little about right now. I feel like an effect can modify a unit's name, so simply adding a trigger that applies that effect/behavior to unit types upon creation would be how I would start. I don't know enough about how to change the text the behavior would apply, personally.
DrSuperEvil will be along shortly to throw out a bunch of data stuff that I don't understand, so until then, you might look into effects and triggers that use player text groups to get you started.
The Set Unit Info action will let you set the text that appears below the unit type name, where kills and rank usually appear, as well as the "tip" text that appears when you hover the mouse over a unit. Changing those would be a "simple" matter of setting up a record with a text variable for each unit type. You simply set the default value to the unit's in game name, and have a trigger that changes all created units info to these variables based on unit type. When you want the names to change, you set up a trigger that changes those variables based on how you decide to implement it.
Using the previous suggestion to go through GameUI/UIContainer/ConsoleUIContainer/InfoPanel/InfoPaneUnit/NameLabel and simply delete all of the names so that the only text that shows up is the name you choose. (not the unit's original name.)
If you were to create a trigger that went off every time someone entered chat message with text "" (click the text and leave it blank, or perhaps put a-z?) matching partially, you could have the trigger save the "entered string" as a separate global variable based on the player that typed it.
Finally, put a button for each unit type on a building(s), and add a new trigger to have each button swap in the saved variable to "name" all new units of that type to what was entered. You could also set a button on each unit, letting you change individual names to whatever that global variable is with a separate trigger.
He wants to be able to change the name to anything he wants, and since you can't change the behavior modification text (that I know of), you would have to make it limited to however many behaviors you felt like making.
EDIT: Instead of trying to remove the names through the UI, simply make a behavior that overrides unit name and leave it blank. Then apply that behavior to your unit creation trigger with the set unit info.
That's an extremely clever way of approaching it - I'll look into doing that!
Thank you very much for your ideas. I think using a blank behavior and unit info will be the closest, most appealing, and easiest to implement solution to renaming on an individual unit basis. I believe this should easily allow for player input to change without a lot of hassle.
I would be very careful if you plan to implement this into a multiplayer environment. It will probably create a lot of random chat messages popping up, and since it will have to save each chat entry as a variable, it may cause performance issues.
EDIT: And I totally intend to use this myself if I ever make a hero based map with Heroes the player can name.
Are the variables cleared from memory when a unit is removed with those names stored? Or is there some sort of method to cleaning up memory wasted by those variables later on?
The only thing that would be saved would be the variables that generate the information you're putting on your units. Since they'll be Global Variables, the game will always remember them. I've never really played any large team arcade maps, so I was just warning you about the chat being flooded with the names people want for units. And if there is a lot of chat between players, then you have to make certain they understand that what their last entry was will be the names of newly created units once they hit that button.
Dialogs are the GUI of starcraft, in order to create a simple name creator one, you can use a dialog item of the edit box type (for a player to type the unit's name in), and a button for them to click when they've entered the name, to apply it to the unit.
Perfect - I don't think it should pose TOO big of a memory problem. If I were to allow a maximum 64 length string for each individual unit, that would be 64 bytes (I presume) of data required. If there were even 2000 active units on the map with this individual data, it would still only amount to well less than 1 MB of memory usage. Hopefully, however, when multiple other individual factors start to get involved (such as custom unit properties), this doesn't start to exponentially grow to the point where there are performance issues.
I intend to create a special dialog somehow for allowing players to give their units customized names, and apply them on an individual basis. I will not use chat. Thank you for your advice!
On a side-note, is it possible to give players a form of rich text editing, with a large box for typing in information? I am curious if players could have a nice interface for making custom tooltips to later associate with their renamed unit, with their choice of colors and effects.
It technically is, however note that the edit box consists of one line for text, you could show what the final text would look like using a label though.
I've assembled a simple test map of what I have so far.
Currently, I have designed a system that will take TWO input commands from the user.
?edit infantry 1 name
and
?edit infantry 1 info
Additionally, there is a button on a dialog that tests changing the icon and unit created for me, through the use of catalog triggers.
However, my problem currently is how to apply the behavior/dialog concept now, for renaming. The system I just implemented uses Catalog triggers, and therefore renames everything on the map. Player input is saved into global variables.
How do I make it so these special name dialogs only show when units are SELECTED?
Also, how do I figure out/identify which unit needs to have the dialog applied to it? (I have little idea on how to interact with units after they are created through triggers)
EDIT: Completely derped. Misinterpreted what was said - I was thinking I was drawing dialogs (which I had already mentioned seemed unwieldy) instead of your Unit Info suggestion.
However, I am still having trouble with figuring out which units need what information applied. I can only figure out how to identify units that pre-exist on the map, but when I try to write "xx unit is created", I cannot actually select a unit in general.
Make a unit-specific behavior for each unit that I specify in the data editor, and run a check to see what behavior the unit has as a condition to running the name - changer.
I have had a little success with the subtitle name, but it is very small and very low on the UI. Is there any way to increase the size of the text, or modify its positioning?
However, I am still having trouble with figuring out which units need what information applied. I can only figure out how to identify units that pre-exist on the map, but when I try to write "xx unit is created", I cannot actually select a unit in general.
You need to set up a trigger event "unit is created" with a way to apply the chosen variable to newly created units of a certain type.
For each integer (unit) from 1 to 100, do actions
If (type of (last created unit)) = typeArray(unit)
then set unit info to nameArray(unit)
You would be able to set the nameArray(x) values through a dialog, and any new unit that matches the unit type will be renamed to the last entry of the dialog.
So I set the values for A B and C, but it doesn't appear any differently in-game.
How do you properly concatenate the parts of the expression? I've tried typing just ABC and A+B+C in place of the text I was using originally.
Additionally, I have another pressing question (I may make another topic if need be):
I've ran into a wall with my individual-unit design with behaviors. I don't think there's a way to interact with them on a per-unit basis. I only found ways to edit them through catalog triggers, however I need to figure out a method to make it so:
- existing units do not get affected by changes
- new units receive changes
I thought maybe creating a convoluted system for individually checking to see if behaviors are being used by units already, and if so using an alternate behavior. On a large scale this would be a huge mess, and would still (presumably) only work for a limited amount of units at a time. Buffs/abilities will be separated by their utility (Health, damage modifiers, effects, etc.), however if I use the same buff for each unit, any modifications will affect all at once.
Perhaps there's another trick that could be used trigger-wise to achieve this, like stacking lots of little buffs (I'm not sure if this is viable for all situations)
Sorry, I Edited to add the answer to your second question before I saw you post.
And using Expression, you use ~ A ~ ~ B ~ ~ C ~ (without the spacing), and set the values for A, B, and C by clicking the letter in the lower portion of the Expression box. You have to click the green plus twice to add B and C.
And unfortunately, you have to set the Unit Type Array manually through a trigger on initialize. Which, if you are doing this for Every Unit Type, means you need to set up a LOT of variables.
Try using the unit enters region (entire map) trigger. A unit that is created will trigger this as well, you can then use triggering unit to get the unit that entered the map.
Edit: You could also set the custom value of units that enter the map to 1 and check for it's value on all units.
Here is an almost related question. If you alter a units name with triggers, and then saved the unit into a bank, would the unit reload with that new name? I know some things don't save in banks when a unit is saved. Custom values for example. However, my thoughts are that it would be a great way to make a bank on a game very difficult to crack (the people at d3scene will crack any bank for you). If you were to save important values into a specific units name, and then check that against a bank value, it could be a very simple way to protect your bank against the simple ways of hacking through them.
Hello!
I've been searching about for this topic quite a bit, and I've found a few resources - albeit a bit vague.
A good reference I've found to start from is here.
In this thread, my question is tackled sorta - but I'm curious as to how exactly to implement either of the solutions provided:
Should be possible with a global unit array and by hooking up layout files, specifically GameUI/UIContainer/ConsoleUIContainer/InfoPanel/InfoPaneUnit/NameLabel
If not you could hide the default unit label and create your own with dialogs and recreate the same functionality.
I'm curious about what he means by using a dialog to emulate this. Is it possible to actually overlay text in the position of the unit name, cleanly? I've heard this doesn't work when different resolutions are involved.
I'm also unsure about what was meant by using a global unit array and layout files. I'm not well-versed with either and it'd be super awesome if someone could clarify how I could use them to achieve this.
My end goal is to be able to give nameless units a particular name up until a trigger decides for a new name to be given (from a player), which will be applied ONLY to future units of that type that are produced, not every single unit. I've seen upgrades be referenced as a method for doing this, sorta, but I'm unsure if it will be as practical given I need to allow for limitless name changes.
@hardball69: Go
I have a couple of wheels spinning, but to be honest I don't have it in me to dig into something I know so little about right now. I feel like an effect can modify a unit's name, so simply adding a trigger that applies that effect/behavior to unit types upon creation would be how I would start. I don't know enough about how to change the text the behavior would apply, personally.
DrSuperEvil will be along shortly to throw out a bunch of data stuff that I don't understand, so until then, you might look into effects and triggers that use player text groups to get you started.
@BigDonRob: Go
The Set Unit Info action will let you set the text that appears below the unit type name, where kills and rank usually appear, as well as the "tip" text that appears when you hover the mouse over a unit. Changing those would be a "simple" matter of setting up a record with a text variable for each unit type. You simply set the default value to the unit's in game name, and have a trigger that changes all created units info to these variables based on unit type. When you want the names to change, you set up a trigger that changes those variables based on how you decide to implement it.
Using the previous suggestion to go through GameUI/UIContainer/ConsoleUIContainer/InfoPanel/InfoPaneUnit/NameLabel and simply delete all of the names so that the only text that shows up is the name you choose. (not the unit's original name.)
create a new behaviour, go to Modifications+ - Unit - Name overwrite and ignore any non answers
@BigDonRob: Go
If you were to create a trigger that went off every time someone entered chat message with text "" (click the text and leave it blank, or perhaps put a-z?) matching partially, you could have the trigger save the "entered string" as a separate global variable based on the player that typed it.
Finally, put a button for each unit type on a building(s), and add a new trigger to have each button swap in the saved variable to "name" all new units of that type to what was entered. You could also set a button on each unit, letting you change individual names to whatever that global variable is with a separate trigger.
@FunkyUserName: Go
He wants to be able to change the name to anything he wants, and since you can't change the behavior modification text (that I know of), you would have to make it limited to however many behaviors you felt like making.
EDIT: Instead of trying to remove the names through the UI, simply make a behavior that overrides unit name and leave it blank. Then apply that behavior to your unit creation trigger with the set unit info.
@BigDonRob: Go
That's an extremely clever way of approaching it - I'll look into doing that!
Thank you very much for your ideas. I think using a blank behavior and unit info will be the closest, most appealing, and easiest to implement solution to renaming on an individual unit basis. I believe this should easily allow for player input to change without a lot of hassle.
Thanks to both of you for your input!!
@hardball69: Go
I would be very careful if you plan to implement this into a multiplayer environment. It will probably create a lot of random chat messages popping up, and since it will have to save each chat entry as a variable, it may cause performance issues.
EDIT: And I totally intend to use this myself if I ever make a hero based map with Heroes the player can name.
Are the variables cleared from memory when a unit is removed with those names stored? Or is there some sort of method to cleaning up memory wasted by those variables later on?
@hardball69: Go
it's called garbage collection in programming, in short if something looses all references to it it's considered save to delete.
@FunkyUserName: Go
The only thing that would be saved would be the variables that generate the information you're putting on your units. Since they'll be Global Variables, the game will always remember them. I've never really played any large team arcade maps, so I was just warning you about the chat being flooded with the names people want for units. And if there is a lot of chat between players, then you have to make certain they understand that what their last entry was will be the names of newly created units once they hit that button.
@BigDonRob: Go
The variables would be wiped of the references to those units.
In any case
@hardball69: Go
Dialogs are the GUI of starcraft, in order to create a simple name creator one, you can use a dialog item of the edit box type (for a player to type the unit's name in), and a button for them to click when they've entered the name, to apply it to the unit.
Still alive and kicking, just busy.
My guide to the trigger editor (still a work in progress)
Perfect - I don't think it should pose TOO big of a memory problem. If I were to allow a maximum 64 length string for each individual unit, that would be 64 bytes (I presume) of data required. If there were even 2000 active units on the map with this individual data, it would still only amount to well less than 1 MB of memory usage. Hopefully, however, when multiple other individual factors start to get involved (such as custom unit properties), this doesn't start to exponentially grow to the point where there are performance issues.
I intend to create a special dialog somehow for allowing players to give their units customized names, and apply them on an individual basis. I will not use chat. Thank you for your advice!
On a side-note, is it possible to give players a form of rich text editing, with a large box for typing in information? I am curious if players could have a nice interface for making custom tooltips to later associate with their renamed unit, with their choice of colors and effects.
It technically is, however note that the edit box consists of one line for text, you could show what the final text would look like using a label though.
Still alive and kicking, just busy.
My guide to the trigger editor (still a work in progress)
I've assembled a simple test map of what I have so far.
Currently, I have designed a system that will take TWO input commands from the user.
?edit infantry 1 name and ?edit infantry 1 info
Additionally, there is a button on a dialog that tests changing the icon and unit created for me, through the use of catalog triggers.
However, my problem currently is how to apply the behavior/dialog concept now, for renaming. The system I just implemented uses Catalog triggers, and therefore renames everything on the map. Player input is saved into global variables.
How do I make it so these special name dialogs only show when units are SELECTED? Also, how do I figure out/identify which unit needs to have the dialog applied to it? (I have little idea on how to interact with units after they are created through triggers)
EDIT: Completely derped. Misinterpreted what was said - I was thinking I was drawing dialogs (which I had already mentioned seemed unwieldy) instead of your Unit Info suggestion.
However, I am still having trouble with figuring out which units need what information applied. I can only figure out how to identify units that pre-exist on the map, but when I try to write "xx unit is created", I cannot actually select a unit in general.
Current idea -
Make a unit-specific behavior for each unit that I specify in the data editor, and run a check to see what behavior the unit has as a condition to running the name - changer.
I have had a little success with the subtitle name, but it is very small and very low on the UI. Is there any way to increase the size of the text, or modify its positioning?
@hardball69: Go
When you set the text, use Expression. Set the A value to <s val="BoardWarAppraiseBig5">
Set the B value to your variable (the text that is input by the player)
Set the C value to </s>
The number (1-5) in Value A determines how large it will be. Or you can use any other style already in the editor.
You need to set up a trigger event "unit is created" with a way to apply the chosen variable to newly created units of a certain type.
For each integer (unit) from 1 to 100, do actions
If (type of (last created unit)) = typeArray(unit)
then set unit info to nameArray(unit)
You would be able to set the nameArray(x) values through a dialog, and any new unit that matches the unit type will be renamed to the last entry of the dialog.
So I set the values for A B and C, but it doesn't appear any differently in-game.
How do you properly concatenate the parts of the expression? I've tried typing just ABC and A+B+C in place of the text I was using originally.
Additionally, I have another pressing question (I may make another topic if need be): I've ran into a wall with my individual-unit design with behaviors. I don't think there's a way to interact with them on a per-unit basis. I only found ways to edit them through catalog triggers, however I need to figure out a method to make it so:
- existing units do not get affected by changes - new units receive changes
I thought maybe creating a convoluted system for individually checking to see if behaviors are being used by units already, and if so using an alternate behavior. On a large scale this would be a huge mess, and would still (presumably) only work for a limited amount of units at a time. Buffs/abilities will be separated by their utility (Health, damage modifiers, effects, etc.), however if I use the same buff for each unit, any modifications will affect all at once.
Perhaps there's another trick that could be used trigger-wise to achieve this, like stacking lots of little buffs (I'm not sure if this is viable for all situations)
@hardball69: Go
Sorry, I Edited to add the answer to your second question before I saw you post.
And using Expression, you use ~ A ~ ~ B ~ ~ C ~ (without the spacing), and set the values for A, B, and C by clicking the letter in the lower portion of the Expression box. You have to click the green plus twice to add B and C.
And unfortunately, you have to set the Unit Type Array manually through a trigger on initialize. Which, if you are doing this for Every Unit Type, means you need to set up a LOT of variables.
Try using the unit enters region (entire map) trigger. A unit that is created will trigger this as well, you can then use triggering unit to get the unit that entered the map.
Edit: You could also set the custom value of units that enter the map to 1 and check for it's value on all units.
Still alive and kicking, just busy.
My guide to the trigger editor (still a work in progress)
Here is an almost related question. If you alter a units name with triggers, and then saved the unit into a bank, would the unit reload with that new name? I know some things don't save in banks when a unit is saved. Custom values for example. However, my thoughts are that it would be a great way to make a bank on a game very difficult to crack (the people at d3scene will crack any bank for you). If you were to save important values into a specific units name, and then check that against a bank value, it could be a very simple way to protect your bank against the simple ways of hacking through them.
Ideas?
Skype: [email protected] Current Project: Custom Hero Arena! US: battlenet:://starcraft/map/1/263274 EU: battlenet:://starcraft/map/2/186418