Skip to content

Instantly share code, notes, and snippets.

@2Tie
Created June 29, 2022 18:11
Show Gist options
  • Save 2Tie/15606613e5a5e6036a93858c297b6523 to your computer and use it in GitHub Desktop.
Save 2Tie/15606613e5a5e6036a93858c297b6523 to your computer and use it in GitHub Desktop.
Monster Hunter 1/G scripting documentation
the block pointed to by 0x10 in the quest header is the quest scripting block. every entry in this block is 0x8 bytes long, consisting of four shorts; the first is the opcode, the other three are arguments (though argument three goes unused by any ops until G). in MH1, opcodes from -2 to 2D are implemented, but only around half are actually used. I will denote unused opcodes with an X prefix, and opcodes added by G with a G prefix. The unused opcodes will likely be documented better in the future, my focus here is on the used opcodes.
-2: Triggers the cameras for quest failure
-1: Triggers the monster camera for quest clear, sends a packet
00: X Waits until 3C7474 is 0
01: Waits for monster goals completion (all monsters stored value 0)
02: Sets the goal for Monster arg1 to arg2; slaying a monster decrements the stored arg2. can be used multiple times to set a max of two monsters.
03: X Check item goal, seems to be an early version that checks player inventory?
04: Sets the delivery item goal for item arg1 to quantity arg2, max four types.
05: sets a delay value of arg1 ticks (30hz)
06: waits out the set delay
07: display quest string arg1
08: X conditional jump to the set bookmark
09: X null
0A: X gives the player supplies?
0B: sets the bookmark to the next op
0C: X null
0D: X sets 3C7450 to arg1
0E: X increments 3C7450 by arg1
0F: X increment 3C7444 and skip ahead to 0x12 conditionally
10: X increment 3C7444 and skip ahead to 0x12 conditionally
11: X decrement 3C7444 and skip ahead to 0x12 unconditionally
12: X decrement 3C7444
13: X null
14: X null
15: X null
16: On player death, script jumps to the first 16 op and resumes operation from there
17: jump to set bookmark
18: waits for a (specific?) player action to finish
19: X null
1A: Label marker with ID arg1
1B: Required at start to setup timer behaviour. Time Up jumps script to Label with ID arg1.
1C: jump to Label with ID arg1
1D: X check item goal, seems a WIP version of final functionality
1E: Finishes the quest with a victory, ends script execution
1F: Finishes the quest with a failure, ends script execution
20: sends a packet to change the wave/quest state to arg1
21: waits until the player is carrying at least arg2 quantity of item ID arg1 (used for powderstone, egg)
22: waits for the item goals to be met
23: waits for item goals to be met, then jumps to Label with ID arg1
24: waits for the monster goal for ID arg1 to be below arg2
25: displays the Time Over message and sends a packet
26: X sends a packet with unknown data
27: X null
28: jumps to 29 ONLY if fatalis health isn't arg1 below its starting health
29: fatalis repel fail target
2A: jumps to 2B ONLY if lao health isn't low enough to repel (not specified by args)
2B: lao repel fail target
2C: jumps to Label with ID arg1 when the Fort falls
2D: always follows -1, waits for something then sends a packet; might be a victory sync
2E: G currently unknown, shows up in 怪鳥イャンクック襲来!(02001, g rank non-sub ykk hunt), 地中からの刺客(02012, g rank cephadrome), イャンクック討伐訓練(20003, first ykk training ONLY), and リオレウス討伐訓練(20007, first rathalos training ONLY). cephadrome uses arg1 1C, rest use arg1 1B. all use 1 for arg2 and arg3.
2F: G stocks the supply box; used in huntathons to put nekotaku tickets in the box.
some example quest scripts:
m045.mib: ジャングルの女王 (slay example)
----------------------
1B: Start quest timer; 0; 0
02: Set Monster goal; 1; 1 -- hunt 1 rathian
0B: bookmark next op; 0; 0
01: Check Monster goal; 0; 0 -- waits until rathian slain
-1: Victory Camera
2D: waits for something; 0; 0
07: Display message; 0; 0 -- message 0, the victory message in this case
1E: trigger victory END; 0; 0
16: death label; 0; 0
18: wait until action is finished; 0; 0 -- waits for the cart?
05: Set timer; A; 0
06: Wait for timer; 0; 0 -- a little delay
17: jump to bookmark; 0; 0 -- go back to the rathian slay check
-2: Loss Camera -- not sure why this is here tbh
05: Set timer; 96; 0
06: Wait for timer; 0; 0
1F: trigger failure END; 0; 0
1A: Label; 0; 0 -- time over label
25: Time Over message + packet; 0; 0
05: Set timer; 96; 0
06: Wait for timer; 0; 0
1F: trigger failure END; 0; 0
----------------------
m008.mib: 潜入!飛竜の巣 (delivery + eggs example)
----------------------
1B: Start quest timer; 0; 0
04: Set Item goal; 91; 3 -- 3 wyvern eggs
0B: bookmark next op; 0; 0
21: check player carrying item; 91; 1 -- do they have a wyvern egg?
20: change wave/quest state; 1; 0 -- update the entity patterns
0B: bookmark next op; 0; 0
22: check delivery goal; 0; 0 -- wait until everything's delivered
-1: Victory Camera
2D: waits for something; 0; 0
05: Set timer; 50; 0
06: Wait for timer; 0; 0
07: Display message; 0; 0 -- message 0, victory
1E: trigger victory END; 0; 0
16: death label; 0; 0
18: wait until action is finished; 0; 0
05: Set timer; A; 0
06: Wait for timer; 0; 0
17: jump to bookmark; 0; 0 -- resume our progress
-2: Loss Camera
05: Set timer; 96; 0
06: Wait for timer; 0; 0
1F: trigger failure END; 0; 0
1A: Label; 0; 0 -- time over label
25: Time Over message + packet; 0; 0
05: Set timer; 96; 0
06: Wait for timer; 0; 0
1F: trigger failure END; 0; 0
----------------------
m035.mib: 巨大昆虫、大発生! (arbitrary messages example)
----------------------
1B: Start quest timer; 0; 0
02: Set Monster goal; 13; 32 -- 50 vespoids, yeesh
0B: bookmark next op; 0; 0
24: Check Monster goal left; 13; 28 -- 40 left?
07: Display message; 1; 0 -- message 1! "40 left"
0B: bookmark next op; 0; 0
24: Check Monster goal left; 13; 1E -- 30 left?
07: Display message; 2; 0 -- message 2! "30 left"
0B: bookmark next op; 0; 0
24: Check Monster goal left; 13; 14 -- 20 left?
07: Display message; 3; 0 -- message 3! "20 left"
0B: bookmark next op; 0; 0
24: Check Monster goal left; 13; A -- 10 left?
07: Display message; 4; 0 -- message 4! "10 left"
0B: bookmark next op; 0; 0
24: Check Monster goal left; 13; 5 -- you get the idea
07: Display message; 5; 0
0B: bookmark next op; 0; 0
01: Check Monster goal; 0; 0
-1: Victory Camera
2D: waits for something; 0; 0
07: Display message; 0; 0
1E: trigger victory END; 0; 0
16: death label; 0; 0
18: wait until action is finished; 0; 0
05: Set timer; A; 0
06: Wait for timer; 0; 0
17: jump to bookmark; 0; 0
-2: Loss Camera
05: Set timer; 96; 0
06: Wait for timer; 0; 0
1F: trigger failure END; 0; 0
1A: Label; 0; 0
25: Time Over message + packet; 0; 0
05: Set timer; 96; 0
06: Wait for timer; 0; 0
1F: trigger failure END; 0; 0
----------------------
m101.mib: 巨大龍の侵攻 (repel example)
----------------------
1B: Start quest timer; 0; 0 -- label 0 on time over
02: Set Monster goal; 7; 1 -- lao!
2C: jump to label when Fort falls; 1; 0 -- label 1 on fort destruction
0B: bookmark next op; 0; 0
01: Check Monster goal; 0; 0 -- wait for monster slay
-1: Victory Camera
2D: waits for something; 0; 0
07: Display message; 0; 0 -- we killed it!
1E: trigger victory END; 0; 0
16: death label; 0; 0
18: wait until action is finished; 0; 0
05: Set timer; A; 0
06: Wait for timer; 0; 0
17: jump to bookmark; 0; 0 -- resume where we left off
1A: Label; 0; 0 -- time over!
2A: lao health check; 0; 0 -- did we do enough damage?
-1: Victory Camera
2D: waits for something; 0; 0
07: Display message; 1; 0 -- we repelled it!
1E: trigger victory END; 0; 0
2B: lao repel fail start; 0; 0 -- not enough :(
1A: Label; 1; 0 -- repel fail and fort destroy end up here
-2: Loss Camera
07: Display message; 2; 0 -- we failed :(
05: Set timer; 96; 0
06: Wait for timer; 0; 0
1F: trigger failure END; 0; 0
----------------------
m140.mib: リオレウス捕獲大作戦 (capture example)
----------------------
1B: Start quest timer; 0; 0
04: Set Item goal; 90; 1 -- "wyvern" object
23: jump to label when delivery done; 1; 0 -- goto label 1 when wyvern delivered
02: Set Monster goal; B; 1 -- slay goal is 1 rathalos
0B: bookmark next op; 0; 0
01: Check Monster goal; 0; 0 -- wait for rathalos to die (fail state check)
1C: jump to label; 2; 0 -- on fail, jump to label 2
1A: Label; 1; 0 -- label 1, wyvern delivered!
-1: Victory Camera
2D: waits for something; 0; 0
07: Display message; 0; 0
1E: trigger victory END; 0; 0
16: death label; 0; 0
18: wait until action is finished; 0; 0
05: Set timer; A; 0
06: Wait for timer; 0; 0
17: jump to bookmark; 0; 0
-2: Loss Camera
05: Set timer; 96; 0
06: Wait for timer; 0; 0
1F: trigger failure END; 0; 0
1A: Label; 0; 0 -- time over label
25: Time Over message + packet; 0; 0
05: Set timer; 96; 0
06: Wait for timer; 0; 0
1F: trigger failure END; 0; 0
1A: Label; 2; 0 -- rath slayed (fail) label
07: Display message; 1; 0
-2: Loss Camera
05: Set timer; 96; 0
06: Wait for timer; 0; 0
1F: trigger failure END; 0; 0
----------------------
m02011.mib: 大怪鳥の異常発生!! (huntathon paw pass example)
----------------------
1B: Start quest timer; 0; 0
02: Set Monster goal; 6; 14 -- 20 ykk
04: Set Item goal; 1C7; 1 -- 1 paw pass ticket
0B: bookmark next op; 0; 0
24: Check Monster goal left; 6; 12 -- wait until 2 slain
2F: G stock supply box; 1; 0 -- then trigger supplies
0B: bookmark next op; 0; 0
22: check delivery goal; 0; 0 -- then wait until ticket delivered!
1A: Label; 1; 0 -- unneeded
-1: Victory Camera
2D: sync victory?; 0; 0
07: Display message; 0; 0
1E: trigger victory END; 0; 0
16: Player Death label; 0; 0
18: wait until action is finished; 0; 0
05: Set timer; A; 0
06: Wait for timer; 0; 0
17: jump to bookmark; 0; 0
-2: Loss Camera
05: Set timer; 96; 0
06: Wait for timer; 0; 0
1F: trigger failure END; 0; 0
1A: Label; 0; 0
25: Time Over message + packet; 0; 0
05: Set timer; 96; 0
06: Wait for timer; 0; 0
1F: trigger failure END; 0; 0
----------------------
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment