Odd/Even day events

Discussion in 'Custom Content' started by Hezablak, Mar 29, 2019.

  1. Hezablak

    Hezablak Tentacle Wrangler

    I have been trying to create a series of events that can count odd and even days. After using some mathematical logic, I came up with a series of three events that can turn a flag on and off every other day to signal even and odd without having to have the current day as a condition.

    This would be useful if you want something on your map to happen every other day. FOR example Advanced Wars Laser cannons that charge on odd turns and shoot on even ones. Prior the only way to do it is if you signify which days 2, 4, 6, 8, 10, etc. for an event to happen.

    The events have to be sequenced in this specific order in your trigger page, since triggers are executed top to bottom. This prevents us from having 2 events that say (if flag off turn flag on), and (if flag on turn flag off.) The flag will always resort to which ever event is listed last. Here are the three events. You also need two flags.

    Flags:
    Even default true
    Turn default true

    Trigger Name: 1
    When: Repeat

    Players: Player 1

    Conditions:
    -At the end of the turn.
    -Is it Player 1's turn?
    -Is map flag Even true?
    -Is map flag Turn true?

    Actions:
    Set Map Flag Even to false.
    Set Map Flag Turn to false.

    Trigger Name: 2
    When: Repeat

    Players: Player 1

    Conditions:
    -At the end of the turn.
    -Is it Player 1's turn?
    -Is map flag Even false?
    -Is map flag Turn true?

    Actions:
    Set Map Flag Even to true.

    Trigger Name: 3
    When: Repeat

    Players: Player 1

    Conditions:
    -At the end of the turn.
    -Is it Player 1's turn?
    -Is map flag Even false?

    Actions:
    Set Map Flag Turn to true.

    After these three events, you can create any event with the Is Map Flag Even true/false as a condition.
    On even days that event can happen and on odd it can't. (And vice versa) (All other events will not matter where they fall in the sequence of triggers as long as these 3 are one after the other in order.)

    Also, you can use this to trigger things every other time something happens. Unit lost, Unit end turn, player end turn, etc... You just have to figure out what conditions you want to change.

    If you want to do the math to figure out why it works, I suggest you do! My next challenge will be to create events that happen every 3 or 4 or n days at a time.
     
    • Lyle Drake

      Lyle Drake Scruffy Nerf-Herder

      just use a counter instead, it's way easier.

      Counter:
      TurnCounter; default 0


      event:
      at the start of each turn
      if it's the first's turn
      if TurnCounter is exactly 2(or whatever number you want)

      Turncounter: set to 0


      event:
      At the start of each turn
      If it's player 1's turn

      TurnCounter: add 1



      The counter is increased by one each turn, and when it reaches the number you want it to loop at, it's set to 0 before being increased, meaning it becomes 1.

      It's really that simple. You could hook up any number of events and have a different one trigger each turn, then have them repeat themselves.
       
        Hezablak likes this.
      • Hezablak

        Hezablak Tentacle Wrangler

        Yeah, I just realized the counter method this week. Could use for different multiples as well. Finally playing around with for loops using two counters.
        The only thing I don't like is that event checks do not happen repeatedly(constantly might be a better word), so you can't make real loops. Is there a way to make event checks constantly?
         
        • Lyle Drake

          Lyle Drake Scruffy Nerf-Herder

          As far as i can tell, the events are checked:
          -at the start of each turn
          -after a unit moves
          -and at the end of each turn

          i've tried, but so far i haven't been able to find a way to cause events to trigger outside of those three times.
          it's really annoying when you try to spawn a massive army of, like, 30 units, you got to create 30 seperate actions, manually inserting each unit type and location every single time, because of course there's no copy/paste system either :zzz:
          It's a pretty crude custom content creator, tbh. At least it's incredibly user friendly.
           
            Hezablak likes this.
          • Hezablak

            Hezablak Tentacle Wrangler

            I came to the same conclusion with the event checks.
            I was thinking of literally having a team that acts as a loading phase. Algorithm:
            Team 1 has 30 units at bottom of map walled off that each move.
            Have a "looping" set of events that repeat each time one of them move.
            Despawn team 1.

            Yes this isn't aesthetically pleasing, but can do a 1 time spawn in. Not so useful for events that have to loop during a match though...
             

            Share This Page