PDA

View Full Version : Simulating Trigger->SelfOnly with a script?



CJC
03-30-2014, 11:36 PM
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=-
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.

Zim
04-01-2014, 02:00 AM
Permanent triggers are easy.

Zim
04-01-2014, 02:02 AM
You could use a Game scope SetComboAt for multiple locations.

CJC
04-01-2014, 12:52 PM
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.