To make the mapflag usable with @mapflag, open atcommand.c, ACMD_FUNC(mapflag) and add it to the list of existing flags:
checkflag(nousecart); checkflag(noitemconsumption); checkflag(nosumstarmiracle); checkflag(nomineeffect);
checkflag(nolockon); checkflag(notomb); checkflag(nocostume); checkflag(gvg_te);
checkflag(gvg_te_castle); checkflag(newmapflag); checkflag(newmapflag2);
...
setflag(nousecart); setflag(noitemconsumption); setflag(nosumstarmiracle); setflag(nomineeffect);
setflag(nolockon); setflag(notomb); setflag(nocostume); setflag(gvg_te);
setflag(gvg_te_castle); setflag(newmapflag); setflag(newmapflag2);
To make the mapflag readable from a script, you'll have to add the flag as a constant first:
Go in script.c, search for "MF_NOTOMB" and add your flag at the end of the list, such as:
MF_NOTOMB,
MF_SKILL_DAMAGE, //60
MF_NOCOSTUME,
MF_GVG_TE_CASTLE,
MF_GVG_TE,
MF_NEWMAPFLAG = 100, // Custom flags
MF_NEWMAPFLAG2, // Custom flags
};
and then add it as a script constant. Open script_constants.h and add
export_constant(MF_NOTOMB);
export_constant(MF_SKILL_DAMAGE);
export_constant(MF_NOCOSTUME);
export_constant(MF_GVG_TE_CASTLE);
export_constant(MF_GVG_TE);
export_constant(MF_NEWMAPFLAG); // Custom flags
export_constant(MF_NEWMAPFLAG2);
Now you'll have to add the mapflag to the map structure, so go in map.h:
unsigned nocostume : 1; // Disable costume sprites [Cydh]
unsigned newmapflag : 1; // Custom flag
unsigned newmapflag2 : 1; // Custom flag2
unsigned gvg_te : 1; // GVG WOE:TE. This was added as purpose to change 'gvg' for GVG TE, so item_noequp, skill_nocast exlude GVG TE maps from 'gvg' (flag &4)
unsigned gvg_te_castle : 1; // GVG WOE:TE Castle
#ifdef ADJUST_SKILL_DAMAGE
unsigned skill_damage : 1;
#endif
} flag;
You have to make it so that the script engine can read your flag, so go in npc.c and ctrl-f "nowarp":
else if (!strcmpi(w3,"noteleport"))
map[m].flag.noteleport=state;
else if (!strcmpi(w3,"nowarp"))
map[m].flag.nowarp=state;
else if (!strcmpi(w3,"newmapflag"))
map[m].flag.newmapflag=state;
else if (!strcmpi(w3,"newmapflag2"))
map[m].flag.newmapflag2=state;
else if (!strcmpi(w3,"nowarpto"))
map[m].flag.nowarpto=state;
You should now be done, but if you want to make your flag work with the getmapflag/setmapflag/removemapflag script commands, you'll have to edit script.c:
//BUILDIN_FUNC(getmapflag)
case MF_NEWMAPFLAG: script_pushint(st,map[m].flag.newmapflag); break;
//BUILDIN_FUNC(setmapflag)
case MF_NEWMAPFLAG: map[m].flag.newmapflag = 1; break;
//BUILDIN_FUNC(removemapflag)
case MF_NEWMAPFLAG: map[m].flag.newmapflag = 0; break;
Now you can use your mapflag in the source with (map[m].flag.newmapflag) { ... }
Good luck ;O!