第一步:在include\constants\script_menu.h中添加新的多选择框的ID定义
#define MULTI_LILYCOVE_HEAL_WARP 115数字按顺序写,至于名字就随便了,按照你实际情况来写
第二步:在script_menu.h中添加多选择列表
首先在include\strings.h文件添加
extern const u8 gText_ChunYu[];
extern const u8 gText_Chenxi[];
extern const u8 gText_Wuye[];
extern const u8 gText_Luoxia[];
extern const u8 gText_HealParty[];然后在src\strings.c文件给上面定义的文本赋值
const u8 gText_ChunYu[] = _("春雨镇");
const u8 gText_Chenxi[] = _("晨曦镇");
const u8 gText_Wuye[] = _("午夜镇");
const u8 gText_Luoxia[] = _("落霞镇");
const u8 gText_HealParty[] = _("恢复队伍");在src\data\script_menu.h文件搜索这个表格:static const struct MultichoiceListStruct sMultichoiceLists[]
然后在末尾添加
[MULTI_LILYCOVE_HEAL_WARP] = MULTICHOICE(MultichoiceList_LilycoveHealWarp),添加多项选择框的实际内容,在src\data\script_menu.h这个文件任意处添加:
static const struct MenuAction MultichoiceList_LilycoveHealWarp[] =
{
{gText_HealParty},
{gText_ChunYu},
{gText_Chenxi},
{gText_Wuye},
{gText_Luoxia},
{gText_Exit},
};第三步:撰写脚本
示例:
LilycoveCity_HealPlayerParty_Scripts::
msgbox Rest_MSG MSGBOX_DEFAULT
closemessage
LilycoveCity_HealPlayerParty_Loop:
multichoice 20, 2, MULTI_LILYCOVE_HEAL_WARP, TRUE
compare VAR_RESULT, 0
goto_if_eq LilycoveCity_HealPlayerParty_Heal
compare VAR_RESULT, 1
goto_if_eq LilycoveCity_HealPlayerParty_WarpPetalburg
compare VAR_RESULT, 2
goto_if_eq LilycoveCity_HealPlayerParty_WarpSlateport
compare VAR_RESULT, 3
goto_if_eq LilycoveCity_HealPlayerParty_WarpRustboro
compare VAR_RESULT, 4
goto_if_eq LilycoveCity_HealPlayerParty_Exit
goto LilycoveCity_HealPlayerParty_Loop
LilycoveCity_HealPlayerParty_Heal:
fadescreen FADE_TO_BLACK
playfanfare MUS_HEAL
waitfanfare
special HealPlayerParty
setrespawn HEAL_LOCATION_LILYCOVE_CITY
fadescreen FADE_FROM_BLACK
goto LilycoveCity_HealPlayerParty_Loop
LilycoveCity_HealPlayerParty_WarpPetalburg:
fadescreen FADE_TO_BLACK
warp MAP_SLATEPORT_CITY, 28, 45
waitstate
fadescreen FADE_FROM_BLACK
end
LilycoveCity_HealPlayerParty_WarpSlateport:
fadescreen FADE_TO_BLACK
warp MAP_LITTLEROOT_TOWN, 29, 32
waitstate
fadescreen FADE_FROM_BLACK
end
LilycoveCity_HealPlayerParty_WarpRustboro:
fadescreen FADE_TO_BLACK
warp MAP_LAVARIDGE_TOWN, 4, 18
waitstate
fadescreen FADE_FROM_BLACK
end
LilycoveCity_HealPlayerParty_Exit:
end
Rest_MSG:
.string "有点累了,休息一下吧。$"脚本应该没啥需要特别解释的地方了,整体逻辑很简单。
如对本教程有其他问题,可以在评论区留言。
发表评论