Remember in Supreme Commander where you could zoom out so far little icons had to be displayed over units so you can see them?
Well, you can also add those cool icons in StarCraft 2.
(Images within Spoiler to save space)
To Accomplish this there are three core things that need to be done:
1. Tracking the players zoom level.
2. Creating overhead Icons.
3. Turning them on and off at the right times.
Step 1:
Tracking the players zoom level
Goto the Upgrades Tab and Create a new Upgrade:
ZoomLevelTracker, Parent: Default Upgrade
Goto the Triggers Tab and create the following Trigger:
Events -
Timer - Every 0.5 Seconds of GameTime
Conditions - NA
Actions -
If -
(Current Camera Distance of Player 1) > 32
Then -
Tech Tree - Set ZoomLevelTracker upgrade level to 1 for player 1
If -
(Current Camera Distance of Player 1) <= 32
Then -
Tech Tree - Set ZoomLevelTracker upgrade level to 0 for player 1
You will need to add the above Trigger Checks for each player you intend to have in the map.
I used 32 because it is close to the default Max Zoom Distance, but if you have changed that in your map you will need to set that Trigger value to where ever along the Zoom Distance you want the Icons to show up.
Step 2:
Creating overhead Icons
This is easily the most difficult step.
Lets get the most finicky bits out of the way first.
Goto the Textures Tab (Under the Art and Sound Category) and create 3 new Textures:
You can use any texture file you wish for File, but make sure Slot is all lowercase.
While I was working on this, I noticed that any change to these files would temporarily break them in the editor.
They worked fine in game, but the editor just saw the default texture and threw some warnings at me.
An Editor Restart solved the issue for me, if you run into it.
Goto the Models Tab and create a new Model:
ZoomIcons_Model, Type: Generic, Parent: CModel
Art: Model - Assets\HardTiles\TarsonisRail\TarsonisRail.m3
Art: Scale Maximum - (1.0, 1.0, 0.0005)
Art: Scale Minimum - (1.0, 1.0, 0.0005)
Texture Declarations -
Index 0 . Prefix - TarsonisRail
Adaptations -
Index 0 . Slot - main.diffuse
Index 0 . Trigger On SubString - _Diffuse
Index 1 . Slot - main.specular
Index 1 . Trigger On SubString - _Specular
Index 2 . Slot - main.normal
Index 2 . Trigger On SubString - _Normal
Do not deviate, from any of these settings, except for the X and Y of the scale settings.
-TarsonisRail.m3 is the only cube model I could find that supports masking/transparency and that will be needed.
-As with the Textures make sure the Slots are all lowercase. If they do not match to the preset values perfectly they WILL NOT BE ACCEPTED by the editor.
-Make sure Prefix, and Trigger On SubString BOTH match above. They must match to the default materials that are on the TarsonisRail.m3.
(That INCLUDES the underscore in Trigger On SubString)
It is not really necessary to include the SetScale Event, but it does allow you to manually scale the icon per Unit Type, if that is needed.
Make sure the Z axis of the scale(both here and previously) are set to 0.0005, or you will see the sides of the cube.
We will be coming back here for Step 3.
Goto the Actor for the Unit you want to add an Icon to.
(Im not going to include steps on how to create a unit and it's actor, you should already know how to do that if you are looking at this tutorial)
UnitA_Actor
Event: Events -
Event - UnitBirth . Source Name - UnitA
Message - Create . Type . Actor - UnitA_ZoomedOut_Icon
Event - UnitBirth . Source Name - UnitA
Message - Attach . Type . Actor - UnitA_ZoomedOut_Icon
Attach Methods - Overhead, 0
Site Ops - SOp Point South World
Step 3:
Turning them on and off at the right times
Goto the Requirements Tab and create a new Requirement:
ZoomLevel_Check
Basic: Requirement . Use -
Type - Greater Than
Type - CountUpgrade Alias - ZoomLevelTrackerState - Completed
Type - Constant Value - 0
Goto the Validators Tab and create a new Validator:
ZoomIn_Check, Type: Player Requirement, Parent: CValidatorPlayerRequirement
None: Unit Selection Not Required - Enabled
Validator: Value - ZoomLevel_Check
None: Unit Selection Not Required does not appear to have a human readable name, and appears in the Data Fields under it's Raw Data Name. (EDSTR_FIELDNAME_CValidatorPlayerRequirement_UnitSelectionNotRequired)
Go back to the UnitA_ZoomedOut_Icon Actor, and add the following Events:
The SetTintColor Message is not necessary, but is another good way to customize the Icon if your using uncolored icons.
And I thats it.
You should now have a unit that will display a green "Eye" Icon above their head when you are fully zoomed out.
You will need to make a new set of UnitA_ZoomIcon_Diffuse/Specular/Normal Textures, and a UnitA_ZoomedOut_Icon Actor and linking them in the Event: Events fields for every unit you want to do this for.
Enjoy, and let me know if there are any problems. I typed this out close to midnight and may not have got everything squared.
Remember in Supreme Commander where you could zoom out so far little icons had to be displayed over units so you can see them?
Well, you can also add those cool icons in StarCraft 2.
(Images within Spoiler to save space)
To Accomplish this there are three core things that need to be done:
1. Tracking the players zoom level.
2. Creating overhead Icons.
3. Turning them on and off at the right times.
Step 1:
Tracking the players zoom level
Goto the Upgrades Tab and Create a new Upgrade:
Goto the Triggers Tab and create the following Trigger:
You will need to add the above Trigger Checks for each player you intend to have in the map.
I used 32 because it is close to the default Max Zoom Distance, but if you have changed that in your map you will need to set that Trigger value to where ever along the Zoom Distance you want the Icons to show up.
Step 2:
Creating overhead Icons
This is easily the most difficult step.
Lets get the most finicky bits out of the way first.
Goto the Textures Tab (Under the Art and Sound Category) and create 3 new Textures:
You can use any texture file you wish for File, but make sure Slot is all lowercase.
While I was working on this, I noticed that any change to these files would temporarily break them in the editor.
They worked fine in game, but the editor just saw the default texture and threw some warnings at me.
An Editor Restart solved the issue for me, if you run into it.
Goto the Models Tab and create a new Model:
Do not deviate, from any of these settings, except for the X and Y of the scale settings.
-TarsonisRail.m3 is the only cube model I could find that supports masking/transparency and that will be needed.
-As with the Textures make sure the Slots are all lowercase. If they do not match to the preset values perfectly they WILL NOT BE ACCEPTED by the editor.
-Make sure Prefix, and Trigger On SubString BOTH match above. They must match to the default materials that are on the TarsonisRail.m3.
(That INCLUDES the underscore in Trigger On SubString)
Goto the Actors Tab and create a new Actor:
It is not really necessary to include the SetScale Event, but it does allow you to manually scale the icon per Unit Type, if that is needed.
Make sure the Z axis of the scale(both here and previously) are set to 0.0005, or you will see the sides of the cube.
We will be coming back here for Step 3.
Goto the Actor for the Unit you want to add an Icon to.
(Im not going to include steps on how to create a unit and it's actor, you should already know how to do that if you are looking at this tutorial)
Step 3:
Turning them on and off at the right times
Goto the Requirements Tab and create a new Requirement:
Goto the Validators Tab and create a new Validator:
None: Unit Selection Not Required does not appear to have a human readable name, and appears in the Data Fields under it's Raw Data Name. (EDSTR_FIELDNAME_CValidatorPlayerRequirement_UnitSelectionNotRequired)
Go back to the UnitA_ZoomedOut_Icon Actor, and add the following Events:
The SetTintColor Message is not necessary, but is another good way to customize the Icon if your using uncolored icons.
And I thats it.
You should now have a unit that will display a green "Eye" Icon above their head when you are fully zoomed out.
You will need to make a new set of UnitA_ZoomIcon_Diffuse/Specular/Normal Textures, and a UnitA_ZoomedOut_Icon Actor and linking them in the Event: Events fields for every unit you want to do this for.
Enjoy, and let me know if there are any problems. I typed this out close to midnight and may not have got everything squared.
;)