SCENE 9989, Aztec, SCENE, "News Reports", 0, 0, 0
@picknews
	IF T31, @garg
RETURN
@garg
		1: Hear ye, hear ye! The troll Garg has been felled by %1! No longer will Oakhurst need to give up its food.
RETURN
END
;This is the "handler" scene. It's not a proper scene, it's just used as a place to hold various scripts I'll be using often with the CALL command.
SCENE 9990, aztec, SCENE, "this should never appear", 0, 0, 0
; The skill check script. When CALLing this script, enter the arg values in this order: the skill, the relevant stat, whether you have advantage or disadvantage, and the skill check DC. Use lower case.
@skillcheck
; First, let's determine whether the character is proficient.
STRCMP #<arg0>, "athleticism"
IF= @ath
STRCMP #<arg0>, "knowledge"
IF= @kno
STRCMP #<arg0>, "intrigue"
IF= @int
STRCMP #<arg0>, "nature"
IF= @nat
STRCMP #<arg0>, "perception"
IF= @per
STRCMP #<arg0>, "thievery"
IF= @thi
N: You typed something wrong, check the capitalization.
GOTO @endcheck
@ath
IF T3000, @proficient
GOTO @notproficient
@kno
IF T3001, @proficient
GOTO @notproficient
@int
IF T3002, @proficient
GOTO @notproficient
@nat
IF T3003, @proficient
GOTO @notproficient
@per
IF T3004, @proficient
GOTO @notproficient
@thi
IF T3005, @proficient
GOTO @notproficient
@notproficient
SET proficiencyBonus, "0"
GOTO @abil
; If the character is proficient, let's determine the character's proficiency bonus based on their level
@proficient
COMPARE #<num.hostLevel>, "80"
IF> @prof6
IF= @prof6
COMPARE #<num.hostLevel>, "60"
IF> @prof5
IF= @prof5
COMPARE #<num.hostLevel>, "40"
IF> @prof4
IF= @prof4
COMPARE #<num.hostLevel>, "20"
IF> @prof3
IF= @prof3
IF< @prof2
@prof6
SET proficiencyBonus, "6"
IF C3|C4|C6, @expertise
GOTO @abil
@prof5
SET proficiencyBonus, "5"
IF C3|C4|C6, @expertise
GOTO @abil
@prof4
SET proficiencyBonus, "4"
IF C3|C4|C6, @expertise
GOTO @abil
@prof3
SET proficiencyBonus, "3"
IF C3|C4|C6, @expertise
GOTO @abil
@prof2
SET proficiencyBonus, "2"
IF C3|C4|C6, @expertise
GOTO @abil
@expertise
;Bard, Rogue, and Ranger double their proficiency bonus for Intrigue, Thievery, and Nature respectively
STRCMP #<arg0>, "intrigue"
IF= @bard
STRCMP #<arg0>, "thievery"
IF= @rogue
STRCMP #<arg0>, "nature"
IF= @ranger
GOTO @abil
@bard
MUL proficiencyBonus, "2"
GOTO @abil
@rogue
MUL proficiencyBonus, "2"
GOTO @abil
@ranger
MUL proficiencyBonus, "2"
GOTO @abil
;Now that we've calculated the proficiency bonus, let's calculate the ability modifier
@abil
SET abilityModifier, "#<arg1>"
DIV abilityModifier, "40"
SET totalBonus, "1"
ADD totalBonus, #<proficiencyBonus>
ADD totalBonus, #<abilityModifier>
;Check for advantage/disadvantage. for arg2, put 0 for no change, 1 for advantage, and 2 for disadvantage. If neither, roll our d20.
COMPARE #<arg2>, "1"
IF= @advantage
COMPARE #<arg2>, "2"
IF= @disadvantage
GOTO @diceroll
@advantage
SET roll, "%R20"
SET roll2, "%R20"
SET displayRoll, #<roll>
SET displayRoll2, #<roll2>
COMPARE #<roll>, #<roll2>
IF<, @higher
GOTO @critcheck
@higher
SET roll, #<roll2>
GOTO @critcheck
@disadvantage
SET roll, "%R20"
SET roll2, "%R20"
SET displayRoll, #<roll>
SET displayRoll2, #<roll2>
COMPARE #<roll>, #<roll2>
IF>, @lower
GOTO @critcheck
@lower
SET roll, #<roll2>
GOTO @critcheck
;Now that we have our modifiers, let's roll our d20.
@diceroll
SET roll, "%R20"
SET originalRoll, "#<roll>"
GOTO @critcheck
;Check to see if the player rolled a 20. If so, declare a crit success and skip to the end.
@critcheck
COMPARE #<roll>, "20"
IF= @critical
GOTO @result
@critical
N: Critical success!
SET finalResult, "2"
GOTO @endcheck
; Now we add the appropriate bonuses together and compare it to the DC of the skill check
@result
ADD roll, "#<proficiencyBonus>"
ADD roll, "#<abilityModifier>"
COMPARE #<roll>, #<arg3>
IF= @success
IF> @success
IF< @failure
@success
SET finalResult, "1"
GOTO @endcheck
@failure
SET finalResult, "0"
GOTO @endcheck
@endcheck
COMPARE #<arg2>, "1"
IF= @showadvantage
COMPARE #<arg2>, "2"
IF= @showdisadvantage
GOTO @showroll
@showadvantage
ACTOR 62, "", "dice#<diceColor>", 1, 45, 100
ACTOR 63, "", "dice#<diceColor>", 1, 50, 100
ACTOR 64, "", "bonuses", #<totalBonus>, 55, 100
SOUND "dice.wav"
SEL 62
POSE %R20
SEL 63
POSE %R20
SEL 62
POSE %R20
SEL 63
POSE %R20
SEL 62
POSE %R20
SEL 63
POSE %R20
SEL 62
POSE %R20
SEL 63
POSE %R20
SEL 62
POSE %R20
SEL 63
POSE %R20
SEL 62
POSE #<displayRoll>
SEL 63
POSE #<displayRoll2>
WAIT 2
COMPARE #<displayRoll>, #<displayRoll2>
IF> @strike2
IF< @strike1
IF= @strike1
RETURN
@showdisadvantage
ACTOR 62, "", "dice#<diceColor>", 1, 45, 100
ACTOR 63, "", "dice#<diceColor>", 1, 50, 100
ACTOR 64, "", "bonuses", #<totalBonus>, 55, 100
SOUND "dice.wav"
SEL 62
POSE %R20
SEL 63
POSE %R20
SEL 62
POSE %R20
SEL 63
POSE %R20
SEL 62
POSE %R20
SEL 63
POSE %R20
SEL 62
POSE %R20
SEL 63
POSE %R20
SEL 62
POSE %R20
SEL 63
POSE %R20
SEL 62
POSE #<displayRoll>
SEL 63
POSE #<displayRoll2>
WAIT 2
COMPARE #<displayRoll>, #<displayRoll2>
IF< @strike2
IF> @strike1
IF= @strike1
RETURN
@showroll
ACTOR 63, "", "dice#<diceColor>", 1, 50, 100
SOUND "dice.wav"
SEL 63
POSE %R20
POSE %R20
POSE %R20
POSE %R20
POSE %R20
POSE %R20
POSE %R20
POSE %R20
POSE %R20
POSE %R20
POSE #<originalRoll>
GOTO @cleardice
RETURN
@strike1
ACTOR 62, "", "dicegrey", #<displayRoll>, 45, 100
GOTO @cleardice
RETURN
@strike2
ACTOR 63, "", "dicegrey", #<displayRoll2>, 50, 100
GOTO @cleardice
RETURN
@cleardice
WAIT 3
MOVE 62, 120, 100, 1
MOVE 63, 120, 100, 1
MOVE 64, 120, 100, 1
RETURN
; Save Point script. This stores a specific link as your save point, for the purposes of both the death warp function and the Recall spell.
@savepoint
SET saveMap, #<num.MapNum>
SET saveLink, #<num.closestLink>
RETURN
; Death Warp function. When the player character dies, this will offer to send them back to their last save point(usually an inn)
@deathwarp
MUSIC "sad.mid"
N: Would you like to return to your last save point?
MENU "Yes=@deathYes", "No=@deathNo"
@deathYes
GOTO LINK #<saveMap>, #<saveLink>, 1
RETURN
@deathNo
RETURN
; Random treasure script. this gets CALLed whenever a random levelled treasure gets rolled.
@randtreasure
SET num.DevTableId, 01
SET str.DevTableRowId, "#<num.hostLevel>treasure"
SET treasureColumn, "%R12"
COMPARE #<treasureColumn>, "1"
IF= @randomtreasure1
COMPARE #<treasureColumn>, "2"
IF= @randomtreasure2
COMPARE #<treasureColumn>, "3"
IF= @randomtreasure3
COMPARE #<treasureColumn>, "4"
IF= @randomtreasure4
COMPARE #<treasureColumn>, "5"
IF= @randomtreasure5
COMPARE #<treasureColumn>, "6"
IF= @randomtreasure6
COMPARE #<treasureColumn>, "7"
IF= @randomtreasure7
COMPARE #<treasureColumn>, "8"
IF= @randomtreasure8
COMPARE #<treasureColumn>, "9"
IF= @randomtreasure9
COMPARE #<treasureColumn>, "10"
IF= @randomtreasure10
COMPARE #<treasureColumn>, "11"
IF= @randomtreasure11
COMPARE #<treasureColumn>, "12"
IF= @randomtreasure12
RETURN
@randomtreasure1
SET item.id, #<str.DevTableCOL1>
SET treasureName, #<item.name>
GIVE I#<str.DevTableCOL1>
RETURN
@randomtreasure2
SET item.id, #<str.DevTableCOL2>
SET treasureName, #<item.name>
GIVE I#<str.DevTableCOL2>
RETURN
@randomtreasure3
SET item.id, #<str.DevTableCOL3>
SET treasureName, #<item.name>
GIVE I#<str.DevTableCOL3>
RETURN
@randomtreasure4
SET item.id, #<str.DevTableCOL4>
SET treasureName, #<item.name>
GIVE I#<str.DevTableCOL4>
RETURN
@randomtreasure5
SET item.id, #<str.DevTableCOL5>
SET treasureName, #<item.name>
GIVE I#<str.DevTableCOL5>
RETURN
@randomtreasure6
SET item.id, #<str.DevTableCOL6>
SET treasureName, #<item.name>
GIVE I#<str.DevTableCOL6>
RETURN
@randomtreasure7
SET item.id, #<str.DevTableCOL7>
SET treasureName, #<item.name>
GIVE I#<str.DevTableCOL7>
RETURN
@randomtreasure8
SET item.id, #<str.DevTableCOL8>
SET treasureName, #<item.name>
GIVE I#<str.DevTableCOL8>
RETURN
@randomtreasure9
SET item.id, #<str.DevTableCOL9>
SET treasureName, #<item.name>
GIVE I#<str.DevTableCOL9>
RETURN
@randomtreasure10
SET item.id, #<str.DevTableCOL10>
SET treasureName, #<item.name>
GIVE I#<str.DevTableCOL10>
@randomtreasure11
SET item.id, #<str.DevTableCOL11>
SET treasureName, #<item.name>
GIVE I#<str.DevTableCOL11>
@randomtreasure12
SET item.id, #<str.DevTableCOL12>
SET treasureName, #<item.name>
GIVE I#<str.DevTableCOL12>
RETURN
; Fishing script. This gets CALLed whenever you cast your line to fish. arg0 in the CALL should be the dev table number of the loot table to use.
; arg1 should be the actor ID of the ripples
@cast
SET num.DevTableId, #<arg0>
;first, determine whether the player has a rod equipped.
IF E117|E118|E119|E120, @hasrod
N: You must equip a fishing rod to fish.
RETURN
@hasrod
;Check if the player has any bait.
IF I15, @hasbait
N: You need bait in order to fish.
RETURN
@hasbait
SEL #<arg1>
POSE 2
WAIT 2
;Check if the player has the Fishing Hat equipped. If they do, skip this step and go straight to the bite calculations.
IF E129, @bite
;Now, check what rod they have equipped and assign a bite rate based on the rod. Base rate is 50%, increasing by 10% with each better tier of rod.
SET biteValue, "%R10"
IF E117, @50bite
IF E118, @60bite
IF E119, @70bite
IF E120, @80bite
RETURN
@50bite
COMPARE #<biteValue>, "5"
IF>, @bite
N: Nothing expresses interest in your hook.
RETURN
@60bite
COMPARE #<biteValue>, "4"
IF>, @bite
N: Nothing expresses interest in your hook.
RETURN
@70bite
COMPARE #<biteValue>, "3"
IF>, @bite
N: Nothing expresses interest in your hook.
RETURN
@80bite
COMPARE #<biteValue>, "2"
IF>, @bite
N: Nothing expresses interest in your hook.
RETURN
@bite
SEL #<arg1>
POSE 3
HOST_TAKE I15
WAIT 2
GOTO @lurecheck
RETURN
@lurecheck
Now, check what lure the player has equipped
IF E125, @flylure
IF E126, @darklure
IF E127, @clawlure
IF E128, @curiolure
GOTO @nolure
RETURN
;Calculate individual chances for treasure, monster, or fish. 
@flylure
SET catchType, "%R20"
COMPARE #<catchType>, "2"
IF< @caughtspecial
COMPARE #<catchType>, "13"
IF< @caughtfish
COMPARE #<catchType>, "17"
IF< @caughttreasure
GOTO @caughtmonster
RETURN
@darklure
SET catchType, "%R20"
COMPARE #<catchType>, "2"
IF< @caughtspecial
COMPARE #<catchType>, "13"
IF< @caughtmonster
COMPARE #<catchType>, "17"
IF< @caughttreasure
GOTO @caughtfish
RETURN
@clawlure
SET catchType, "%R20"
COMPARE #<catchType>, "2"
IF< @caughtspecial
COMPARE #<catchType>, "13"
IF< @caughttreasure
COMPARE #<catchType>, "17"
IF< @caughtfish
GOTO @caughtmonster
RETURN
@curiolure
SET catchType, "%R20"
COMPARE #<catchType>, "3"
IF< @caughtspecial
COMPARE #<catchType>, "9"
IF< @caughtfish
COMPARE #<catchType>, "15"
IF< @caughttreasure
GOTO @caughtmonster
RETURN
@nolure
SET catchType, "%R20"
COMPARE #<catchType>, "2"
IF< @caughtspecial
COMPARE #<catchType>, "8"
IF< @caughtmonster
COMPARE #<catchType>, "14"
IF< @caughttreasure
GOTO @caughtfish
RETURN
@caughtfish
SET str.DevTableRowId, "fish"
SET fishingColumn, "%R12"
COMPARE #<fishingColumn>, "1"
IF= @fish1
COMPARE #<fishingColumn>, "2"
IF= @fish2
COMPARE #<fishingColumn>, "3"
IF= @fish3
COMPARE #<fishingColumn>, "4"
IF= @fish4
COMPARE #<fishingColumn>, "5"
IF= @fish5
COMPARE #<fishingColumn>, "6"
IF= @fish6
COMPARE #<fishingColumn>, "7"
IF= @fish7
COMPARE #<fishingColumn>, "8"
IF= @fish8
COMPARE #<fishingColumn>, "9"
IF= @fish9
COMPARE #<fishingColumn>, "10"
IF= @fish10
COMPARE #<fishingColumn>, "11"
IF= @fish11
COMPARE #<fishingColumn>, "12"
IF= @fish12
RETURN
@fish1
SET fishCatch, "#<str.DevTableCOL1>"
GOTO @reeling
RETURN
@fish2
SET fishCatch, "#<str.DevTableCOL2>"
GOTO @reeling
RETURN
@fish3
SET fishCatch, "#<str.DevTableCOL3>"
GOTO @reeling
RETURN
@fish4
SET fishCatch, "#<str.DevTableCOL4>"
GOTO @reeling
RETURN
@fish5
SET fishCatch, "#<str.DevTableCOL5>"
GOTO @reeling
RETURN
@fish6
SET fishCatch, "#<str.DevTableCOL6>"
GOTO @reeling
RETURN
@fish7
SET fishCatch, "#<str.DevTableCOL7>"
GOTO @reeling
RETURN
@fish8
SET fishCatch, "#<str.DevTableCOL8>"
GOTO @reeling
RETURN
@fish9
SET fishCatch, "#<str.DevTableCOL9>"
GOTO @reeling
RETURN
@fish10
SET fishCatch, "#<str.DevTableCOL10>"
GOTO @reeling
RETURN
@fish11
SET fishCatch, "#<str.DevTableCOL11>"
GOTO @reeling
RETURN
@fish12
SET fishCatch, "#<str.DevTableCOL12>"
GOTO @reeling
RETURN
@reeling
;add more fish here as needed
STRCMP #<fishCatch>, "131"
IF= @shad
STRCMP #<fishCatch>, "132"
IF= @cod
STRCMP #<fishCatch>, "133"
IF= @salmon
STRCMP #<fishCatch>, "134"
IF= @herring
STRCMP #<fishCatch>, "135"
IF= @carp
STRCMP #<fishCatch>, "136"
IF= @goldfish
STRCMP #<fishCatch>, "137"
IF= @trout
STRCMP #<fishCatch>, "138"
IF= @perch
RETURN
;------------------------
;individual fish
;------------------------
@shad
SEL #<arg1>
POSE 1
CALL 9993@fishingcheck
COMPARE #<fishingRoll>, 10
IF> @shadrecord
IF= @shadrecord
N: Though you put up a valiant effort, the fish escapes.
RETURN
@cod
SEL #<arg1>
POSE 1
CALL 9993@fishingcheck
COMPARE #<fishingRoll>, 10
IF> @codrecord
IF= @codrecord
N: The fish manages to escape.
RETURN
@salmon
SEL #<arg1>
POSE 1
CALL 9993@fishingcheck
COMPARE #<fishingRoll>, 12
IF> @salmonrecord
IF= @salmonrecord
N: The fish proves to be too much for the line to bear.
RETURN
@herring
SEL #<arg1>
POSE 1
CALL 9993@fishingcheck
COMPARE #<fishingRoll>, 8
IF> @herringrecord
IF= @herringrecord
N: The fish escapes.
RETURN
@carp
COMPARE #<fishingRoll>, 11
IF> @carprecord
IF= @shadrecord
N: Though you put up a valiant effort, the fish escapes.
RETURN
@goldfish
SEL #<arg1>
POSE 1
CALL 9993@fishingcheck
COMPARE #<fishingRoll>, 11
IF> @goldfishrecord
IF= @goldfishrecord
N: The fish manages to escape.
RETURN
@trout
SEL #<arg1>
POSE 1
CALL 9993@fishingcheck
COMPARE #<fishingRoll>, 13
IF> @troutrecord
IF= @troutrecord
N: The fish proves to be too much for the line to bear.
RETURN
@perch
SEL #<arg1>
POSE 1
CALL 9993@fishingcheck
COMPARE #<fishingRoll>, 9
IF> @perchrecord
IF= @perchrecord
N: The fish escapes.
RETURN
;-------------------------------
;updating records/awarding fish
;-------------------------------
@shadrecord
GIVE I131
SET fishSize, "%R6"
ADD fishSize, "2"
N: You caught a shad that weighs #<fishSize> pounds.
COMPARE #<fishSize>, #<shadRecord>
IF> @updateshad
RETURN
@updateshad
SET shadRecordHolder, "%1"
SET shadRecord, "#<fishSize>"
WAIT 2
N: You set a new record!
RETURN
@codrecord
GIVE I132
SET fishSize, "%R7"
ADD fishSize, "5"
N: You caught a cod that weighs #<fishSize> pounds.
COMPARE #<fishSize>, #<codRecord>
IF> @updatecod
RETURN
@updatecod
SET codRecordHolder, "%1"
SET codRecord, "#<fishSize>"
WAIT 2
N: You set a new record!
RETURN
@salmonrecord
GIVE I133
SET fishSize, "%R10"
ADD fishSize, "5"
N: You caught a salmon that weighs #<fishSize> pounds.
COMPARE #<fishSize>, #<salmonRecord>
IF> @updatesalmon
RETURN
@updatesalmon
SET salmonRecordHolder, "%1"
SET salmonRecord, "#<fishSize>"
WAIT 2
N: You set a new record!
RETURN
;herring size is in ounces
@herringrecord
GIVE I134
SET fishSize, "%R7"
ADD fishSize, "4"
COMPARE #<fishSize>, #<herringRecord>
N: You caught a herring that weighs #<fishSize> ounces.
IF> @updateherring
RETURN
@updateherring
SET herringRecordHolder, "%1"
SET herringRecord, "#<fishSize>"
N: You set a new record!
RETURN
@carprecord
GIVE I135
SET fishSize, "%R7"
ADD fishSize, "7"
N: You caught a carp that weighs #<fishSize> pounds.
COMPARE #<fishSize>, #<carpRecord>
IF> @updatecarp
RETURN
@updatecarp
SET carpRecordHolder, "%1"
SET carpRecord, "#<fishSize>"
WAIT 2
N: You set a new record!
RETURN
@goldfishrecord
GIVE I136
SET fishSize, "%R7"
ADD fishSize, "1"
N: You caught a goldfish that weighs #<fishSize> pounds.
COMPARE #<fishSize>, #<goldfishRecord>
IF> @updategoldfish
RETURN
@updategoldfish
SET goldfishRecordHolder, "%1"
SET goldfishRecord, "#<fishSize>"
WAIT 2
N: You set a new record!
RETURN
@troutrecord
GIVE I137
SET fishSize, "%R7"
ADD fishSize, "6"
N: You caught a trout that weighs #<fishSize> pounds.
COMPARE #<fishSize>, #<troutRecord>
IF> @updatetrout
RETURN
@updatetrout
SET troutRecordHolder, "%1"
SET troutRecord, "#<fishSize>"
WAIT 2
N: You set a new record!
RETURN
@perchrecord
GIVE I138
SET fishSize, "%R7"
ADD fishSize, "2"
N: You caught a perch that weighs #<fishSize> pounds.
COMPARE #<fishSize>, #<perchRecord>
IF> @updateperch
RETURN
@updateperch
SET perchRecordHolder, "%1"
SET perchRecord, "#<fishSize>"
WAIT 2
N: You set a new record!
RETURN
@caughttreasure
SET str.DevTableRowId, "treasure"
SET fishingColumn, "%R12"
COMPARE #<fishingColumn>, "1"
IF= @treasure1
COMPARE #<fishingColumn>, "2"
IF= @treasure2
COMPARE #<fishingColumn>, "3"
IF= @treasure3
COMPARE #<fishingColumn>, "4"
IF= @treasure4
COMPARE #<fishingColumn>, "5"
IF= @treasure5
COMPARE #<fishingColumn>, "6"
IF= @treasure6
COMPARE #<fishingColumn>, "7"
IF= @treasure7
COMPARE #<fishingColumn>, "8"
IF= @treasure8
COMPARE #<fishingColumn>, "9"
IF= @treasure9
COMPARE #<fishingColumn>, "10"
IF= @treasure10
COMPARE #<fishingColumn>, "11"
IF= @treasure11
COMPARE #<fishingColumn>, "12"
IF= @treasure12
RETURN
@treasure1
SEL #<arg1>
POSE 1
SET item.id, "#<str.DevTableCOL1>"
GIVE I#<str.DevTableCOL1>
N: You fished up a #<item.name>!
RETURN
@treasure2
SEL #<arg1>
POSE 1
SET item.id, "#<str.DevTableCOL2>"
GIVE I#<str.DevTableCOL2>
N: You fished up a #<item.name>!
RETURN
@treasure3
SEL #<arg1>
POSE 1
POSE #<arg1>, 1
SET item.id, "#<str.DevTableCOL3>"
GIVE I#<str.DevTableCOL3>
N: You fished up a #<item.name>!
RETURN
@treasure4
SEL #<arg1>
POSE 1
POSE #<arg1>, 1
SET item.id, "#<str.DevTableCOL4>"
GIVE I#<str.DevTableCOL4>
N: You fished up a #<item.name>!
RETURN
@treasure5
SEL #<arg1>
POSE 1
SET item.id, "#<str.DevTableCOL5>"
GIVE I#<str.DevTableCOL5>
N: You fished up a #<item.name>!
RETURN
@treasure6
SEL #<arg1>
POSE 1
SET item.id, "#<str.DevTableCOL6>"
GIVE I#<str.DevTableCOL6>
N: You fished up a #<item.name>!
RETURN
@treasure7
SEL #<arg1>
POSE 1
SET item.id, "#<str.DevTableCOL7>"
GIVE I#<str.DevTableCOL7>
N: You fished up a #<item.name>!
RETURN
@treasure8
SEL #<arg1>
POSE 1
SET item.id, "#<str.DevTableCOL8>"
GIVE I#<str.DevTableCOL8>
N: You fished up a #<item.name>!
RETURN
@treasure9
SEL #<arg1>
POSE 1
SET item.id, "#<str.DevTableCOL9>"
GIVE I#<str.DevTableCOL9>
N: You fished up a #<item.name>!
RETURN
@treasure10
SEL #<arg1>
POSE 1
SET item.id, "#<str.DevTableCOL10>"
GIVE I#<str.DevTableCOL10>
N: You fished up a #<item.name>!
RETURN
@treasure11
SEL #<arg1>
POSE 1
SET item.id, "#<str.DevTableCOL11>"
GIVE I#<str.DevTableCOL11>
N: You fished up a #<item.name>!
RETURN
@treasure12
SEL #<arg1>
POSE 1
SET item.id, "#<str.DevTableCOL12>"
GIVE I#<str.DevTableCOL12>
N: You fished up a #<item.name>!
RETURN
@caughtmonster
SET str.DevTableRowId, "monster"
SET fishingColumn, "%R12"
COMPARE #<fishingColumn>, "1"
IF= @monster1
COMPARE #<fishingColumn>, "2"
IF= @monster2
COMPARE #<fishingColumn>, "3"
IF= @monster3
COMPARE #<fishingColumn>, "4"
IF= @monster4
COMPARE #<fishingColumn>, "5"
IF= @monster5
COMPARE #<fishingColumn>, "6"
IF= @monster6
COMPARE #<fishingColumn>, "7"
IF= @monster7
COMPARE #<fishingColumn>, "8"
IF= @monster8
COMPARE #<fishingColumn>, "9"
IF= @monster9
COMPARE #<fishingColumn>, "10"
IF= @monster10
COMPARE #<fishingColumn>, "11"
IF= @monster11
COMPARE #<fishingColumn>, "12"
IF= @monster12
RETURN
@monster1
SEL #<arg1>
POSE 1
SET monster.id, #<str.DevTableCOL1>
N: A #<monster.name> leaps out of the water and attacks you!
FIGHT #<str.DevTableCOL1>
MUSIC "#silence"
IF DEAD, @fishdwarp
RETURN
@monster2
SEL #<arg1>
POSE 1
SET monster.id, #<str.DevTableCOL2>
N: A #<monster.name> leaps out of the water and attacks you!
FIGHT #<str.DevTableCOL2>
MUSIC "#silence"
IF DEAD, @fishdwarp
RETURN
@monster3
SEL #<arg1>
POSE 1
SET monster.id, #<str.DevTableCOL3>
N: A #<monster.name> leaps out of the water and attacks you!
FIGHT #<str.DevTableCOL3>
MUSIC "#silence"
IF DEAD, @fishdwarp
RETURN
@monster4
SEL #<arg1>
POSE 1
SET monster.id, #<str.DevTableCOL4>
N: A #<monster.name> leaps out of the water and attacks you!
FIGHT #<str.DevTableCOL4>
MUSIC "#silence"
IF DEAD, @fishdwarp
RETURN
@monster5
SEL #<arg1>
POSE 1
SET monster.id, #<str.DevTableCOL5>
N: A #<monster.name> leaps out of the water and attacks you!
FIGHT #<str.DevTableCOL5>
MUSIC "#silence"
IF DEAD, @fishdwarp
RETURN
@monster6
SEL #<arg1>
POSE 1
SET monster.id, #<str.DevTableCOL6>
N: A #<monster.name> leaps out of the water and attacks you!
FIGHT #<str.DevTableCOL6>
MUSIC "#silence"
IF DEAD, @fishdwarp
RETURN
@monster7
SEL #<arg1>
POSE 1
SET monster.id, #<str.DevTableCOL7>
N: A #<monster.name> leaps out of the water and attacks you!
FIGHT #<str.DevTableCOL7>
MUSIC "#silence"
IF DEAD, @fishdwarp
RETURN
@monster8
SEL #<arg1>
POSE 1
SET monster.id, #<str.DevTableCOL8>
N: A #<monster.name> leaps out of the water and attacks you!
FIGHT #<str.DevTableCOL8>
MUSIC "#silence"
IF DEAD, @fishdwarp
RETURN
@monster9
SEL #<arg1>
POSE 1
SET monster.id, #<str.DevTableCOL9>
N: A #<monster.name> leaps out of the water and attacks you!
FIGHT #<str.DevTableCOL9>
MUSIC "#silence"
IF DEAD, @fishdwarp
RETURN
@monster10
SEL #<arg1>
POSE 1
SET monster.id, #<str.DevTableCOL10>
N: A #<monster.name> leaps out of the water and attacks you!
FIGHT #<str.DevTableCOL10>
MUSIC "#silence"
IF DEAD, @fishdwarp
RETURN
@monster11
SEL #<arg1>
POSE 1
SET monster.id, #<str.DevTableCOL11>
N: A #<monster.name> leaps out of the water and attacks you!
FIGHT #<str.DevTableCOL11>
MUSIC "#silence"
IF DEAD, @fishdwarp
RETURN
@monster12
SEL #<arg1>
POSE 1
SET monster.id, #<str.DevTableCOL12>
N: A #<monster.name> leaps out of the water and attacks you!
FIGHT #<str.DevTableCOL12>
MUSIC "#silence"
IF DEAD, @fishdwarp
RETURN
@fishdwarp
CALL 9990@deathwarp
RETURN
@caughtspecial
SEL #<arg1>
POSE 1
SET str.DevTableRowId, "curio"
IF T#<str.DevTableCOL2>, @reroll
SET item.id, "#<str.DevTableCOL1>"
GIVE T#<str.DevTableCOL2>
GIVE I#<str.DevTableCOL1>
N: You fished up the #<item.name>!
RETURN
@reroll
GOTO @lurecheck
RETURN
; Random non-combat encounter script. Each time a FIGHT scene is triggered, it has a 1 in 10 chance to be a non-combat encounter, the variety of which is determined by map.
; the random encounter table should be dev table 0.  
@noncombat
IF R5, @seed
SET num.DevTableId, 00
SET str.DevTableRowId, #<str.mapName>
SET encounterColumn, "%R10"
COMPARE #<encounterColumn>, "1"
IF= @randomenc1
COMPARE #<encounterColumn>, "2"
IF= @randomenc2
COMPARE #<encounterColumn>, "3"
IF= @randomenc3
COMPARE #<encounterColumn>, "4"
IF= @randomenc4
COMPARE #<encounterColumn>, "5"
IF= @randomenc5
COMPARE #<encounterColumn>, "6"
IF= @randomenc6
COMPARE #<encounterColumn>, "7"
IF= @randomenc7
COMPARE #<encounterColumn>, "8"
IF= @randomenc8
COMPARE #<encounterColumn>, "9"
IF= @randomenc9
COMPARE #<encounterColumn>, "10"
IF= @randomenc10
RETURN
@randomenc1
CALL #<str.DevTableCOL1>@scenestart
RETURN
@randomenc2
CALL #<str.DevTableCOL2>@scenestart
RETURN
@randomenc3
CALL #<str.DevTableCOL3>@scenestart
RETURN
@randomenc4
CALL #<str.DevTableCOL4>@scenestart
RETURN
@randomenc5
CALL #<str.DevTableCOL5>@scenestart
RETURN
@randomenc6
CALL #<str.DevTableCOL6>@scenestart
RETURN
@randomenc7
CALL #<str.DevTableCOL7>@scenestart
RETURN
@randomenc8
CALL #<str.DevTableCOL8>@scenestart
RETURN
@randomenc9
CALL #<str.DevTableCOL9>@scenestart
RETURN
@randomenc10
CALL #<str.DevTableCOL10>@scenestart
RETURN
@seed
CALL 9003@scenestart
RETURN
; Rest script. This is the main way of healing outside of combat. The player character gets 2 short rests per long rest. 
@rest
MENU "Short Rest=@shortrest", "Long Rest=@longrest"
RETURN
@shortrest
COMPARE #<shortRests>, "0"
IF>, @short
N: You cannot take any more short rests today.
RETURN
@short
N: You decide to rest for a while.
IF C2, @wizardshort
SET shortHPRecovery, #<num.hostMaxHP>
DIV shortHPRecovery, "2"
GIVE H#<shortHPRecovery>
SUB shortRests, "1"
RETURN
@wizardshort
SET shortHPRecovery, #<num.hostMaxHP>
DIV shortHPRecovery, "2"
GIVE H#<shortHPRecovery>
SET shortMPRecovery, #<num.hostMaxMP>
DIV shortMPRecovery, "2"
GIVE M#<shortMPRecovery>
SUB shortRests, "1"
RETURN
@longrest
IF I14, @long
N: You need a Camp Supply Pack to be able to long rest outside of an inn.
RETURN
@long
N: You make camp for the night.
SET shortRests, "2"
GIVE L1
GIVE H5000
GIVE M5000
TAKE I14
RETURN
;Random NPC generation. arg0 in the CALL should be the name of the skin to use, and arg1 should be either humans or animals. Arg2 specifies color table. Arg3 specifies npc name. 
; Arg4 specifies actor ID
@npcgen
SET num.DevTableId, 03
STRCMP #<arg1>, "humans"
IF=, @humannpc
STRCMP #<arg1>, "animals"
IF=, @animalnpc
N: You spelled something wrong.
RETURN
@humannpc
SET str.DevTableRowId, "#<num.mapNum>humans"
SET poseFrame, "%R12"
COMPARE #<poseFrame>, 1
IF= @humannpc1
COMPARE #<poseFrame>, 2
IF= @humannpc2
COMPARE #<poseFrame>, 3
IF= @humannpc3
COMPARE #<poseFrame>, 4
IF= @humannpc4
COMPARE #<poseFrame>, 5
IF= @humannpc5
COMPARE #<poseFrame>, 6
IF= @humannpc6
COMPARE #<poseFrame>, 7
IF= @humannpc7
COMPARE #<poseFrame>, 8
IF= @humannpc8
COMPARE #<poseFrame>, 9
IF= @humannpc9
COMPARE #<poseFrame>, 10
IF= @humannpc10
COMPARE #<poseFrame>, 11
IF= @humannpc11
COMPARE #<poseFrame>, 12
IF= @humannpc12
RETURN
@humannpc1
SET humanSprite, #<str.DevTableCOL1>
GOTO @createhuman
@humannpc2
SET humanSprite, #<str.DevTableCOL2>
GOTO @createhuman
@humannpc3
SET humanSprite, #<str.DevTableCOL3>
GOTO @createhuman
@humannpc4
SET humanSprite, #<str.DevTableCOL4>
GOTO @createhuman
@humannpc5
SET humanSprite, #<str.DevTableCOL5>
GOTO @createhuman
@humannpc6
SET humanSprite, #<str.DevTableCOL6>
GOTO @createhuman
@humannpc7
SET humanSprite, #<str.DevTableCOL7>
GOTO @createhuman
@humannpc8
SET humanSprite, #<str.DevTableCOL8>
GOTO @createhuman
@humannpc9
SET humanSprite, #<str.DevTableCOL9>
GOTO @createhuman
@humannpc10
SET humanSprite, #<str.DevTableCOL10>
GOTO @createhuman
@humannpc11
SET humanSprite, #<str.DevTableCOL11>
GOTO @createhuman
@humannpc12
SET humanSprite, #<str.DevTableCOL12>
GOTO @createhuman
RETURN
@createhuman
ACTOR #<arg4>, #<arg3>, #<arg0>, #<humanSprite>, 40, 90, #<arg2>
RETURN
@animalnpc
SET str.DevTableRowId, "#<num.mapNum>animals"
SET poseFrame, "%R12"
COMPARE #<poseFrame>, 1
IF= @animalnpc1
COMPARE #<poseFrame>, 2
IF= @animalnpc2
COMPARE #<poseFrame>, 3
IF= @animalnpc3
COMPARE #<poseFrame>, 4
IF= @animalnpc4
COMPARE #<poseFrame>, 5
IF= @animalnpc5
COMPARE #<poseFrame>, 6
IF= @animalnpc6
COMPARE #<poseFrame>, 7
IF= @animalnpc7
COMPARE #<poseFrame>, 8
IF= @animalnpc8
COMPARE #<poseFrame>, 9
IF= @animalnpc9
COMPARE #<poseFrame>, 10
IF= @animalnpc10
COMPARE #<poseFrame>, 11
IF= @animalnpc11
COMPARE #<poseFrame>, 12
IF= @animalnpc12
RETURN
@animalnpc1
SET animalSprite, #<str.DevTableCOL1>
GOTO @createanimal
@animalnpc2
SET animalSprite, #<str.DevTableCOL2>
GOTO @createanimal
@animalnpc3
SET animalSprite, #<str.DevTableCOL3>
GOTO @createanimal
@animalnpc4
SET animalSprite, #<str.DevTableCOL4>
GOTO @createanimal
@animalnpc5
SET animalSprite, #<str.DevTableCOL5>
GOTO @createanimal
@animalnpc6
SET animalSprite, #<str.DevTableCOL6>
GOTO @createanimal
@animalnpc7
SET animalSprite, #<str.DevTableCOL7>
GOTO @createanimal
@animalnpc8
SET animalSprite, #<str.DevTableCOL8>
GOTO @createanimal
@animalnpc9
SET animalSprite, #<str.DevTableCOL9>
GOTO @createanimal
@animalnpc10
SET animalSprite, #<str.DevTableCOL10>
GOTO @createanimal
@animalnpc11
SET animalSprite, #<str.DevTableCOL11>
GOTO @createanimal
@animalnpc12
SET animalSprite, #<str.DevTableCOL12>
GOTO @createanimal
RETURN
@createanimal
ACTOR #<arg4>, #<arg3>, #<arg0>, #<animalSprite>, 40, 90, #<arg2>
RETURN
;This is a testing scene so i can check individual things.
SCENE 9991, #<scene.bkgnd>, 0, "Internal Testing Scene", 0, 0, 0
CALL 9990@skillcheck, athleticism, #<num.hostSTR>, 0, 10
COMPARE #<finalResult>, "2"
IF= @critsucceeded
COMPARE #<finalResult>, "1"
IF= @succeeded
COMPARE #<finalResult>, "0"
IF= @failed
END
@critsucceeded
N: You rolled a natural 20!
END
@succeeded
N: you succeeded the roll.
END
@failed
N: you failed the roll.
END
SCENE 9992, #<scene.bkgnd>, SCENE, "Randomized Dialogue", 0, 0, 0
@beachanimal1
2: You ever been to Maisy's cabin, opposite the sea cave? She's a bit crazy, but she catches some tasty fish.
RETURN
@beachanimal2
2: I saw a mermaid in the sea cave the other day!
RETURN
@beachanimal3
2: The sahuagin over in the cave look like they're getting ready to attack the village up the hill.
RETURN
@beachbones1
2: Damn sahuagin got me. Be careful of their war-jellies. Those tendrils can poison you.
RETURN
@beachbones2
2: Be wary of the water bugs in the cave. They like to attack unsuspecting fishermen.
RETURN
@beachbones3
2: Shouldn't have gone into that sea cave looking for the treasure there. Nothing but sahuagin and death to be found there.
RETURN
@caveanimal1
2: I saw one of the Baron's guards take a sheep deeper into the cave.
RETURN
@caveanimal2
2: The mermaid that lives in this cave likes shiny things.
RETURN
@caveanimal3
2: The Baron keeps a jewel-encrusted trident in the hole in the middle of his pool.
RETURN
@cavebones1
2: I should have bought that spell scroll of Burning Hands from Amelia before I came out here.
RETURN
@cavebones2
2: Don't be foolish like me. If a monster outmatches you, there's no shame in retreating.
RETURN
@cavebones3
2: That Baron's a tough customer. Don't forget to bring a way to heal yourself.
RETURN
@forestanimal1
2: I saw a troll coming down from the mountains towards Oakhurst!
RETURN
@forestanimal2
2: They say a sea hag used to live near here, and her cauldron ended up somewhere in the lake after she died.
RETURN
@forestanimal3
2: That big tower on the island in the lake sometimes has lights coming out of it.
RETURN
@forestanimal4
2: I've seen a bunch of scary looking men coming in and out of the fortress to the northeast.
RETURN
@forestanimal5
2: A child from Oakhurst passed through here recently, going towards the lighthouse north of here.
RETURN
@forestanimal6
2: One of the seagulls told me they saw pirates fighting sahuagin off the northern coast.
RETURN
@forestbones1
2: If you see someone who looks a lot like you, be careful. They could be a doppelganger looking to replace you.
RETURN
@forestbones2
2: This forest is thick with bandits. Try not to look like an easy target.
RETURN
@forestbones3
2: They may look small and cute, but pixies have some nasty magic.
RETURN
@forestbones4
2: That cave behind the waterfall to the south is full of poison gas. 
RETURN
@forestbones5
2: The tower to the southwest used to belong to a mad wizard, and its defenses survive to this day.
RETURN
@forestbones6
2: If you're fishing around here, be mindful of the quippers. They'll try to eat you just as readily as anything else.
RETURN
SCENE 9993, #<scene.bkgnd>, 0, "scripts 2 electric boogaloo", 0, 0, 0
;CALLs made to these scripts should have no arg cookies so as to not upset the programming gods
@fishingcheck
SET fishingMod, "#<num.hostSTR>"
DIV fishingMod, "40"
SET fishingRoll, "%R20"
COMPARE #<fishingRoll>, "20"
IF= @critical
ADD fishingRoll, "#<fishingMod>"
IF E121, @braided
IF E122, @drowsilk
IF E123, @enchanted
IF E124, @mermaidhair
RETURN
@braided
ADD fishingRoll, "2"
RETURN
@drowsilk
ADD fishingRoll, "4"
RETURN
@enchanted
ADD fishingRoll, "6"
RETURN
@mermaidhair
ADD fishingRoll, "10"
RETURN
@critical
ADD fishingRoll, "99"
RETURN
;-------------------------------------------------------------------------------------------------
SCENE 9994, parchmentbook, CUT, "Maisy's Journal", 0, 0, 0
	GIVE I130
	SET pageNumber, "1"
	SET num.DevTableId, "06"
	SET fishRow1, "1"
	SET fishRow2, "2"
	SET fishRow3, "3"
	SET fishRow4, "4"
	CALL @updatefishingrecords
@fishbuttonsetup
	SET str.DevTableRowId, "fish#<fishRow1>"
	ACTOR 1, #<str.DevTableCOL1>, #<str.DevTableCOL2>, 1, 25, 25
	SET str.DevTableRowId, "fish#<fishRow2>"
	ACTOR 2, #<str.DevTableCOL1>, #<str.DevTableCOL2>, 2, 75, 25
	SET str.DevTableRowId, "fish#<fishRow3>"
	ACTOR 3, #<str.DevTableCOL1>, #<str.DevTableCOL2>, 3, 25, 75
	SET str.DevTableRowId, "fish#<fishRow4>"
	ACTOR 4, #<str.DevTableCOL1>, #<str.DevTableCOL2>, 4, 75, 75
	ACTOR 5, "Previous Page", "journalui", 1, 5, 95
	ACTOR 6, "Next Page", "journalui", 2, 95, 95
	COMPARE #<pageNumber>, "1"
	IF= @moveprev
	COMPARE #<pageNumber>, "2"
	IF= @movenext
	END
@moveprev
	MOVE 5, -10, 95, 1
	END
@movenext
	MOVE 6, -10, 95, 1
	END 
@eventActorClick1
	SET str.DevTableRowId, "fish#<fishRow1>"
		N: Current Record Holder: *#<str.DevTableCOL4>.
		N: Current Record: *#<str.DevTableCOL3> #<str.DevTableCOL5>.
END
@eventActorClick2
	SET str.DevTableRowId, "fish#<fishRow2>"
		N: Current Record Holder: *#<str.DevTableCOL4>.
		N: Current Record: *#<str.DevTableCOL3> #<str.DevTableCOL5>.
END
@eventActorClick3
	SET str.DevTableRowId, "fish#<fishRow3>"
		N: Current Record Holder: *#<str.DevTableCOL4>.
		N: Current Record: *#<str.DevTableCOL3> #<str.DevTableCOL5>.
END
@eventActorClick4
	SET str.DevTableRowId, "fish#<fishRow4>"
		N: Current Record Holder: *#<str.DevTableCOL4>.
		N: Current Record: *#<str.DevTableCOL3> #<str.DevTableCOL5>.
END
@eventActorClick5
	SUB fishRow1, "4"
	SUB fishRow2, "4"
	SUB fishRow3, "4"
	SUB fishRow4, "4"
	SUB pageNumber, "1"
	GOTO @fishbuttonsetup
END
@eventActorClick6
	ADD fishRow1, "4"
	ADD fishRow2, "4"
	ADD fishRow3, "4"
	ADD fishRow4, "4"
	ADD pageNumber, "1"
	GOTO @fishbuttonsetup
END
@updatefishrecords
	COMPARE #<shadRecord>, "5"
	IF< @shadrecordupdate
	COMPARE #<codRecord>, "9"
	IF< @codrecordupdate
	COMPARE #<salmonRecord>, "10"
	IF< @salmonrecordupdate
	COMPARE #<herringRecord>, "9"
	IF< @herringrecordupdate
	COMPARE #<carpRecord>, "11"
	IF< @carprecordupdate
	COMPARE #<goldfishRecord>, "5"
	IF< @goldfishrecordupdate
	COMPARE #<troutRecord>, "10"
	IF< @troutrecordupdate
	COMPARE #<perchRecord>, "6"
	IF< @perchrecordupdate
RETURN
@shadrecordupdate
	SET shadRecordHolder, "Maisy"
	SET shadRecord, "5"
	GOTO @updatefishrecords
@codrecordupdate
	SET codRecordHolder, "Maisy"
	SET codRecord, "9"
	GOTO @updatefishrecords
@salmonrecordupdate
	SET salmonRecordHolder, "Maisy"
	SET salmonRecord, "10"
	GOTO @updatefishrecords
@herringrecordupdate
	SET herringRecordHolder, "Maisy"
	SET herringRecord, "9"
	GOTO @updatefishrecords
@carprecordupdate
	SET carpRecordHolder, "Maisy"
	SET carpRecord, "11"
	GOTO @updatefishrecords
@goldfishrecordupdate
	SET goldfishRecordHolder, "Maisy"
	SET goldfishRecord, "5"
	GOTO @updatefishrecords
@troutrecordupdate
	SET troutRecordHolder, "Maisy"
	SET troutRecord, "10"
	GOTO @updatefishrecords
@perchrecordupdate
	SET perchRecordHolder, "Maisy"
	SET perchRecord, "6"
	GOTO @updatefishrecords
RETURN
