0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

GOKI2で広げるゲーム性【ModSLG入門】第一弾:シミュレーションゲームの基礎構築とUIレイアウト

0
Last updated at Posted at 2026-04-24

ダウンロード

avalanches&goki2は以下サイトのリリースタグ(Avalanches(GOKI2) Release version 2.x.y.yという表記)からAssetsにあるAvalanches-GOKI2-Release2.x.y.y.zipのリンクから最新の環境をダウンロードできます。

slgモジュール

goki2ではmodslgがslgを実装しています。
まずはモジュールを読み込みます。

; シミュレーションゲーム機能
@load_module name=modslg

これでslgが組み込まれました。

まずはチップデータを読み込みます。

; チップデータ読み込み
@slgmapchip storage=mapchips.chp

slgmapchipタグでマップチップに関する情報を読み込みます。
このファイルにはSLGエディタのマップチップウインドウで設定したマップチップの情報が保存されています。

続けてパラメータに関する設定を行います。

@slgconfig hp=hp sp=sp

hpとspパラメータの名前を指定します。
ここで指定する名前はslgエディタのキャラクタ→パラメータ定義で定義できる名前です。

アイテムとスキルの所持数を定義します。

@slgconfig item_max_count=6 skill_max_count=6

ここは見たまんまです。
最大数を指定しています。
ここで指定した数だけアイテム/スキルを所持できます。

続けて、ゲームオーバー時に実行するシナリオとラベルを指定します。

@slgconfig game_over_storage=gameover.gs game_over_label=*gameover

ゲームオーバーになった時に、ここで指定されたシナリオにジャンプします。

所持金を指定する事もできます。

@slgconfig money=10000

敵の数が指定数以下になった場合にジャンプするシナリオも指定できます。

@slgconfig enemy_count=0 enemy_count_label=*enemy_count

続けて、効果音を指定します。

@slgconfig sound_buffer=0 enter_sound=se002.ogg
@slgconfig cursor_sound_buffer=0 cursor_enter_sound=se002.ogg

再生するバッファ番号(modSoundのバッファ数未満の値)と再生する効果音のファイル名を指定します。
クリック時やマウスが離れた時に再生する効果音などが指定できます。

以下が、bgmの指定です。

@slgconfig bgm_storage=bgm001.ogg battle_bgm_storage=bgm002.ogg

通常再生するbgmと戦闘時のbgmが指定できます。

更に続けて、マップを読み込みます。

@slgloadmap storage=test2.map

これでマップが読み込まれました。

続けて、各カーソルを読み込みます。

@slgloadcursor storage=mapcursor moving=movingcursor attack=attackcursor item=itemcursor skill=skillcursor talk=talkcursor

通常時のカーソルなどが指定できます。

@slgloaditem item_storage=item weapon_type_storage=weapontype
@slgloadskilldef storage=skilllist
@slgloadclassdef storage=classdata

各種定義を読み込みます。
アイテムや武器種別などの必要な情報を読み込みます。

続けて、キャラクターを読み込みます。

@slgloadcharacter storage=chardata.chr character_type=player icon_storage=ハロ_icon
@slgloadcharacter storage=player1.chr character_type=player icon_storage=ハロ_icon
@slgloadcharacter storage=player2.chr character_type=player icon_storage=ハロ_icon
@slgloadcharacter storage=player3.chr character_type=player icon_storage=ハロ_icon
@slgloadcharacter storage=player4.chr character_type=player icon_storage=ハロ_icon
@slgloadcharacter storage=maxplayer.chr character_type=player icon_storage=ハロ_icon
@slgloadcharacter storage=ゲームマスター.chr character_type=player icon_storage=ハロ_icon
@slgloadcharacter storage=villan.chr character_type=enemy icon_storage=villan_icon
@slgloadcharacter storage=villan2.chr character_type=enemy icon_storage=villan_icon
@slgloadcharacter storage=villan3.chr character_type=enemy icon_storage=villan_icon
@slgloadcharacter storage=villan4.chr character_type=enemy icon_storage=villan_icon
@slgloadcharacter storage=maxvillan.chr character_type=enemy icon_storage=villan_icon
@slgloadcharacter storage=npc.chr character_type=npc icon_storage=npc_icon

キャラクターデータとプレイヤーか敵かnpcかを指定できます。
他には各種キャラクターにアイコン(マップ上に表示される)を指定します。
この後、キャラクターを配置する事でキャラクターが表示されるようになります。
が、今回の解説の範囲では配置はまだ行わないのでまだ表示できません。

続けて、マップチップの表示設定を行います。
これは先ほど、slgmapchipタグで読み込んだチップデータの情報を表示するための設定です。

@slgmapstatus visible width=200 height=120
@slgmapstatus caption_value_left=0 caption_value_top=0
@slgmapstatus move_caption="移動負荷" move_left=0 move_top=20 move_value_left=60 move_value_top=20
@slgmapstatus defense_caption="防御効果" defense_left=0 defense_top=40 defense_value_left=60 defense_value_top=40
@slgmapstatus avoid_caption="回避効果" avoid_left=0 avoid_top=60 avoid_value_left=60 avoid_value_top=60
@slgmapstatus axis_caption="座標" axis_left=0 axis_top=80 axis_value_left=60 axis_value_top=80

ここで指定した情報がマップのセルの情報として画面に表示されます。

チップ情報.png

続けて、コマンドメニューの設定を行います。
コマンドメニューとは、マップ右クリック時に表示されるメニューです。

@slgcommandmenu turn_end_caption="ターンエンド" turn_end_width=60 turn_end_height=20
@slgcommandmenu skill_search_caption="スキル探索" skill_search_width=60 skill_search_height=20
@slgcommandmenu troops_caption="部隊表" troops_width=60 troops_height=20
@slgcommandmenu strategy_caption="作戦目的" strategy_width=60 strategy_height=20
@slgcommandmenu system_caption="システム" system_width=60 system_height=20
@slgcommandmenu load_caption="ロード" load_width=60 load_height=20
@slgcommandmenu save_caption="セーブ" save_width=60 save_height=20

メインメニュー.png

各メニューのキャプションやサイズを設定します。

続けてキャラクターメニューの設定を行います。
キャラクターを右クリックしたときに表示されるメニューです。

@slgcharactermenu attack_caption="攻撃" rest_caption="杖" weapon_shop_caption=武器屋 armor_shop_caption=防具屋 item_shop_caption=道具屋 arena_caption="闘技場" door_caption="扉" talk_caption="話す" visit_caption="訪問" control_caption="制圧" treasure_caption="宝箱を開ける" move_caption="移動" skill_caption="スキル" status_caption="ステータス" item_caption="アイテム" exchange_caption="交換" hangar_caption="倉庫" standby_caption=待機
;@slgcharactermenu move_left=200

ここでキャラクターメニューのキャプションを指定しています。
位置は自動で決まります。

キャラクターメニュー.png

次にステータス画面のレイアウトを設定します。

@slgcharacterstatus name_caption="名前" name_left=10 name_top=10 name_value_left=60 name_value_top=10 name_value_font_height=20 name_value_caption_color=0xff0000

@slgcharacterstatus move_caption="移動力" move_left=10 move_top=40 move_value_left=60 move_value_top=40 move_value_font_height=20

@slgcharacterstatus level_caption="レベル" level_left=10 level_top=70 level_value_left=60 level_value_top=70 level_value_font_height=20
@slgcharacterstatus max_level_caption="/" max_level_left=100 max_level_top=70 max_level_value_left=130 max_level_value_top=70 max_level_value_font_height=20
@slgcharacterstatus level_progress_nographic level_progress_left=10 level_progress_top=110 level_progress_width=120 level_progress_height=20

@slgcharacterstatus exp_caption="経験値" exp_left=10 exp_top=140 exp_value_left=50 exp_value_top=145 exp_value_font_height=10
@slgcharacterstatus exp_table_caption="/" exp_table_left=80 exp_table_top=140 exp_table_value_left=100 exp_table_value_top=145 exp_table_value_font_height=10
@slgcharacterstatus exp_progress_nographic exp_progress_left=10 exp_progress_top=170 exp_progress_width=120 exp_progress_height=20

@slgcharacterstatus money_caption="資金" money_left=100 money_top=40 money_value_left=150 money_value_top=45 money_value_font_height=10

@slgcharacterstatus class_left=150 class_top=5 class_font_height=20

@slgcharacterstatus id="hp" hp_caption="hp" hp_left=10 hp_top=190 hp_value_left=50 hp_value_top=195 hp_value_font_height=10
@slgcharacterstatus id="hp" hp_max_caption="/" hp_max_left=80 hp_max_top=190 hp_max_value_left=100 hp_max_value_top=195 hp_max_value_font_height=10
@slgcharacterstatus id="hp" hp_progress_nographic hp_progress_left=10 hp_progress_top=220 hp_progress_width=120 hp_progress_height=20 hp_progress_color=0xffffff hp_progress_bar_color=0xff0000

@slgcharacterstatus id="sp" sp_caption="sp" sp_left=10 sp_top=240 sp_value_left=50 sp_value_top=245 sp_value_font_height=10
@slgcharacterstatus id="sp" sp_max_caption="/" sp_max_left=80 sp_max_top=240 sp_max_value_left=100 sp_max_value_top=245 sp_max_value_font_height=10
@slgcharacterstatus id="sp" sp_progress_nographic sp_progress_left=10 sp_progress_top=270 sp_progress_width=120 sp_progress_height=20

@slgcharacterstatus id="int" int_caption="int" int_left=180 int_top=140 int_value_left=220 int_value_top=145 int_value_font_height=10 int_append_left=250 int_append_top=145 int_append_value_left=270 int_append_value_top=145

@slgcharacterstatus id="vit" vit_caption="vit" vit_left=180 vit_top=170 vit_value_left=220 vit_value_top=175 vit_value_font_height=10 vit_append_left=250 vit_append_top=175 vit_append_value_left=270 vit_append_value_top=175

@slgcharacterstatus id="agi" agi_caption="agi" agi_left=180 agi_top=200 agi_value_left=220 agi_value_top=205 agi_value_font_height=10 agi_append_left=250 agi_append_top=205 agi_append_value_left=270 agi_append_value_top=205

@slgcharacterstatus id="luk" luk_caption="luk" luk_left=180 luk_top=230 luk_value_left=220 luk_value_top=235 luk_value_font_height=10 luk_append_left=250 luk_append_top=235 luk_append_value_left=270 luk_append_value_top=235

@slgcharacterstatus id="str" str_caption="str" str_left=180 str_top=260 str_value_left=220 str_value_top=265 str_value_font_height=10 str_append_left=250 str_append_top=265 str_append_value_left=270 str_append_value_top=265

長いですが、各ステータスの表示名やステータス表示位置などを指定します。
ステータスはslgエディタで作成したデータを指定していく感じです。
この設定はキャラクターメニュー→ステータスを表示した時に出る画面のレイアウト設定です。

ステータス画面.png

ここまで簡単に説明しましたが、詳しくはマニュアルやテストスクリプトを参照してください。

という訳で次回に続きます。

関連する記事の一覧

goki2の関連する記事一覧

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?