summary refs log tree commit diff stats
path: root/res/scripts
diff options
context:
space:
mode:
Diffstat (limited to 'res/scripts')
-rw-r--r--res/scripts/common.lua59
-rw-r--r--res/scripts/hallucination_hot_spring.lua2
-rw-r--r--res/scripts/hallucination_interior.lua3
-rw-r--r--res/scripts/pink_shell.lua148
4 files changed, 212 insertions, 0 deletions
diff --git a/res/scripts/common.lua b/res/scripts/common.lua index 1b0c4a9..dad9c5d 100644 --- a/res/scripts/common.lua +++ b/res/scripts/common.lua
@@ -30,6 +30,12 @@ SpriteLayer = {
30 ABOVE = 1 30 ABOVE = 1
31} 31}
32 32
33BehaviourType = {
34 NONE = 0,
35 WANDER = 1,
36 PATH = 2
37}
38
33CutsceneOptions = { 39CutsceneOptions = {
34 DO_NOT_CHANGE_ANIMATION = 1 -- Prevents player party animation being set to "frozen" at the start of a cutscene or "still" at the end 40 DO_NOT_CHANGE_ANIMATION = 1 -- Prevents player party animation being set to "frozen" at the start of a cutscene or "still" at the end
35} 41}
@@ -426,6 +432,13 @@ function WaitForSpritePath(spriteName)
426 end 432 end
427end 433end
428 434
435--- Turns off the sprite's behaviour.
436function DisableBehaviour(spriteName)
437 local spriteId = getSpriteByAlias(spriteName)
438 local sprite = getSprite(spriteId)
439 sprite.behaviourType = BehaviourType.NONE
440end
441
429--- Fades out the currently playing music. 442--- Fades out the currently playing music.
430-- This does not block. If you want it to block, call Delay for the same amount 443-- This does not block. If you want it to block, call Delay for the same amount
431-- of time. 444-- of time.
@@ -456,3 +469,49 @@ function EnablePlayerControl()
456 local playerSprite = getSprite(playerId) 469 local playerSprite = getSprite(playerId)
457 playerSprite.controllable = true 470 playerSprite.controllable = true
458end 471end
472
473--- Makes the specified sprite face toward the †arget sprite.
474-- This version of the function uses the closest cardinal direction.
475-- @param spriteName the name of the sprite to change the direction of
476-- @param targetName the name of the sprite to face toward
477function FaceTowardSpriteCardinally(spriteName, targetName)
478 local spriteId = getSpriteByAlias(spriteName)
479 local targetId = getSpriteByAlias(targetName)
480 local sprite = getSprite(spriteId)
481 local target = getSprite(targetId)
482 local diff = vec2i.new(target.loc:x() - sprite.loc:x(), target.loc:y() - sprite.loc:y())
483 local dir = cardinalDirectionFacingPoint(diff)
484
485 SetDirection(spriteName, dir)
486end
487
488--- Detaches the sprite's followers and erases their following trails.
489function BreakUpParty(spriteName)
490 local spriteId = getSpriteByAlias(spriteName)
491 character():breakUpParty(spriteId)
492end
493
494--- Makes the specified sprite solid.
495-- This means that other sprites will be blocked if they collide with this one.
496function MakeSpriteSolid(spriteName)
497 local spriteId = getSpriteByAlias(spriteName)
498 local sprite = getSprite(spriteId)
499 sprite.solid = true
500end
501
502--- Makes the specified sprite not solid.
503-- This means that other sprites will not be blocked if they collide with this
504-- one.
505function MakeSpriteNotSolid(spriteName)
506 local spriteId = getSpriteByAlias(spriteName)
507 local sprite = getSprite(spriteId)
508 sprite.solid = false
509end
510
511--- Sets the sprite's movement speed.
512-- As a reference: 1 is slow (good for NPCs), 2 is Lucas's default walking speed
513function SetMovementSpeed(spriteName, speed)
514 local spriteId = getSpriteByAlias(spriteName)
515 local sprite = getSprite(spriteId)
516 sprite.movementSpeed = speed
517end
diff --git a/res/scripts/hallucination_hot_spring.lua b/res/scripts/hallucination_hot_spring.lua index c432eb3..805f85a 100644 --- a/res/scripts/hallucination_hot_spring.lua +++ b/res/scripts/hallucination_hot_spring.lua
@@ -14,6 +14,8 @@ function hallucination_hot_spring.off_right()
14end 14end
15 15
16function hallucination_hot_spring.enter_hot_spring() 16function hallucination_hot_spring.enter_hot_spring()
17 gamestate.went_in_hot_spring = true
18
17 if gamestate.ionia_in_water then 19 if gamestate.ionia_in_water then
18 -- Soft cutscene start; don't show bars but do take away control 20 -- Soft cutscene start; don't show bars but do take away control
19 DisablePlayerControl() 21 DisablePlayerControl()
diff --git a/res/scripts/hallucination_interior.lua b/res/scripts/hallucination_interior.lua index 4fbaa99..9ef808e 100644 --- a/res/scripts/hallucination_interior.lua +++ b/res/scripts/hallucination_interior.lua
@@ -45,6 +45,9 @@ function hallucination_interior.join_claus()
45 45
46 local clausSprite = getSprite(clausId) 46 local clausSprite = getSprite(clausId)
47 clausSprite.persistent = true 47 clausSprite.persistent = true
48
49 gamestate.claus_joined = true
50 gamestate.still_has_claus = true
48 else 51 else
49 DisplayMessage("* You won't let me join in?\nWhy not? Why not?\n\f* Why won't you let me join in?", "Claus", SpeakerType.MAN) 52 DisplayMessage("* You won't let me join in?\nWhy not? Why not?\n\f* Why won't you let me join in?", "Claus", SpeakerType.MAN)
50 WaitForEndOfMessage() 53 WaitForEndOfMessage()
diff --git a/res/scripts/pink_shell.lua b/res/scripts/pink_shell.lua index 4223188..5747186 100644 --- a/res/scripts/pink_shell.lua +++ b/res/scripts/pink_shell.lua
@@ -16,4 +16,152 @@ end
16 16
17function pink_shell.talk_to_mixolydia() 17function pink_shell.talk_to_mixolydia()
18 SetDirection("mixolydia", Direction.UP) 18 SetDirection("mixolydia", Direction.UP)
19 SetAnimation("mixolydia", "talk")
20 StartCutscene()
21 DisplayMessage("* Oh, me, oh, my! We have visitors! `", "Mixolydia", SpeakerType.WOMAN)
22 WaitForEndOfMessage()
23
24 SetAnimation("mixolydia", "still")
25 Delay(500)
26
27 SetDirection("mixolydia", Direction.DOWN)
28 Delay(1000)
29
30 if gamestate.went_in_hot_spring then
31 SetAnimation("mixolydia", "talk")
32 DisplayMessage("* ...You people stink.", "Mixolydia", SpeakerType.WOMAN)
33 WaitForEndOfMessage()
34
35 SetAnimation("mixolydia", "still")
36 Delay(1000)
37 end
38
39 FaceTowardSpriteCardinally("mixolydia", "lucas")
40 ShowExpression("mixolydia", "confusion")
41 Delay(1000)
42
43 RemoveExpression("mixolydia")
44 SetAnimation("mixolydia", "talk")
45 DisplayMessage("* Oh, wait a minute...", "Mixolydia", SpeakerType.WOMAN)
46 WaitForEndOfMessage()
47
48 SetAnimation("mixolydia", "still")
49 Delay(1000)
50
51 SetAnimation("mixolydia", "talk")
52 DisplayMessage("* Are you Lucas?", "Mixolydia", SpeakerType.WOMAN)
53 ShowChoice("Yes", "No")
54 WaitForEndOfMessage()
55
56 if GetChoiceSelection() == 1 then
57 DisplayMessage("* This island really has done a number on you.\n\f* But I'll humor you and listen anyway.", "Mixolydia", SpeakerType.WOMAN)
58 WaitForEndOfMessage()
59 end
60
61 if gamestate.went_in_hot_spring then
62 SetAnimation("mixolydia", "still")
63 Delay(1000)
64
65 SetAnimation("mixolydia", "talk")
66 DisplayMessage("* ...Wow, you guys really stink.", "Mixolydia", SpeakerType.WOMAN)
67 WaitForEndOfMessage()
68 end
69
70 SetAnimation("mixolydia", "still")
71 Delay(2000)
72
73 SetAnimation("mixolydia", "talk")
74 DisplayMessage("* Ionia told me about you. `\n\f* I'm Mixolydia, one of the Magifolk. `\n\f* If that's too hard to remember, <Mixo>...\n... no, <Missy> will do just fine. `", "Mixolydia", SpeakerType.WOMAN)
75 WaitForEndOfMessage()
76
77 SetAnimation("mixolydia", "still")
78 Delay(2000)
79
80 SetAnimation("mixolydia", "talk")
81 DisplayMessage("* Okay... Line up here.", "Mixolydia", SpeakerType.WOMAN)
82 WaitForEndOfMessage()
83
84 SetAnimation("mixolydia", "still")
85 Delay(1000)
86
87 -- direct everyone to stand in their positions
88 BreakUpParty("lucas")
89 MakeSpriteNotSolid("lucas")
90 MakeSpriteNotSolid("mixolydia")
91
92 UnpauseSprite("lucas")
93 SetMovementSpeed("lucas", 1)
94 DirectSpriteToLocation("lucas", "lucas_lineup", PathfindingOptions.CARDINAL_DIRECTIONS_ONLY)
95 WaitForSpritePath("lucas")
96 DisableBehaviour("lucas")
97 SetDirection("lucas", Direction.DOWN)
98 SetAnimation("lucas", "tired")
99 PauseSprite("lucas")
100 SetMovementSpeed("lucas", 2)
101 Delay(100)
102
103 UnpauseSprite("kuma")
104 SetMovementSpeed("kuma", 1)
105 DirectSpriteToLocation("kuma", "kumatora_lineup", PathfindingOptions.CARDINAL_DIRECTIONS_ONLY)
106 WaitForSpritePath("kuma")
107 DisableBehaviour("kuma")
108 SetDirection("kuma", Direction.DOWN)
109 SetAnimation("kuma", "tired")
110 PauseSprite("kuma")
111 SetMovementSpeed("kuma", 0)
112 Delay(100)
113
114 UnpauseSprite("duster")
115 SetMovementSpeed("duster", 1)
116 DirectSpriteToLocation("duster", "duster_lineup", PathfindingOptions.CARDINAL_DIRECTIONS_ONLY)
117 WaitForSpritePath("duster")
118 DisableBehaviour("duster")
119 SetDirection("duster", Direction.DOWN)
120 SetAnimation("duster", "tired")
121 PauseSprite("duster")
122 SetMovementSpeed("duster", 0)
123 Delay(100)
124
125 UnpauseSprite("boney")
126 SetMovementSpeed("boney", 1)
127 DirectSpriteToLocation("boney", "boney_lineup", PathfindingOptions.CARDINAL_DIRECTIONS_ONLY)
128 WaitForSpritePath("boney")
129 DisableBehaviour("boney")
130 SetDirection("boney", Direction.DOWN)
131 SetAnimation("boney", "tired")
132 PauseSprite("boney")
133 SetMovementSpeed("boney", 0)
134 Delay(100)
135
136 if gamestate.still_has_claus then
137 UnpauseSprite("join_claus")
138 SetMovementSpeed("join_claus", 1)
139 DirectSpriteToLocation("join_claus", "claus_lineup", PathfindingOptions.CARDINAL_DIRECTIONS_ONLY)
140 WaitForSpritePath("join_claus")
141 DisableBehaviour("join_claus")
142 SetDirection("join_claus", Direction.DOWN)
143 SetAnimation("join_claus", "tired")
144 PauseSprite("join_claus")
145 SetMovementSpeed("join_claus", 0)
146 end
147
148 MakeSpriteSolid("lucas")
149 Delay(1000)
150
151 if gamestate.went_in_hot_spring then
152 SetAnimation("mixolydia", "talk")
153 DisplayMessage("* ...Yuck. What a stench.", "Mixolydia", SpeakerType.WOMAN)
154 WaitForEndOfMessage()
155
156 SetAnimation("mixolydia", "still")
157 Delay(1000)
158 end
159
160 SetAnimation("mixolydia", "talk")
161 DisplayMessage("* Tanetane Island...\nIt wreaks havoc on a person's mind.\n\f* Every trauma you've suffered is pulled out.\n\f* The things down there tear at your weaknesses and the scars in your heart.\n\f* But I'll bring you back to your senses now. `", "Mixolydia", SpeakerType.WOMAN)
162 WaitForEndOfMessage()
163
164 SetAnimation("mixolydia", "still")
165
166 -- TODO: rest of scene
19end 167end