What i want to do is changing unit production sound.
If possible i would like to do that without modding.
I haven't figured out how to detect when a new unit is build.
I would like to do that for 4 units, which are regular combat units (they will die for sure some times) so it has to play that wav only when the counter goes up.
If it have been talked about already - sorry, i couldn't find it.
None.
An artist's depiction of an Extended Unit Death
You'll basically need to build an inverse of a
Kills to Cash system, except using the Unit score instead of the Kills score. I'm not entirely sure if the score values are the same for all units, but the kill score values can be found here:
http://www.staredit.net/wiki/index.php?title=Unit#Kill_ScoreAn example trigger would look like this:
All Players
Current Player has suffered exactly 0 deaths of Cantina.
Current Player units score is at least 2400.
Current Player commands at least 1 Terran Battlecruiser.
Modify death counts for Current Player: Set to 12 for Cantina.
Play 'CustomBattlecruiserReady.wav'
Modify score for Current Player: Subtract 2400 units.
Preserve Trigger.
In English:
- The first condition is using Death Counters to prevent multiple wavs from running within one second of each other.
- The second condition is checking if the player's build score is at least high enough for a Terran Battlecruiser
- The third condition is a safety check to actually verify that the player owns a Terran Battlecruiser
- The first action is using Death Counters to prevent these triggers from running (based on the first condition)
- The second action is playing the custom ready sound you want to use when creating a Terran Battlecruiser
- The third action is removing the points awarded for building a Terran Battlecruiser
- The fourth action allows the trigger to run more than once
Repeat the above trigger for
every unit you can build in your game, regardless of whether or not you want a custom sound; for the units that you aren't playing a custom sound for, remove the 'Play Wav' action (and, if preferred, the 'Set Deaths' action). Make sure to order the triggers in descending order of the unit's score, or else you could misattribute scores to incorrect units.
Finally, at the bottom of these triggers, have the following as a general safety clean up (for cases where you might build units simultaneously) and to decrement the Death Counter timer:
All Players
Always
Modify score for Current Player: Set to 0 units.
Modify death counts for Current Player: Subtract 1 for Cantina.
Preserve Trigger.
Finally, the caveats of this method:
- You'll need to make triggers even for the units you don't want to play a custom sound for, because otherwise their build score can falsely trigger one of the wavs. For those triggers, remove the 'Play Wav' action, but keep the action to reduce the score.
- A unit will still play their normal ready sound with the above setup. You can fix this by muting unit speech, though this applies to all speech, not just ready sounds.
- Some units have the same score, so if you have both types of units, it's impossible to detect which one has been created.
- This is a complicated mapping problem to solve, but it would be an easy modding problem.
A potential alternate method to avoid creating triggers for units you aren't interested in is by tracking how many of a type of unit the player commands vs how many of that type have died. This significantly increases complexity and there's no simple way to do arithmetic between variables in SC, so I don't see it as being a more viable approach than what I've suggested.
Post has been edited 7 time(s), last time on Sep 3 2016, 12:31 pm by Roy.
That should work.
I fooled around with kill to kash but I didn't think about using it that way, ur creative for sure
.
Gotta remove mind control, no way I'm doing this for all 3 races xD.
Many thanks, you helped me a lot.
None.