Staredit Network > Forums > SC1 UMS Mapmaking Assistance > Topic: Detecting Infested Terran suicide attacks
Detecting Infested Terran suicide attacks
Jan 11 2012, 9:11 am
By: TF-  

Jan 11 2012, 9:11 am TF- Post #1

🤙🏾

This is weird, if an infested terran suicides then it doesn't get counted as a death in death counters. How would you detect this without EUD? Also it's not for a unique infested terran, so I can't use Bring.



🤙🏾

Jan 11 2012, 9:47 am Lanthanide Post #2



Only real options are Bring or Command. Are they player controlled or owned by the CPU?



None.

Jan 11 2012, 10:03 am TF- Post #3

🤙🏾

The CPU has them, they also respawn and there can be a lot of them, so this doesn't look good.

I just want them to play a specific imported wav when they die btw, without using a mod.



🤙🏾

Jan 11 2012, 10:33 am Lanthanide Post #4



Well it won't be particularly nice anyway, because sounds played via "Play Wave" are at 100% volume wherever the player is looking on the map. So you'll be able to hear the terrans 'dying' from anywhere.

Are they immortal or can they be killed by the player somehow? If they get killed by the player, do you want them to play your new sound?

Because this system will work. It needs 2 DCs, Current and Previous.
1. In triggers decreasing by the power of 2, give the infested terrans from the CPU player to P9-12 or another CPU player (doesn't matter, just some other player). Eg: player commands at least 16 terrans, give 16 terrans to [other player], player commands at least 8 terran, give 8 terrans to [other player], player commands at least 4 terran..., commands at least 2 terran..., commands at least 1 terran. Make enough of these triggers sufficient to cover all possible terrans on the field at once, if you can have a maximum of 48 then you'll need to go up to 32 (2 * largest trigger - 1 = maximum limit, eg 32 * 2 -1 = 63, which is bigger than 48).
2. In those same triggers above, add the number of terrans given in each trigger to Current DC.
3. After all terrans have been given, you'll end up with the original player commanding 0 terrans and the number of terrans they had in both Current and Store DCs.
4. Now have another set of triggers that work in powers of 2 to subtract DCs from both Current and Previous based on the DCs in Previous and Current. Eg previous is at least 16, current is at least 16: subtract 16 from previous, subtract 16 from current. Previous is at least 8, current is at least 8, subtract 8 from current, subtract 8 from previous. Do this all the way down to 1.
5. Now from the above, one or both of Current and Previous are now at 0. If they are both at 0, this means the number of terrans has not changed since the last time the algorithm was run. If Current is at least 1, it means the number of terrans has increased compared to Previous. If Previous is at least 1, it means the number of terrans in Current has decreased compared to previous: so we should play the special wav sound (or whatever other actions you wanted to take).
6. Set previous and current to 0.
7. Now use more powers of 2 triggers similar to #1 but giving the terrans back from [other player] to your original CPU player and add the number of terrans given in each trigger to Previous.

At the end of this run through the cycle, you'll have the number of terrans currently on the map stored in Previous, which will carry over to the next trigger cycle for the algorithm to use.

Note that this system isn't foolproof: if 3 terrans died since the last cycle, but we also created 5 more via triggers, then the net change will be +2 terrans and the trigger for the sound effect will not fire.

Note that when you're using Commands in subsequent triggers you need to clear the 'caching' of this data that Starcraft does. This can easily be done by adding an action such as Move Location to your trigger actions; it doesn't have to be any real or useful location movement at all, for example you can just do Move Location Anywhere to Map Revealer owned by Player 1 at Anywhere and it will be sufficient to clear out the cache. See this post by Heinerman for the gritty details: http://www.staredit.net/307127/

Post has been edited 2 time(s), last time on Jan 11 2012, 10:39 am by Lanthanide.



None.

Jan 11 2012, 6:30 pm TF- Post #5

🤙🏾

Quote from Lanthanide
Well it won't be particularly nice anyway, because sounds played via "Play Wave" are at 100% volume wherever the player is looking on the map. So you'll be able to hear the terrans 'dying' from anywhere.

Are they immortal or can they be killed by the player somehow? If they get killed by the player, do you want them to play your new sound?

Because this system will work. It needs 2 DCs, Current and Previous.
1. In triggers decreasing by the power of 2, give the infested terrans from the CPU player to P9-12 or another CPU player (doesn't matter, just some other player). Eg: player commands at least 16 terrans, give 16 terrans to [other player], player commands at least 8 terran, give 8 terrans to [other player], player commands at least 4 terran..., commands at least 2 terran..., commands at least 1 terran. Make enough of these triggers sufficient to cover all possible terrans on the field at once, if you can have a maximum of 48 then you'll need to go up to 32 (2 * largest trigger - 1 = maximum limit, eg 32 * 2 -1 = 63, which is bigger than 48).
2. In those same triggers above, add the number of terrans given in each trigger to Current DC.
3. After all terrans have been given, you'll end up with the original player commanding 0 terrans and the number of terrans they had in both Current and Store DCs.
4. Now have another set of triggers that work in powers of 2 to subtract DCs from both Current and Previous based on the DCs in Previous and Current. Eg previous is at least 16, current is at least 16: subtract 16 from previous, subtract 16 from current. Previous is at least 8, current is at least 8, subtract 8 from current, subtract 8 from previous. Do this all the way down to 1.
5. Now from the above, one or both of Current and Previous are now at 0. If they are both at 0, this means the number of terrans has not changed since the last time the algorithm was run. If Current is at least 1, it means the number of terrans has increased compared to Previous. If Previous is at least 1, it means the number of terrans in Current has decreased compared to previous: so we should play the special wav sound (or whatever other actions you wanted to take).
6. Set previous and current to 0.
7. Now use more powers of 2 triggers similar to #1 but giving the terrans back from [other player] to your original CPU player and add the number of terrans given in each trigger to Previous.

At the end of this run through the cycle, you'll have the number of terrans currently on the map stored in Previous, which will carry over to the next trigger cycle for the algorithm to use.

Note that this system isn't foolproof: if 3 terrans died since the last cycle, but we also created 5 more via triggers, then the net change will be +2 terrans and the trigger for the sound effect will not fire.

Note that when you're using Commands in subsequent triggers you need to clear the 'caching' of this data that Starcraft does. This can easily be done by adding an action such as Move Location to your trigger actions; it doesn't have to be any real or useful location movement at all, for example you can just do Move Location Anywhere to Map Revealer owned by Player 1 at Anywhere and it will be sufficient to clear out the cache. See this post by Heinerman for the gritty details: http://www.staredit.net/307127/

Oh man I was hoping it wouldn't get to binary countoffs, dunno if I'll use it for sure but thanks for this post.



🤙🏾

Jan 11 2012, 6:35 pm Gigins Post #6



If you have a spare player. Infesteds can be stacked if burrowed, so you just stack 1 infested for spare player per each created infested. Then have a trigger checking if the real player commands the most infesteds. If he does, kill 1 for spare player and play the sound. If you are able to kill them, have the trigger check for death counts as well. Easy 1-2 trigger win! :D

Edit: Errm, check if spare player has most instead of real one, sorry. :P

Post has been edited 1 time(s), last time on Jan 11 2012, 7:05 pm by Gigins.



None.

Jan 11 2012, 8:12 pm Lanthanide Post #7



Yeah, much simpler than my system. Mine can be adapted for other things though; I put it into my BPM map to check how much minerals you've spent since the previous trigger cycle (in fact I adapted it for counting the infested's).

Note that I believe "commands most of" will return true for both players if they are tied, eg if both players command 5 infested terrans then the trigger would fire and play the death sound, even though it shouldn't. But you could handle that by having the real player run it and set a switch and the spare player run it and use it's Most to also check the switch: if set they must be tied, if not then one must have died and you can play the sound.



None.

Jan 11 2012, 9:34 pm Gigins Post #8



It was just a wild guess, I've never actually worked with "command most" condition, so I had no idea how it would behave.

Edit: If it triggers for a tie, just have 1 less infested stacked, so it intentionally triggers for a tie. :D



None.

Jan 11 2012, 9:41 pm TiKels Post #9



You guys are on the right track, but you can detect this in one trigger.

Player 1 commands most infested terrans

create 1 infested terran for player two.

I forget but I believe sounds are per player, so you could create a switch per player that it's turned on when it's true, play the wav, undo switch. This will play on kill or death. Alternatively you can create another trigger with requirements deaths equals zero, and give the first one deaths equals at least one and the action set death equal to zero.

Having one more infested will happen automatically. It'd cause the game to start with the wav played once though. Preplace one infested terran to avoid this.



"If a topic that clearly interest noone needs to be closed to underline the "we don't want this here" message, is up to debate."

-NudeRaider

Jan 11 2012, 10:17 pm Gigins Post #10



Can't have 1 trigger because "command most" and "play sound" are both current player triggers.



None.

Jan 11 2012, 10:28 pm TiKels Post #11



I would have enumerated that in more detail but I'm on my phone. I said that to play wavs you'd need a trigger per player. I said you could DETECT in one trigger ;D



"If a topic that clearly interest noone needs to be closed to underline the "we don't want this here" message, is up to debate."

-NudeRaider

Jan 12 2012, 7:57 pm Gigins Post #12



But it doesn't work after all. The detection trigger fires more than once and the sound loops. Probably some "command most" specific issue.



None.

Jan 12 2012, 8:54 pm TiKels Post #13



Want me to take a look it.... alternatively you could post the relevant triggers. Your move. I think I remember something about infesteds adding to death count on the last few frames of its life... But I don't think that would change anything



"If a topic that clearly interest noone needs to be closed to underline the "we don't want this here" message, is up to debate."

-NudeRaider

Jan 12 2012, 9:12 pm Gigins Post #14



Besides hypers, there are 2 triggers, one that spawns 1 infested every 3 seconds and one that detects. For testing purposes, I used human player for stacking.

Edit: The trigger is this simple...
Trigger
Players
  • Player 1
  • Conditions
  • P1 commands most of infesteds
  • Actions
  • remove 1 infested for P1
  • play sound
  • preserve


  • Attachments:
    testmap.scx
    Hits: 1 Size: 50.52kb



    None.

    Jan 12 2012, 9:24 pm TiKels Post #15



    Perhaps it doesn't update constantly for some reason.

    Why would you test it in reverse? Try, just for the hell of it, doing it like it would happen ingame. I'd do it but I'm not quite home yet.



    "If a topic that clearly interest noone needs to be closed to underline the "we don't want this here" message, is up to debate."

    -NudeRaider

    Jan 12 2012, 9:30 pm Gigins Post #16



    What do you mean by reverse? I tried it with the 3rd player and shit, does the same.



    None.

    Options
      Back to forum
    Please log in to reply to this topic or to report it.
    Members in this topic: None.
    [01:39 am]
    Ultraviolet -- no u elky skeleton guy, I'll use em better
    [10:50 pm]
    Vrael -- Ultraviolet
    Ultraviolet shouted: How about you all send me your minerals instead of washing them into the gambling void? I'm saving up for a new name color and/or glow
    hey cut it out I'm getting all the minerals
    [10:11 pm]
    Ultraviolet -- :P
    [10:11 pm]
    Ultraviolet -- How about you all send me your minerals instead of washing them into the gambling void? I'm saving up for a new name color and/or glow
    [2024-4-17. : 11:50 pm]
    O)FaRTy1billion[MM] -- nice, now i have more than enough
    [2024-4-17. : 11:49 pm]
    O)FaRTy1billion[MM] -- if i don't gamble them away first
    [2024-4-17. : 11:49 pm]
    O)FaRTy1billion[MM] -- o, due to a donation i now have enough minerals to send you minerals
    [2024-4-17. : 3:26 am]
    O)FaRTy1billion[MM] -- i have to ask for minerals first tho cuz i don't have enough to send
    [2024-4-17. : 1:53 am]
    Vrael -- bet u'll ask for my minerals first and then just send me some lousy vespene gas instead
    [2024-4-17. : 1:52 am]
    Vrael -- hah do you think I was born yesterday?
    Please log in to shout.


    Members Online: Roy, Moose, IlyaSnopchenko