Staredit Network > Forums > SC1 UMS Mapmaking Assistance > Topic: Unit Death Counter Trigger?
Unit Death Counter Trigger?
Apr 15 2014, 1:33 pm
By: Arkane  

Apr 15 2014, 1:33 pm Arkane Post #1

Poopies. Just Poopies.

Heya!

I'm using a mechanic in my campaign where the player is forced to avoid having many casualties.

The trigger goes like this:

CONDITION:
> DEATH: Player 1 has suffered exactly, at most, at least<?> <value> deaths of men.
ACTION:
> DISPLAY TEXT MESSAGE: Display for current player: "Casualties at unacceptable numbers. Mission Aborted."
> DEFEAT: End scenario in defeat for current player.

I need to know two things from this.
1, what should I use for the condition? Exactly, At most, or At least?

2, Is there a way for me to show the player how many men he has lost? Kind of like a counter or a leaderboard? i kinda need it to show only the player's casualties. The only thing that should be seen is the player's own color and the number of men he lost. Is there a way for me to do that?

Though, regarding the second one, I could always go for an alternative which is a notification of how much the player has lost. But I liked the counter more since its much more convenient to the player.



Sort of wish that the SCBW Modding Community was still active. </3

Apr 15 2014, 2:05 pm Roy Post #2

An artist's depiction of an Extended Unit Death

You would use "At Least" if you're saying it should happen if at least X number of units have died.

I don't think you can make a leaderboard for deaths directly; you would have to use custom score, and keep that in sync with the player's total number of deaths. I would recommend Binary Countoffs for doing that.




Apr 15 2014, 2:50 pm jjf28 Post #3

Cartography Artisan

You can show deaths in the leaderboard by putting an extended unit in for leaderboard kills.

Find the unitID of the death you wish to display (place it on the map, open up properties to see Unit ID), then use leaderboard kills, and in the unit field type "ID:" then your unitID+228, ex: type "ID:228" (without quotes) for deaths of terran marine (source)

As a bonus: this works on Mac too since the memory's all in nice 4-byte blocks and the tables are at the same relative positions.

The extended unit may cause trouble in SCMDraft's texttrigs though so if you use TextTrigs regularly and don't want to have to manually remove and re-add this trigger go with binary countoffs->custom score


Woops you said deaths of men in specific.

Post has been edited 1 time(s), last time on Apr 15 2014, 4:05 pm by jjf28.



TheNitesWhoSay - Clan Aura - github

Reached the top of StarCraft theory crafting 2:12 AM CST, August 2nd, 2014.

Apr 15 2014, 7:36 pm O)FaRTy1billion[MM] Post #4

👻 👾 👽 💪

You can just subtract deaths for Men and add to Score, and then use the Score condition for the lose trigger.



TinyMap2 - Latest in map compression! ( 7/09/14 - New build! )
EUD Action Enabler - Lightweight EUD/EPD support! (ChaosLauncher/MPQDraft support!)
EUDDB - topic - Help out by adding your EUDs! Or Submit reference files in the References tab!
MapSketch - New image->map generator!
EUDTrig - topic - Quickly and easily convert offsets to EUDs! (extended players supported)
SC2 Map Texture Mask Importer/Exporter - Edit texture placement in an image editor!
\:farty\: This page has been viewed [img]http://farty1billion.dyndns.org/Clicky.php?img.gif[/img] times!

Apr 16 2014, 7:09 am Arkane Post #5

Poopies. Just Poopies.

Quote from O)FaRTy1billion[MM]
You can just subtract deaths for Men and add to Score, and then use the Score condition for the lose trigger.

I'm going to sound stupid but what are the actions and conditions I should use for that?



Sort of wish that the SCBW Modding Community was still active. </3

Apr 16 2014, 9:59 am Roy Post #6

An artist's depiction of an Extended Unit Death

Trigger
Players
  • Player 1
  • Conditions
  • Always
  • Actions
  • Show Leaderboard for most custom. Display label: "Total Deaths"
  • Disable use of computer players in leaderboard calculations

  • Trigger
    Players
  • Player 1
  • Conditions
  • Current Player has suffered at least 1 deaths of [men].
  • Actions
  • Set Deaths for Current Player: Subtract 1 [men].
  • Set Score for Current Player: Add 1 custom.
  • Preserve Trigger

  • Trigger
    Players
  • Player 1
  • Conditions
  • Current Player custom score is at least 50
  • Actions
  • Display Text Message: "Casualties at unacceptable numbers. Mission Aborted."
  • End scenario in defeat for the current player.





  • Apr 16 2014, 12:11 pm Arkane Post #7

    Poopies. Just Poopies.

    Quote from Roy
    Trigger
    Players
  • Player 1
  • Conditions
  • Always
  • Actions
  • Show Leaderboard for most custom. Display label: "Total Deaths"
  • Disable use of computer players in leaderboard calculations

  • Trigger
    Players
  • Player 1
  • Conditions
  • Current Player has suffered at least 1 deaths of [men].
  • Actions
  • Set Deaths for Current Player: Subtract 1 [men].
  • Set Score for Current Player: Add 1 custom.
  • Preserve Trigger

  • Trigger
    Players
  • Player 1
  • Conditions
  • Current Player custom score is at least 50
  • Actions
  • Display Text Message: "Casualties at unacceptable numbers. Mission Aborted."
  • End scenario in defeat for the current player.

  • YAY!!! IT WORKED!! THANKIESSSS!!!!



    Sort of wish that the SCBW Modding Community was still active. </3

    Apr 16 2014, 5:06 pm NudeRaider Post #8

    We can't explain the universe, just describe it; and we don't know whether our theories are true, we just know they're not wrong. >Harald Lesch

    Just be aware that when within 1 trigger loop 2 or more different types of units of Player 1 die it will only count 1. (e.g. splash)

    And that there's no easy fix for it.




    Apr 16 2014, 5:19 pm Roy Post #9

    An artist's depiction of an Extended Unit Death

    Quote from NudeRaider
    Just be aware that when within 1 trigger loop 2 or more different types of units of Player 1 die it will only count 1. (e.g. splash)

    And that there's no easy fix for it.
    There is an easy fix: wait for the next trigger cycle and it will decrement again. I think you've confused this scenario with kills-to-cash (or just kill score in general, or you missed the part where I'm subtracting 1 instead of setting to 0). There is no problem here with the scenario described, though it could be improved by using binary countoffs to calculate splash damage on the same cycle.




    Apr 16 2014, 5:58 pm Azrael Post #10



    Is it possible for people to suffer a large number of deaths within a short amount of time? If so, this system may not register a loss at the moment the player is supposed to lose, because it will still be busy subtracting deaths one at a time. This would give a player who should already be dead a significant opportunity to kill more enemy units, unfairly changing the outcome of the game.

    To account for this, you'd simply need to add more subtraction triggers. Looking at Roy's triggers, you would change this:

    Trigger
    Players
  • Player 1
  • Conditions
  • Current Player has suffered at least 1 deaths of [men].
  • Actions
  • Set Deaths for Current Player: Subtract 1 [men].
  • Set Score for Current Player: Add 1 custom.
  • Preserve Trigger

  • To this:

    Trigger
    Players
  • Player 1
  • Conditions
  • Current Player has suffered at least 1024 deaths of [men].
  • Actions
  • Set Deaths for Current Player: Subtract 1024 [men].
  • Set Score for Current Player: Add 1024 custom.
  • Preserve Trigger

  • Trigger
    Players
  • Player 1
  • Conditions
  • Current Player has suffered at least 512 deaths of [men].
  • Actions
  • Set Deaths for Current Player: Subtract 512 [men].
  • Set Score for Current Player: Add 512 custom.
  • Preserve Trigger

  • Trigger
    Players
  • Player 1
  • Conditions
  • Current Player has suffered at least 256 deaths of [men].
  • Actions
  • Set Deaths for Current Player: Subtract 256 [men].
  • Set Score for Current Player: Add 256 custom.
  • Preserve Trigger

  • Trigger
    Players
  • Player 1
  • Conditions
  • Current Player has suffered at least 128 deaths of [men].
  • Actions
  • Set Deaths for Current Player: Subtract 128 [men].
  • Set Score for Current Player: Add 128 custom.
  • Preserve Trigger

  • Trigger
    Players
  • Player 1
  • Conditions
  • Current Player has suffered at least 64 deaths of [men].
  • Actions
  • Set Deaths for Current Player: Subtract 64 [men].
  • Set Score for Current Player: Add 64 custom.
  • Preserve Trigger

  • Trigger
    Players
  • Player 1
  • Conditions
  • Current Player has suffered at least 32 deaths of [men].
  • Actions
  • Set Deaths for Current Player: Subtract 32 [men].
  • Set Score for Current Player: Add 32 custom.
  • Preserve Trigger

  • Trigger
    Players
  • Player 1
  • Conditions
  • Current Player has suffered at least 16 deaths of [men].
  • Actions
  • Set Deaths for Current Player: Subtract 16 [men].
  • Set Score for Current Player: Add 16 custom.
  • Preserve Trigger

  • Trigger
    Players
  • Player 1
  • Conditions
  • Current Player has suffered at least 8 deaths of [men].
  • Actions
  • Set Deaths for Current Player: Subtract 8 [men].
  • Set Score for Current Player: Add 8 custom.
  • Preserve Trigger

  • Trigger
    Players
  • Player 1
  • Conditions
  • Current Player has suffered at least 4 deaths of [men].
  • Actions
  • Set Deaths for Current Player: Subtract 4 [men].
  • Set Score for Current Player: Add 4 custom.
  • Preserve Trigger

  • Trigger
    Players
  • Player 1
  • Conditions
  • Current Player has suffered at least 2 deaths of [men].
  • Actions
  • Set Deaths for Current Player: Subtract 2 [men].
  • Set Score for Current Player: Add 2 custom.
  • Preserve Trigger

  • Trigger
    Players
  • Player 1
  • Conditions
  • Current Player has suffered at least 1 deaths of [men].
  • Actions
  • Set Deaths for Current Player: Subtract 1 [men].
  • Set Score for Current Player: Add 1 custom.
  • Preserve Trigger

  • Instead of only being able to convert 1 death into custom score every trigger cycle, this could convert 2047, allowing the maximum number of simultaneous deaths to be handled fairly. In other words, instead of only being able to process 12 deaths per second, this improvement can process 24564 deaths per second.

    If this is a melee-like map (with the potential for mass air units, or nuclear missiles), or if there are stacked minerals/geysers or Zerg burrowing (which allow for nearly unlimited units to occupy the same space), then the limit here should be 2047 to ensure your triggers always work as they're intended, when they're intended.

    There really isn't a reason to use less of these triggers, so it's better to err on the side of caution and make a few too many than one too few. If you want to make sure you're not adding unnecessary triggers, then just figure out the absolute maximum number of units which could ever die simultaneously (in the most extreme unlikely circumstance) and make sure your system can convert that many deaths every trigger cycle.

    Otherwise, just start at 1024 and go down to 1, as demonstrated above. There can never be more than 1700 units in a map, so being able to handle 2047 simultaneous deaths will always be sufficient.

    Edit:

    Quote from Roy
    it could be improved by using binary countoffs to calculate splash damage on the same cycle.

    Ninja'd :P




    Apr 17 2014, 5:57 am NudeRaider Post #11

    We can't explain the universe, just describe it; and we don't know whether our theories are true, we just know they're not wrong. >Harald Lesch

    Quote from Roy
    There is an easy fix: wait for the next trigger cycle and it will decrement again.
    Unfortunately not. Subtracting 1 deaths of men decrements all death counters of units belonging to men.
    So when you have 1 death of marine and 1 death of ghost it will subtract 2 deaths: 1 for marine, 1 for ghost.




    Apr 17 2014, 11:49 am Roy Post #12

    An artist's depiction of an Extended Unit Death

    Oh, in that case, the binary countoffs Azrael posted would be necessary to partially prevent that issue. You could use "Exactly" and not use binary to take care of the issue entirely.

    Post has been edited 1 time(s), last time on Apr 17 2014, 3:15 pm by Roy.




    Apr 17 2014, 3:11 pm Azrael Post #13



    I suppose if there's a possibility that different types of units will die simultaneously for the same player, then you'd want to handle each possible unit separately, instead of combining them with "[men]". Even if you needed a copy for every unit, it'd be easy to quickly do so by applying Farlap to the current system.

    Quote from Roy
    You could use "Exactly" and not use binary to take care of the issue entirely.

    This is also easy to do, using Ar3sgice's Trigger Duplicator. Just need to make sure you have a trigger for every value, up to the maximum number of simultaneous deaths possible for any given player (which in normal melee is 1698).

    Post has been edited 3 time(s), last time on Apr 17 2014, 3:35 pm by Azrael.




    Options
      Back to forum
    Please log in to reply to this topic or to report it.
    Members in this topic: None.
    [09:38 pm]
    NudeRaider -- Ultraviolet
    Ultraviolet shouted: NudeRaider sing it brother
    trust me, you don't wanna hear that. I defer that to the pros.
    [07:56 pm]
    Ultraviolet -- NudeRaider
    NudeRaider shouted: "War nie wirklich weg" 🎵
    sing it brother
    [2024-4-27. : 6:24 pm]
    NudeRaider -- "War nie wirklich weg" 🎵
    [2024-4-27. : 3:33 pm]
    O)FaRTy1billion[MM] -- o sen is back
    [2024-4-27. : 1:53 am]
    Ultraviolet -- :lol:
    [2024-4-26. : 6:51 pm]
    Vrael -- It is, and I could definitely use a company with a commitment to flexibility, quality, and customer satisfaction to provide effective solutions to dampness and humidity in my urban environment.
    [2024-4-26. : 6:50 pm]
    NudeRaider -- Vrael
    Vrael shouted: Idk, I was looking more for a dehumidifer company which maybe stands out as a beacon of relief amidst damp and unpredictable climates of bustling metropolises. Not sure Amazon qualifies
    sounds like moisture control is often a pressing concern in your city
    [2024-4-26. : 6:50 pm]
    Vrael -- Maybe here on the StarEdit Network I could look through the Forums for some Introductions to people who care about the Topics of Dehumidifiers and Carpet Cleaning?
    [2024-4-26. : 6:49 pm]
    Vrael -- Perhaps even here I on the StarEdit Network I could look for some Introductions.
    [2024-4-26. : 6:48 pm]
    Vrael -- On this Topic, I could definitely use some Introductions.
    Please log in to shout.


    Members Online: Oh_Man