PDA

View Full Version : Block Triggers/Secret Trigger



pkmnfrk
12-20-2007, 07:42 PM
Is there anyway to simulate a block being pushed onto a block trigger via script?

And/or a way to trigger secrets? No, "Game->CurMapFlag[MF_SECRET] = true" doesn't work.

ScaryBinary
01-06-2008, 12:32 AM
Unfortunately there's no "direct" way to trigger secrets on a screen...no built-in ZScript functions/calls (as of build 704, at least). However, there is a workaround that involves spawning an enemy and then immediately killing it -- you're essentially taking advantage of the Enemies -> Secret setting.

(This is how I do it...maybe someone else has a better way?)

First, setup your screen as you normally would (i.e., set up your Secret Combos, Secret Flags, etc.).

In the "Data > Screen Data" window, check the "Enemies -> Secret" setting.

Now you have to add an enemy to the screen - but you probably don't want it to be shown or in an area that Link will run into it. For these reasons, I create a new enemy (go to Quest > Enemies, scroll to the bottom and pick one of the "eXYZ" ones....I use e255), give it 1 hit point, and check the "Is Invisible" on the Flags 1 tab. ....So add it to your screen, and use Flag 37 to make sure the enemy is located somewhere where Link won't be able to run into it (in the mountains, right on a tree, basically somewhere unwalkable).

OK, your screen is set up. In your script, when you want to trigger the secret, add the following code:

// Get a reference to the enemy.
npc TriggerNPC;
TriggerNPC = Screen->LoadNPC(1);

// Now kill the enemy!
TriggerNPC->HP = 0;

Note that this is only guaranteed to work right if there aren't any other enemies on the screen already. I haven't figured out if you could actually create the enemy in the script (versus adding it to the screen and just referencing it in the script)...when I tried, the secrets triggered right away (because the Enemies -> Secret flag was set, and there weren't any enemies on the screen).

I've been messing with a similar problem recently. I wanted a "special" block puzzle to trigger a secret...It was very frustrating because it was a catch-22: I had to use the above method to trigger the secret, but with the enemy on the screen I couldn't push my blocks (thanks to the stupid Push-Wait combo)! :mad: The only way I could get around it was to use the Push-Heavy combo type for my push blocks, and just give Link the power bracelet. :rolleyes: Oh well. Maybe someone else has some ideas.

pkmnfrk
01-06-2008, 04:50 AM
The reason I asked was because I've created a Dominion Rod item that lets you take control of an FFC statue and walk it around. But, as it is, it's useless, as all it does is walk around. I wanted it so that if you place it on a specific spot, then the secrets trigger.

I'm open to any suggestions.

Polymorph
01-06-2008, 06:16 PM
Isn't there some way to check if it's colliding with a certain combo?
Or I suppose you can make an invisible FFC where the trigger is and check if the X and Y are within its range.

pkmnfrk
01-07-2008, 02:24 AM
Yes, and that's what I've done. However, there's still the issue of triggering secrets.

Gleeok
01-07-2008, 02:41 AM
Hmm...I can think of three possibilities;


-There's a bug that's not allowing Game->CurMapFlag[MF_SECRET] to be changed.

-What I'll usually do is use the enemies->secrets and stick the "dummy" npc at -16, -16, and then kill it when conditions are met.

-Or you could script the secrets instead of using zcs' built-in features.


Yeah, It would be easier with Game->CurMapFlag[MF_SECRET] = true; though.

DarkDragon
01-07-2008, 02:54 AM
Writing to Game->CurMapFlag[MF_SECRET] won't trigger secrets. That flag just records whether or not secrets have been triggered; it's just bookkeeping. So setting it will ensure that secrets *don't* get triggered in the future if they otherwise would have, but doesn't itself trigger secrets.

You'd need something like Screen->TriggerSecrets().

Gleeok
01-07-2008, 03:08 AM
Does that mean there is a ZASM for secrets, or that there isn't one and the unfinished read only stuff will wait for 2.6.

You know that's a good question. How much more of the features can be accessed using ZASM instead of zscript, or did I just make that up right now? :laughing:

DarkDragon
01-07-2008, 03:18 AM
There is no ZASM for it.