Staredit Network > Forums > SC1 UMS Mapmaking Assistance > Topic: Leaderboard Death Count Trigger Help
Leaderboard Death Count Trigger Help
May 26 2011, 4:58 am
By: IceKnight366  

May 26 2011, 4:58 am IceKnight366 Post #1



Hey guys!

I'm trying to create a game that has a Leaderboard death counter. For example, in MILES laser tag V8D, there is a kill counter in the top left corner of the screen. However, that counter also alternates between showing kills, 10ish seconds later it shows deaths, and than 10ish sec. later it shows kills again, etc etc... I figured out how to get the Kill Counter working (it's working fine), but not the death counter.

For the death counter, I am doing this:
Players:
All Players
Condition:
Always
Action:
Show leaderboard for most custom. Display label 'Deaths'

Players:
1,2,3...
Condition:
Current Player has suffered at least 1 death of [men].
Action:
Modify death counts for Current Player: Subtract 1 for [men].
Modify score for Current Player: Add 1 custom.

The Death scoreboard is showing up in the game, but it isn't counting the deaths. I then added "preserve trigger" to each and every new trigger (1 for every player + the 8 for all players 1-8 = 9) and it's still not working. It started to count 1 players deaths in a game, but it was only working for the 1 guy, not for anyone else.

Moreover, it wasn't alternating between kills and deaths :(. In MILES laser tag V8D, it would show kills for 10ish seconds, and than show deaths for 10ish seconds. In my game, the kill leaderboard has been over written with the new death leaderboard. So now only Deaths show (and they aren't even working yet lol). any hits?

Thanks Everyone!



None.

May 26 2011, 7:31 am Lanthanide Post #2



1st, does your trigger actually say "subtract 1 for [men]" or have you substituted your actual unit for the term [men]? [men] isn't a specific unit, but a group of units, eg everything that isn't a building, or a powerup, or a special unit etc.

If you are using ghosts, then you need something like this:
Condition: Current player has suffered at least 1 death of Terran Ghost
Action: Modify death counts for Current Player: Subtract 1 for Terran Ghost

If you are using ghosts, marines, hydralisks and ultralisks, then you're going to need 1 trigger for each of the different unit types that you are counting.


2nd, to alternate between score boards, you actually have to have triggers to do this. At the moment you are ALWAYS displaying the custom scoreboard, as per your first trigger. What you need to do is have different triggers to display different scoreboards.

Here's a cut-down example of triggers from my DS night map, where I have multiple scoreboards that alternate.

Trigger
Players
  • Player 8
  • Conditions
  • Always
  • Actions
  • Preserve trigger
  • Set Deaths("Current Player", "Cantina", Subtract, 1);
  • Trigger
    Players
  • Player 8
  • Conditions
  • Deaths("Current Player", "Cantina", Exactly, 86);
  • Actions
  • Preserve Trigger();
  • Leader Board Points("\x004 <--- \x017We spawn next", Custom);
  • Trigger
    Players
    None specified.
    Conditions
  • Deaths("Current Player", "Cantina", Exactly, 54);
  • Actions
  • Preserve Trigger
  • Leader Board Resources("\x004 <--- \x01fEconomy", ore);
  • Trigger
    Players
  • Player 8
  • Conditions
  • Deaths("Current Player", "Cantina", At most, 0);
  • Actions
  • Preserve Trigger
  • Set Deaths("Current Player", "Cantina", Set To, 87);


  • Note that Player 8 is a CPU player that is always present in my game. The 'show leaderboard' action is universal; only 1 player needs to own it, and all other players will see it. If you have only human players in your map, and can't guarantee that specific slots will always be filled, then you'll just have to use All Players. But if there is a player that always *must* be in the game, then simply give the 'show leaderboard' triggers to them. Also 'show leaderboard' is stick, as in once you run the trigger action, it will remain showing until you run an action to display a different leaderboard (as my 3rd trigger above does), or you disable the leaderboard - you don't need to run it constantly, hence why the 2nd and 3rd triggers use "exactly" 86 or 54 deaths of cantina for their conditions.

    Also, this is in the wrong forum. I'm sure it'll be moved to Map-making assistance once a moderator spots it.

    Post has been edited 5 time(s), last time on May 26 2011, 7:41 am by Lanthanide.



    None.

    May 26 2011, 8:37 am IceKnight366 Post #3



    Wow, thank you so much for the detailed response!

    As you can probably tell, I'm fairly new to map editing. I've been trying to read tutorials and such, but a lot of it just doesn't make sense to me. I've been experimenting with changing little things here and there for the last 3 days. Nothing seems to be working :'(.

    1) Yes, I am using [men] as the actual trigger. The reason is because there are about 15+ different units you can get killed by. So if I only put killed by "ghost", than doesn't that mean that only ghost deaths will be counted? So by putting [men] I was hoping that would just blanket the trigger and apply to all units. Do I really need to make a separate trigger for all 15 units? X_X.

    2) Wow, honestly, I don't know how you do that. I'm seriously overwhelmed by all the information you just game O_O. The triggers that you put in there don't really look like anything I've ever seen. It's particularly hard having to translate the triggers you used in your map over to the one I'm using in mine for a number of reasons.
    a) I'm not using any computers
    b) I'm not just displaying deaths, but kills as well
    c) I'm not sure why you are using "exactly 86/exactly 54 deaths)
    d) Why are you using cantina? The cantina isn't killing anyone, the human players are right?

    3) yes, that's correct, there are no CPU players in the map, they are all human players.

    I wasn't planning on doing this, but seeing how complicated it is, would you be able to take a look at the map and tell me what I need to specifically change? I know this is asking a lot... It's almost just overwhelming at this point (I've been trying to desipher what you wrong for the last hour and a half :(... If you are able to, I attached it to this message (I think hah)

    Attachments:
    MILES Laser Tag V100 FINAL1.scx
    Hits: 1 Size: 54.1kb



    None.

    May 26 2011, 1:00 pm NudeRaider Post #4

    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

    1) The disadvantage of using [men] is that subtracting 1 from [men] means that starcraft subtracts 1 from each unit type. So when a marine and a ghost died it will only add 1 to custom score. So it's really your call if you can live with that or if you want to do the repetitive way and do it properly.

    a) When your map doesn't have an active computer player you should probably declare 1 player slot as required and give all the global triggers (like leaderboard) to that player. Otherwise you'd have to give those triggers to All Players and make sure they are only actually run by one player which can be a real hassle if you don't know which player slots are occupied (else your timers would run way too fast, among other problems).

    b) He used "Economy" leaderboard (ore) instead of "Kills". Just pick another display leaderboard action.

    c+d) Cantina is an unused unit (can't die in the map, thus you have full control over it using triggers) that is used for data storage. In this case it's a simple counter for measuring the time when you want to swap your leaderboard. That's really all there is to it but here is an article that elaborates on how to use death counters as variables.




    May 27 2011, 10:42 pm IceKnight366 Post #5



    Thank you guys for all your help! I was able to figure out how to use the death counter with your help!!! There is only one problem I have now, my last thing. I'm trying to get the leaderboard death counter to alternate with the leaderboard kill counter. I want it to show kills for about 25 seconds, and than show deaths for about 10 seconds. This is where I am at right now:
    Trigger 1:
    Condition:
    -Countdown time is as most 0 game seconds.
    Action:
    -Modify countdown timer: set to 35 seconds
    -Preserve
    Trigger 2:
    Condition:
    -Countdown time is at least 1 game seconds.
    -Countdown timer is at most 25 game seconds.
    Actions:
    -Show leader Board for most kills of men. Display label: Kills
    Trigger 3:
    Condition:
    -Countdown time is at least 26 game seconds.
    -Countdown timer is at most 35 game seconds.
    Actions:
    -Show leader Board for most kills of men. Display label: Deaths

    With these triggers in place, I am successfully able to alternate between the two!! The only problem is, I want the game to have a countdown timer itself. I.e. I want there to be a clock at the top of the screen, when in game, with a two hour limit. But with the above triggers in play, there is already a 35 second clock at the top of the screen that repeats. And if I take away that 35 second clock, than I lose the triggers (they stop working) for alternating between kills & deaths.

    This is the last trigger I need for the game, any help would be awesome!!! Thank You guys!!!



    None.

    May 27 2011, 11:26 pm jjf28 Post #6

    Cartography Artisan

    Ok if i gather correctly

    you want to display deaths for 10 seconds,
    then display kills for 24 seconds
    (made them even so it works with the following)

    so basically you need a death counter to keep track of time...

    if you are not using hyper triggers a trigger cycle is about equal to 2 seconds, so 24 seconds = 12 trigger cycles and 10 seconds = 5 trigger cycles

    To accomplish timing you set a death counter to 17, and subract 1 death count each cycle till you hit 0, then you set it to 17 again (this takes 34 seconds). During this you set the leaderboard to display deaths when death counter is greater than or = to 12 (first 5 counts = first 10 seconds) and then display kills when death counter is less than or = to 11 (next 12 counts = next 24 seconds).

    in the following, TIMER is the unit you choose to keep track of deaths.
    Trigger
    Players
  • All Players
  • Conditions
  • Current player has suffered exactly 0 deaths of TIMER
  • Actions
  • Modify death count for current player: Set to 17 for TIMER
  • Preserve Trigger


  • Trigger
    Players
  • All Players
  • Conditions
  • Current player has suffered at least 6 deaths of TIMER
  • Actions
  • Show Leader Board DEATHS
  • Modify death count for current player: subtract 1 for TIMER
  • Preserve Trigger


  • Trigger
    Players
  • All Players
  • Conditions
  • Current Player has suffered at most 5 deaths of TIMER
  • Actions
  • Show leader board kills
  • Modify death count for current player: subtract 1 for TIMER




  • TheNitesWhoSay - Clan Aura - github

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

    May 28 2011, 12:28 am rockz Post #7

    ᴄʜᴇᴇsᴇ ɪᴛ!

    fyi, showing leaderboard deaths is possible, but not exactly newb friendly, as the leaderboard does not support showing deaths. You have to use extended units in the trigger.

    However, I would recommend doing it this way if all your "deaths" are stored in one death count. For example, if your laser tag only uses ghosts, there's no reason you shouldn't use "show leaderboard deaths". If you can use ghosts and marines and any other units, you can't use it, and should just stick to custom.

    Here's the triggers you posted with death timer, rather than a countdown timer:
    Trigger 0:
    Condition:
    always
    Action
    subtract 1 death from cantina
    Trigger 1:
    Condition:
    -Death timer (cantina) is as most 0.
    Action:
    -Modify death timer: set to 30
    Trigger 2:
    Condition:
    -death timer is exactly 20
    Actions:
    -Show leader Board for most kills of men. Display label: Kills
    Trigger 3:
    Condition:
    -death timer is exactly 30
    Actions:
    -Show leader Board for most kills of men. Display label: Deaths

    If you use hyper triggers, you'll need to multiply each death count by 12 per second, since hyper triggers run at 12 Hz. I use "exactly" because that means that the trigger will only fire at that time. It will never fire any other time, and you don't have to worry about triggers "skipping" or anything. No sense in spamming a trigger when you only need to run it once every few seconds. And I highly recommend you use hyper triggers in future maps.

    Leaderboards are global, so if one player runs it, it will show up on everyone's screen, even if they didn't run the trigger (again there are exceptions that are confusing which I won't go into). I suggest you use "current player" when possible and give the trigger to be owned by "all players". If you don't use current player, each player in the game will run it and it will go 8x faster than you expected, or glitch up.



    "Parliamentary inquiry, Mr. Chairman - do we have to call the Gentleman a gentleman if he's not one?"

    May 28 2011, 1:02 am IceKnight366 Post #8



    Quote from jjf28
    Ok if i gather correctly

    you want to display deaths for 10 seconds,
    then display kills for 24 seconds
    (made them even so it works with the following)

    so basically you need a death counter to keep track of time...

    if you are not using hyper triggers a trigger cycle is about equal to 2 seconds, so 24 seconds = 12 trigger cycles and 10 seconds = 5 trigger cycles

    To accomplish timing you set a death counter to 17, and subract 1 death count each cycle till you hit 0, then you set it to 17 again (this takes 34 seconds). During this you set the leaderboard to display deaths when death counter is greater than or = to 12 (first 5 counts = first 10 seconds) and then display kills when death counter is less than or = to 11 (next 12 counts = next 24 seconds).

    in the following, TIMER is the unit you choose to keep track of deaths.
    Trigger
    Players
  • All Players
  • Conditions
  • Current player has suffered exactly 0 deaths of TIMER
  • Actions
  • Modify death count for current player: Set to 17 for TIMER
  • Preserve Trigger


  • Trigger
    Players
  • All Players
  • Conditions
  • Current player has suffered at least 6 deaths of TIMER
  • Actions
  • Show Leader Board DEATHS
  • Modify death count for current player: subtract 1 for TIMER
  • Preserve Trigger


  • Trigger
    Players
  • All Players
  • Conditions
  • Current Player has suffered at most 5 deaths of TIMER
  • Actions
  • Show leader board kills
  • Modify death count for current player: subtract 1 for TIMER

  • So a couple questions.
    -Are the 3 triggers that you sent me going to conflict with the original two that I posted?
    -Since I am using "men" (I want deaths to be counted of every unit in game), TIMER = men correct?

    I'm going to start working on this right now!



    None.

    May 28 2011, 1:19 am jjf28 Post #9

    Cartography Artisan

    you would have to remove your original triggers to use what i posted. (you can add a "never" condition if you don't want to remove them yet but want to test mine)

    and TIMER is any unit (You can select it!) ie: Terran Civilian


    (but it should not be a unit that has a possibility of dieing during the game)



    TheNitesWhoSay - Clan Aura - github

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

    May 28 2011, 10:04 pm IceKnight366 Post #10



    I've been messing around with it, and it's really messed up now :'(. I "never" and "disabled" those three triggers that I previously had, and implemented yours word for word. What I have now is now:

    1) It no longer alternates between deaths and kills, but stays ONLY on Deaths.
    2) The death count is increasing constantly by 17 deaths every second, and it makes no difference if you kill someone or not, the deaths are not counted.
    3) The minerals are increasing rapidly (I'd say as fast as milliseconds count on a stop watch that is counting down).

    What the heck did I do? If anyone would be willing to take a look at the triggers and tell me what I need to change that would be so great...

    Edit: gah, and the game keeps crashing whenever it lasts longer than 20 minute (4) :'(

    Attachments:
    MILES Laser Tag V100 FINAL1.scx
    Hits: 2 Size: 54.61kb

    Post has been edited 1 time(s), last time on May 29 2011, 3:24 am by Roy. Reason: Don't double-post



    None.

    May 29 2011, 2:00 am jjf28 Post #11

    Cartography Artisan

    at first glance i see that you used "at least" in the first trigger, so when deaths of TIMER are at least 0, it's setting the deaths to 17, so it'll always be 17.

    Next you used [men] as TIMER, which won't work, change [men] in my triggers to Mining Platform

    another note, putting (disabled) in front of conditions does nothing, all you need is the Never condition


    you are using rapid triggers, so you'll need to set the deaths significantly higher to get the desired effect, h/o i'll get the math...


    Edit: should work now

    Attachments:
    MILES Laser Tag V100 FINAL1.scx
    Hits: 2 Size: 55.84kb

    Post has been edited 4 time(s), last time on May 29 2011, 2:18 am by jjf28.



    TheNitesWhoSay - Clan Aura - github

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

    May 29 2011, 6:18 am Wormer Post #12



    Just a small addition. Disabled conditions and actions are skipped during trigger execution. Conditions are always checked starting from the top of the list heading to the bottom until one of them returns false or the end of the list is reached; when conditions list have finished and none of conditions returned negative answer SC executes trigger actions. The purpose of the Never condition is to always be negative (in contrary to Always which is always positive). When you disable Never SC skips it during execution so it doesn't return false and hence, doesn't interrupt the trigger.

    Then, 1 trigger cycle on fastest is equal to 84 milliseconds. Hence, on fastest 1 real time second (and no, "Elapsed time" counts game seconds not the real ones) approximately equals to 12 trigger cycles (11,91... to be more precise but who cares?). So you need to multiply all values by 12.



    Some.

    May 30 2011, 6:30 pm IceKnight366 Post #13



    Quote from jjf28
    at first glance i see that you used "at least" in the first trigger, so when deaths of TIMER are at least 0, it's setting the deaths to 17, so it'll always be 17.

    Next you used [men] as TIMER, which won't work, change [men] in my triggers to Mining Platform

    another note, putting (disabled) in front of conditions does nothing, all you need is the Never condition


    you are using rapid triggers, so you'll need to set the deaths significantly higher to get the desired effect, h/o i'll get the math...

    Edit: should work now

    Wow, thank you jjf28.. It finally works! Hah, man I've been working on it for like a week lol. Now it doesn't have that problem where the game crashes!. I think you're right, it was probably because the deaths weren't set "significantly higher" like you said. If I want to plan on making the game 2+ hours long, should I raise them even higher? like 200, 200,199, or something?

    Thank you everyone! AWESOME!!!



    None.

    May 30 2011, 8:18 pm NudeRaider Post #14

    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

    When you're using hyper triggers triggers are checked 16 times as fast. 16 x 17 = 272

    Post has been edited 1 time(s), last time on May 30 2011, 10:06 pm by NudeRaider.




    May 30 2011, 8:25 pm Wormer Post #15



    Quote from NudeRaider
    When you're using hyper triggers triggers are checked 16 times as fast. 6 x 17 = 102
    Nude... http://code.google.com/p/bwapi/wiki/StarcraftGuide#What_is_Starcraft%27s_frame_rate?
    12 cycles = 1 second. He wants 17 seconds. 12*17=204. What's wrong?



    Some.

    May 30 2011, 10:09 pm NudeRaider Post #16

    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 Wormer
    What's wrong?
    For some reason I first wrote 16 times and then only used 6 times in the equation. lol
    >> Fixed

    Btw. My time is game time, Wormer's is real time, in case you're wondering why we have different results.
    I recommend using game time for measurements as it is a) exact and b) independent from game speed.




    May 31 2011, 4:48 am rockz Post #17

    ᴄʜᴇᴇsᴇ ɪᴛ!

    Game time = 16 frames per second
    "Normal" = 15 frames per second
    "Fastest" = 24 frames per second
    Hyper triggers = 1 per 2 frames

    So it's 12 for fastest, 8 for game time, 7.5 for normal.



    "Parliamentary inquiry, Mr. Chairman - do we have to call the Gentleman a gentleman if he's not one?"

    May 31 2011, 7:04 am Wormer Post #18



    Quote from NudeRaider
    Btw. My time is game time, Wormer's is real time, in case you're wondering why we have different results.
    I recommend using game time for measurements as it is a) exact and b) independent from game speed.
    Ah that. I would recommend using real time for representation of information to the player like showing text or flipping leaderboard, since there is usually only one game speed independent optimal solution for these (because man's ability to perceive doesn't depend on the game speed). And for the overwhelming majority of the other cases I support Nude. (This doesn't really matter much though, since people usually play on fastest, but still.)



    Some.

    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