Staredit Network > Forums > SC1 UMS Theory and Ideas > Topic: Concept: dodge mechanic via triggers
Concept: dodge mechanic via triggers
Aug 14 2020, 7:41 pm
By: FullMetalSnorlax  

Aug 14 2020, 7:41 pm FullMetalSnorlax Post #1

A hungerer of forbidden knowledge

So I have a wild idea, and I'm wondering if someone more experienced with the mechanics of SC1 Tiggers can give me a quick answer to this theory before I start testing it.

I want to give a unit a chance to dodge enemy attack by having it briefly turn invulnerable during each trigger cycle. I wont be using hyper triggers as I NEED the wait function for my map to work, so I want to start a trigger cycle with the unit becoming invulnerable and end the trigger cycle with the unit losing invulnerability. How many frames can I expect the unit to be invulnerable for? Will the duration be effected by the number of triggers I have on the map?



None.

Aug 15 2020, 4:14 am DarkenedFantasies Post #2

Roy's Secret Service

The game is effectively frozen when triggers are executed, so turning a unit's invincibility on and off during the same trigger cycle won't achieve anything. You could do the following:

Toggle invincibility for unit
Wait 0
Toggle invincibility for unit
Preserve trigger

This will turn the unit invincible for 2 frames. However you'll run into issues with wait blocks and/or the trigger firing at inconsistent intervals as waits from other players are ran. The latter case also goes for other triggers on preserve without waits.

You'll have a much easier life with hypers and death counters. Waits aren't precise to the millisecond, so you'll incur practically no loss in timing precision unless for some reason you need a delay to be consistent across all game speeds or need it to be exactly 1 frame longer than you'd have with death counters. Both of those cases can be remedied with EUDs, if using those is acceptable to your project.




Aug 15 2020, 5:48 am FullMetalSnorlax Post #3

A hungerer of forbidden knowledge

The game is effectively frozen when triggers are executed

Thanks that's really good to know. I can't use it right now but I'll keep your solution in mind for a future project.

I'm currently running a trigger that makes a very long wait so that the player can trigger an action by pressing the escape key, so wait blocks are certainly an issue.



None.

Aug 15 2020, 5:48 am Oh_Man Post #4

Find Me On Discord (Brood War UMS Community & Staredit Network)

In my RPG I had an Evasion statistic that did exactly this, turn invulnerability on and then off again after a short period. It used death counters as the timer for the invulnerability.




Aug 18 2020, 3:04 pm Roy Post #5

An artist's depiction of an Extended Unit Death

Quote from FullMetalSnorlax
I wont be using hyper triggers as I NEED the wait function for my map to work, so I want to start a trigger cycle with the unit becoming invulnerable and end the trigger cycle with the unit losing invulnerability.
Could you instead just emulate this wait time? If you need the exact behavior, it'd be something like this (adjusting the timer from 20 to whatever number you deem an appropriate time):

Non-Hypered Trigger
Players

  • <Players>
  • Conditions

  • Player 8 has suffered exactly 0 deaths of Cantina.
  • <Other Conditions>
  • Actions

  • Set Switch 69.
  • <Actions>


  • Timer Reset
    Players

  • Player 8
  • Conditions

  • Switch 69 is set.
  • Actions

  • Modify death counts for Player 8: Set to 20 for Cantina.
  • Clear Switch 69.
  • Preserve Trigger.


  • Timer
    Players

  • Player 8
  • Conditions

  • Always.
  • Actions

  • Modify death counts for Player 8: Subtract 1 for Cantina.
  • Preserve Trigger.


  • Hyper Trigger
    Players

  • All Players
  • Conditions

  • All Players has suffered exactly 0 deaths of Cave.
  • Actions

  • Modify death counts for Current Player: set to 1 for Cave.
  • Wait for 0 milliseconds.
  • Modify death counts for Current Player: set to 0 for Cave.
  • Wait for 0 milliseconds.
  • Preserve trigger.


  • Quote from FullMetalSnorlax
    How many frames can I expect the unit to be invulnerable for?
    Without hypers, however many frames cover 2 game seconds per cycle. With hypers, 2 frames per cycle.

    Quote from FullMetalSnorlax
    Will the duration be effected by the number of triggers I have on the map?
    No.




    Aug 18 2020, 10:03 pm Moose Post #6



    Quote from FullMetalSnorlax
    I wont be using hyper triggers as I NEED the wait function for my map to work
    I'm curious what you think you need waits for. You may not want to convert your waits over to DC-based hypers, but it's probably what you should do.

    Quote from FullMetalSnorlax
    I want to start a trigger cycle with the unit becoming invulnerable and end the trigger cycle with the unit losing invulnerability. How many frames can I expect the unit to be invulnerable for?
    Zero.

    Quote from FullMetalSnorlax
    Will the duration be effected by the number of triggers I have on the map?
    No, it would stay zero.

    If you properly implemented it with waits, the answer is still no. If the map has trigger lag (almost certainly due to other triggers), you may get a longer real (wall clock) time but the same game time, as in number of frames. Triggers to implement this invincibility toggle should not introduce trigger lag.

    Post has been edited 1 time(s), last time on Aug 19 2020, 12:12 am by Moose.




    Aug 19 2020, 2:14 am Ultraviolet Post #7



    Quote from Moose
    Quote from FullMetalSnorlax
    I wont be using hyper triggers as I NEED the wait function for my map to work
    I'm curious what you think you need waits for. You may not want to convert your waits over to DC-based hypers, but it's probably what you should do.

    I wondered this, too. Nobody needs waits. It's just a lazy solution that creates all sorts of problems, imo.




    Sep 21 2020, 6:25 am Oh_Man Post #8

    Find Me On Discord (Brood War UMS Community & Staredit Network)

    We can all blame Blizz for making a dumb triggger that can hang the whole game resulting in us having to use DC workarounds. :bleh:




    Today, 3:50 am Flemy Post #9

    xd pooop

    Issue with giving Invincibility to a unit is that it breaks agro. Depending on how you structure your unit stats, you can easily replace invincibility with giving 255 armor for a while, granted you use EUD. If you don't then you could substitute it with giving units 255 shield upgrades and giving the Protoss unit 100% shields when it has 0 shields.



    hey its me :)

    Options
      Back to forum
    Please log in to reply to this topic or to report it.
    Members in this topic: None.
    [04:06 pm]
    Wing Zero -- rage
    [2020-9-27. : 1:50 am]
    Ultraviolet -- :wob:
    [2020-9-26. : 8:52 pm]
    NudeRaider -- good. gooooood.
    [2020-9-26. : 4:45 pm]
    Wing Zero -- Rage
    [2020-9-26. : 3:13 pm]
    Suicidal Insanity -- Wing Zero
    Wing Zero shouted: Demon stop taking my box I'm bout to rage
    I ensured he couldn't
    [2020-9-25. : 6:21 pm]
    NudeRaider -- well he's not wrong ;)
    [2020-9-25. : 5:41 pm]
    jjf28 -- the video meme master
    [2020-9-25. : 5:39 pm]
    sraw531 -- who are you to say what meme I intended>
    [2020-9-25. : 3:14 am]
    jjf28 -- sraw531 wrong meme, https://youtu.be/jZ6nF6JKtRc
    [2020-9-24. : 9:39 pm]
    sraw531 -- NudeRaider
    NudeRaider shouted: dont repress your anger. come to the dark side!
    https://www.youtube.com/watch?v=N3Zj-hMEL-k
    Please log in to shout.


    Members Online: Roy, Shadowxdrone