Read-only archive of the Armageddon Games Forums Archive (2000–2026) · About this archive

[ZScript] Game->SetMapFlag() ???

3 replies · 1,201 views · Started 08 June 2007

This comes from my attempt to reproduce the "level-1-locked-door-opens" bug in the original NES LoZ. What's supposed to happen is, after entering level 1 and then exiting, the first locked door should become a passage, without using a key.

So I wrote a script (in build 357) to try this out. Here it is, sort of:

import "std.zh"

bool bug_active = false;

// this ffc to be placed on screen 37 of the overworld
ffc script eagle_bug_ext{
void run()
{
if(bug_active)
{
// remove the door
Game->SetMapFlag(dmap1, screen73, MF_DOORUP, false);
Waitframe();
// add it back
Game->SetMapFlag(dmap1, screen73, MF_DOORUP, true);
Quit();
}
else
{
Waitframe();
}
}
}

// this ffc to be placed on screen 73 of level 1
ffc script eagle_bug_int{
void run()
{
bug_active = true;
Quit();
}
}

Well, I tried many different calls of Game->SetMapFlag(), and I could not get it to compile. I see in the documentation that the function takes three arguments: int dmap, int flag, bool value. So, if I try to compile code with

Game->SetMapFlag(1, MF_DOORUP, false);
in it, I get a T21 error:
TMP, LINE 11: ERROR T21: COULD NOT MATCH TYPE SIGNATURE SETMAPFLAG(GAME, FLOAT, FLOAT, BOOL).

So, why does it put GAME as the first parameter of SetMapFlag()? And why does it expect floats? (Or is this irrelevant)

Also, from a limitation point of view: Is this even what I want? Is there any way to set what doors there are in dungeons? SetMapFlag() doesn't even accept screen as a parameter, so what exactly are the MF_DOOR... constants for? Are the "map" flags actually dmap flags?

😕

Much confusion abounds.

There are multiple issues here:
1) Game->SetMapFlags is just plain broken. It should take a map (not dmap) and a screen. Fixed in the next build.
2) Screen numbers are displayed in ZQuest in hexadecimal; you should thus use 0x73 instead of 73 as the screen number.
3) MF_DOORUP doesn't actually do anything anymore, as the door code has been separated into its own set of flags at some point. I've removed these deprecated flags from std.zh to avoid future confusion.

So you can't yet manipulate doors inside of dungeons... though that is certainly a scripting future which will be introduced in the future.