User Tag List

Results 1 to 4 of 4

Thread: Simulating Trigger->SelfOnly with a script?

  1. #1
    Cor Blimey! CJC's Avatar
    Join Date
    Dec 2002
    Location
    Fading into the darkness
    Age
    35
    Posts
    1,398
    Mentioned
    150 Post(s)
    Tagged
    6 Thread(s)
    vBActivity - Stats
    Points
    6,621
    Level
    25
    vBActivity - Bars
    Lv. Percent
    1.37%

    Question Simulating Trigger->SelfOnly with a script?

    I know that ZC handles secrets by going from combo to combo, upper left to lower right, and replacing flagged combos with their secret combos.

    I do NOT, however, know how the Trigger->SelfOnly flag works.


    I'm brainstorming a trick to have multiple independent permanent secrets on the same screen by setting the secret screen state of layers affiliated with the screen (I'm doing this as a global script, fyi, so no "Place FFC here" instructions please!). I don't have any code yet, but here is my current plan:

    EDIT: Sleep is helpful! I figured out how to get it down to two loops, and I'll explain below the spoiler
    Spoiler: show
    Each time a ScreenChange is detected, the script will
    1. Reset the secret state of Layer 0. No permanent secrets are stored in layer 0 in this setup.
    2. Check the secret state of Layer 1. If it is set, proceed. If not, skip to 6.
    3. Cycle through all of the combos and store their flags in a 2d array while simultaneously checking for a specific flag on layer 1 (Let's call it SecretCheck1, despite the fact it will probably be Script 1).
      1. If SecretCheck1 is at that index in the loop, the Array stores a special flag instead of the combo's flag (We'll call this flag SecretTrigger1, even though it will likely be another script flag).
      2. If SecretCheck1 is NOT at that index in the loop, the Array stores the combo's inherent and placed flags and then sets both to 0.
    4. Triggers Screen Secrets.
    5. Cycle through all the combos again, this time simply replacing each combo's flags with those stored in the array.
    6. Repeat steps 2 through 5 for layer 2.
    7. Repeat step 6 for layers 3 through 6.


    What the heck does this do? Well, it triggers secrets only on combos that have the SecretCheck1 flag, and then triggers secrets only on combos that have the SecretCheck2 flag, and so on through layer six. Each only triggers if that section of secrets' associated layer state has been set to true.
    Now how do we go about setting that to true?

    Each frame, the screen cycles through all the combos looking for SecretTrigger1, SecretTrigger2, and so forth. If it finds it, the secret state of its corresponding layer is set to true. By simply tiering the SecretTrigger1 flag on top of the secret combo that corresponds to that secret, hitting the trigger makes the sought flag appear and thus records the secret on the layer.


    Here's the problem, though... this idea requires twelve cycles through all of the combos when changing screens, and an additional cycle through every frame (I need that for other reasons so I don't mind so much, but... the twelve at screen change could be problematic). If there is some more efficient way to trigger a secret on a single combo or a specified combo address? I'd like to know about it before I begin coding this monster.

    EDIT: Actually, if I move the check for secrets inside of the for-loop, I can get it down to two loop-throughs instead of 12 (Because the combos that have secrets would not be set to 0 on their flag, and thus would only require triggering secrets once). My new concern regards inherent flags: if I set the inherent flag of a combo, will it change all instances of that combo (X_X) or just the one at that point on that screen? I can avoid this problem too by not placing trigger flags in inherent slots, though that makes the screen setup more restrictive (Not for me, but perhaps for others who would want to use trigger flags inherently).

    Oh, and one more thing. If placing the "This is secret X" flags on layer 3, I gain a multitude of extra flags to use for the script since 3 does not have ground functionality (For instance, I could use any number of the push flags to identify secrets).



    If anybody has any answers to my dilemma, or if anybody has questions about what I'm trying to achieve, thank you in advance for your replies! Once I figure this out, I'll move on to expanding it for lock blocks.

  2. #2
    Admiral Zim's Avatar
    Join Date
    Oct 2012
    Posts
    388
    Mentioned
    9 Post(s)
    Tagged
    2 Thread(s)
    vBActivity - Stats
    Points
    1,702
    Level
    13
    vBActivity - Bars
    Lv. Percent
    83.69%
    Permanent triggers are easy.

  3. #3
    Admiral Zim's Avatar
    Join Date
    Oct 2012
    Posts
    388
    Mentioned
    9 Post(s)
    Tagged
    2 Thread(s)
    vBActivity - Stats
    Points
    1,702
    Level
    13
    vBActivity - Bars
    Lv. Percent
    83.69%
    You could use a Game scope SetComboAt for multiple locations.

  4. #4
    Cor Blimey! CJC's Avatar
    Join Date
    Dec 2002
    Location
    Fading into the darkness
    Age
    35
    Posts
    1,398
    Mentioned
    150 Post(s)
    Tagged
    6 Thread(s)
    vBActivity - Stats
    Points
    6,621
    Level
    25
    vBActivity - Bars
    Lv. Percent
    1.37%
    Thank you for the pointers, but I can't use Game->SetComboAt for this. The goal was to have it use the secret combos from THAT layer 0s' screen, for every screen in the quest. Since there's no way to collect the data on the secret combos (at least in a way that is accessible by ZScript), I have to create the effect through the engine by triggering the screen's secrets.


    But I've worked out a functional gameplan and I'm ready to start programming it. Essentially, the game looks for Script1-Script5 and Raft Bump flags on Layer 3 of each screen. It then checks if the secrets have been set on one of screen's layers (Layer 1 for Script1, Layer2 for Script2, and so forth). If the flag is there and the corresponding screen secret has been set, it leaves that combo location id alone, if not it stores the combo's placed flag and then sets that flag to 0. Then the screen triggers secrets. Since most of the flags have been removed, only the positions where the Script flags are located on Layer 3 AND where the specific storage layer's secret state has been set will change. The function will then replace the flags that it stored so this process can be repeated in the event of another trigger.

    It'll be much easier to explain once I've built the script and a prototype quest for it.

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
About us
Armageddon Games is a game development group founded in 1997. We are extremely passionate about our work and our inspirations are mostly drawn from games of the 8-bit and 16-bit era.
Social