1-- Set the namespace according to the map name.
2local ns = {};
3setmetatable(ns, {__index = _G});
4layna_forest_wolf_cave_script = ns;
5setfenv(1, ns);
6
7-- The map name, subname and location image
8map_name = "Layna Forest Cave"
9map_image_filename = "data/story/common/locations/desert_cave.png"
10map_subname = ""
11
12-- The music file used as default background music on this map.
13-- Other musics will have to handled through scripting.
14music_filename = "data/music/shrine-OGA-yd.ogg"
15
16-- c++ objects instances
17local Map = nil
18local EventManager = nil
19
20-- the main character handler
21local hero = nil
22
23-- Dialogue sprites
24local bronann = nil
25local kalya = nil
26
27-- the main map loading code
28function Load(m)
29
30    Map = m;
31    EventManager = Map:GetEventSupervisor();
32    Map:SetUnlimitedStamina(false);
33
34    Map:SetMinimapImage("data/story/layna_forest/minimaps/layna_forest_wolf_cave_minimap.png");
35
36    _CreateCharacters();
37    _CreateObjects();
38
39    -- Set the camera focus on hero
40    Map:SetCamera(hero);
41    -- This is a dungeon map, we'll use the front battle member sprite as default sprite.
42    Map:SetPartyMemberVisibleSprite(hero);
43
44    _CreateEvents();
45    _CreateZones();
46
47    -- Add a mediumly dark overlay
48    Map:GetEffectSupervisor():EnableAmbientOverlay("data/visuals/ambient/dark.png", 0.0, 0.0, false);
49
50    -- Trigger the dialogue at entrance if not done yet.
51    if (GlobalManager:GetGameEvents():GetEventValue("story", "layna_forest_crystal_event_done") == 0 and
52            GlobalManager:GetGameEvents():DoesEventExist("story", "kalya_speech_in_wolf_cave") == false) then
53        hero:SetMoving(false);
54        hero:SetDirection(vt_map.MapMode.NORTH);
55        EventManager:StartEvent("Wolf cave entrance dialogue", 200);
56    end
57end
58
59-- the map update function handles checks done on each game tick.
60function Update()
61    -- Check whether the character is in one of the zones
62    _CheckZones();
63end
64
65-- Character creation
66function _CreateCharacters()
67    -- Default hero and position
68    hero = CreateSprite(Map, "Bronann", 26, 46, vt_map.MapMode.GROUND_OBJECT);
69    hero:SetDirection(vt_map.MapMode.NORTH);
70    hero:SetMovementSpeed(vt_map.MapMode.NORMAL_SPEED);
71
72    if (GlobalManager:GetMapData():GetPreviousLocation() == "from_layna_cave_1_2") then
73        hero:SetDirection(vt_map.MapMode.EAST);
74        hero:SetPosition(3, 27);
75    end
76
77    bronann = CreateSprite(Map, "Bronann", 0, 0, vt_map.MapMode.GROUND_OBJECT);
78    bronann:SetDirection(vt_map.MapMode.WEST);
79    bronann:SetMovementSpeed(vt_map.MapMode.NORMAL_SPEED);
80    bronann:SetCollisionMask(vt_map.MapMode.NO_COLLISION);
81    bronann:SetVisible(false);
82
83    kalya = CreateSprite(Map, "Kalya", 0, 0, vt_map.MapMode.GROUND_OBJECT);
84    kalya:SetDirection(vt_map.MapMode.NORTH);
85    kalya:SetMovementSpeed(vt_map.MapMode.NORMAL_SPEED);
86    kalya:SetCollisionMask(vt_map.MapMode.NO_COLLISION);
87    kalya:SetVisible(false);
88end
89
90-- a necklace obtained by kalya and triggering the seconde fight against the fenrir.
91local necklace = nil
92local necklace_npc = nil
93local light_tilt = nil
94
95local wolf = nil
96
97-- The heal particle effect map object
98local heal_effect = nil
99
100function _CreateObjects()
101    local object = nil
102    local npc = nil
103    local event = nil
104    local text = nil
105
106    -- Adapt the light color according to the time of the day.
107    local light_color_red = 1.0;
108    local light_color_green = 1.0;
109    local light_color_blue = 1.0;
110    local light_color_alpha = 0.8;
111    if (GlobalManager:GetGameEvents():GetEventValue("story", "layna_forest_crystal_event_done") == 1) then
112        local tw_value = GlobalManager:GetGameEvents():GetEventValue("story", "layna_forest_twilight_value");
113        if (tw_value >= 4 and tw_value < 6) then
114            light_color_red = 0.83;
115            light_color_green = 0.72;
116            light_color_blue = 0.70;
117            light_color_alpha = 0.29;
118        elseif (tw_value >= 6 and tw_value < 8) then
119            light_color_red = 0.62;
120            light_color_green = 0.50;
121            light_color_blue = 0.59;
122            light_color_alpha = 0.49;
123        elseif (tw_value >= 8) then
124            light_color_red = 0.30;
125            light_color_green = 0.30;
126            light_color_blue = 0.46;
127            light_color_alpha = 0.60;
128        end
129    end
130
131    -- Add a halo showing the cave entrances
132    vt_map.Halo.Create("data/visuals/lights/torch_light_mask.lua", 28, 59,
133            vt_video.Color(light_color_red, light_color_green, light_color_blue, light_color_alpha));
134
135    -- Add different halo light, representing holes of light coming from the ceiling
136    vt_map.Halo.Create("data/visuals/lights/right_ray_light.lua", 28, 17,
137            vt_video.Color(light_color_red, light_color_green, light_color_blue, light_color_alpha));
138
139    -- Add the wolfpain necklace, triggering the second battle with the fenrir
140    -- As this object is special, we're not using the object catalogue to only load that one once.
141    necklace = vt_map.PhysicalObject.Create(vt_map.MapMode.GROUND_OBJECT);
142    necklace:SetPosition(30, 9);
143    necklace:SetCollPixelHalfWidth(16);
144    necklace:SetCollPixelHeight(32);
145    necklace:SetImgPixelHalfWidth(16);
146    necklace:SetImgPixelHeight(32);
147    necklace:AddAnimation("data/story/layna_forest/wolfpain_necklace.lua");
148
149    -- Adds a light tilting to catch the player attention
150    light_tilt = vt_map.PhysicalObject.Create(vt_map.MapMode.GROUND_OBJECT);
151    light_tilt:SetCollisionMask(vt_map.MapMode.NO_COLLISION);
152    light_tilt:SetPosition(30, 9.1);
153    light_tilt:SetCollPixelHalfWidth(16);
154    light_tilt:SetCollPixelHeight(32);
155    light_tilt:SetImgPixelHalfWidth(16);
156    light_tilt:SetImgPixelHeight(32);
157    light_tilt:AddAnimation("data/visuals/lights/light_reverb.lua");
158
159    -- Adds an associated npc to permit the dialogue to trigger
160    necklace_npc = CreateSprite(Map, "Butterfly", 30, 9.2, vt_map.MapMode.GROUND_OBJECT);
161    necklace_npc:SetCollisionMask(vt_map.MapMode.NO_COLLISION);
162    necklace_npc:SetVisible(false);
163    necklace_npc:SetName(""); -- Unset the speaker name
164
165    dialogue = vt_map.SpriteDialogue.Create();
166    text = vt_system.Translate("(Bronann looks at the ground)");
167    dialogue:AddLineEvent(text, necklace_npc, "", "wolfpain necklace dialogue start");
168    necklace_npc:AddDialogueReference(dialogue);
169
170    -- Place all the jewel related object out of reach when the event is already done
171    -- or the wolf beaten in the crystal map.
172    if (GlobalManager:GetGameEvents():DoesEventExist("story", "wolfpain_necklace_obtained") == true
173            or GlobalManager:GetGameEvents():GetEventValue("story", "layna_forest_crystal_event_done") == 1) then
174        necklace_npc:SetPosition(0, 0);
175
176        light_tilt:SetVisible(false);
177        necklace:SetVisible(false);
178        necklace:SetPosition(0, 0);
179    end
180
181    -- The boss map sprite
182    wolf = CreateSprite(Map, "Fenrir", 0, 0, vt_map.MapMode.GROUND_OBJECT); -- pre place it at the right place.
183    wolf:SetCollisionMask(vt_map.MapMode.NO_COLLISION);
184    wolf:SetMovementSpeed(vt_map.MapMode.VERY_FAST_SPEED);
185    wolf:SetVisible(false);
186    wolf:SetDirection(vt_map.MapMode.NORTH);
187
188    -- Drink at the fountain
189    npc = CreateSprite(Map, "Butterfly", 53, 12, vt_map.MapMode.GROUND_OBJECT);
190    npc:SetCollisionMask(vt_map.MapMode.NO_COLLISION);
191    npc:SetVisible(false);
192    npc:SetName(""); -- Unset the speaker name
193
194    -- Add the dialogue options on the fountain
195    dialogue = vt_map.SpriteDialogue.Create();
196    text = vt_system.Translate("This water looks weird. Shall we drink it anyway?");
197    dialogue:AddLine(text, kalya);
198    text = vt_system.Translate("...");
199    dialogue:AddLine(text, npc);
200    text = vt_system.Translate("Yes, I'm so thirsty.");
201    dialogue:AddOption(text, 2);
202    text = vt_system.Translate("No way, we'd get sick.");
203    dialogue:AddOption(text, 3);
204    -- [Line 2] Drink it
205    text = vt_system.Translate("The party drinks the water and feels... alright?");
206    dialogue:AddLineEvent(text, npc, 4, "", "Fountain heal"); -- 4 = Past the dialogue lines number. Makes the dialogue ends.
207    -- [Line 3] Won't drink it
208    text = vt_system.Translate("The party won't drink it.");
209    dialogue:AddLine(text, npc);
210    npc:AddDialogueReference(dialogue);
211
212    -- Load the spring heal effect.
213    heal_effect = vt_map.ParticleObject.Create("data/visuals/particle_effects/heal_sp_particle.lua", 0, 0, vt_map.MapMode.GROUND_OBJECT);
214    heal_effect:Stop(); -- Don't run it until the character heals itself
215
216    vt_map.SoundObject.Create("data/sounds/fountain_small.ogg", 53.0, 8.0, 8.0);
217end
218
219-- Special event references which destinations must be updated just before being called.
220local move_next_to_bronann_event = nil
221local move_next_to_bronann_event2 = nil
222
223-- Creates all events and sets up the entire event sequence chain
224function _CreateEvents()
225    local event = nil
226    local dialogue = nil
227    local text = nil
228
229    -- Map transition events
230    vt_map.MapTransitionEvent.Create("to cave 1-2", "data/story/layna_forest/layna_forest_cave1_2_map.lua",
231                                     "data/story/layna_forest/layna_forest_cave1_2_script.lua", "from_layna_wolf_cave");
232
233    vt_map.MapTransitionEvent.Create("to south east exit", "data/story/layna_forest/layna_forest_south_east_map.lua",
234                                     "data/story/layna_forest/layna_forest_south_east_script.lua", "from_layna_wolf_cave");
235
236    -- SP Heal event on fountain
237    vt_map.ScriptedEvent.Create("Fountain heal", "heal_party_sp", "heal_done");
238
239    -- Dialogue events
240    vt_map.LookAtSpriteEvent.Create("Kalya looks at Bronann", kalya, bronann);
241    vt_map.ChangeDirectionSpriteEvent.Create("Kalya looks north", kalya, vt_map.MapMode.NORTH);
242    vt_map.ChangeDirectionSpriteEvent.Create("Kalya looks west", kalya, vt_map.MapMode.WEST);
243    vt_map.ChangeDirectionSpriteEvent.Create("Kalya looks south", kalya, vt_map.MapMode.SOUTH);
244    vt_map.LookAtSpriteEvent.Create("Bronann looks at Kalya", hero, kalya);
245    vt_map.ChangeDirectionSpriteEvent.Create("Bronann looks south", bronann, vt_map.MapMode.SOUTH);
246
247    vt_map.ScriptedSpriteEvent.Create("kalya:SetCollision(NONE)", kalya, "Sprite_Collision_off", "");
248    vt_map.ScriptedSpriteEvent.Create("kalya:SetCollision(ALL)", kalya, "Sprite_Collision_on", "");
249
250    event = vt_map.ScriptedEvent.Create("Wolf cave entrance dialogue", "cave_entrance_dialogue_start", "");
251    event:AddEventLinkAtEnd("Kalya moves next to Bronann", 50);
252
253    -- NOTE: The actual destination is set just before the actual start call
254    move_next_to_bronann_event = vt_map.PathMoveSpriteEvent.Create("Kalya moves next to Bronann", kalya, 0, 0, false);
255    move_next_to_bronann_event:AddEventLinkAtEnd("kalya:SetCollision(ALL)");
256    move_next_to_bronann_event:AddEventLinkAtEnd("Kalya looks north");
257    move_next_to_bronann_event:AddEventLinkAtEnd("Kalya Tells about the smell");
258
259    dialogue = vt_map.SpriteDialogue.Create();
260    text = vt_system.Translate("Yiek, it stinks in here.");
261    dialogue:AddLineEventEmote(text, kalya, "Bronann looks at Kalya", "Kalya looks at Bronann", "exclamation");
262    text = vt_system.Translate("Look at all those bones. We should be careful.");
263    dialogue:AddLine(text, bronann);
264    text = vt_system.Translate("I hope Orlinn is alright.");
265    dialogue:AddLineEmote(text, kalya, "sweat drop");
266    event = vt_map.DialogueEvent.Create("Kalya Tells about the smell", dialogue);
267    event:AddEventLinkAtEnd("kalya:SetCollision(NONE)");
268    event:AddEventLinkAtEnd("Set Camera back to Bronann");
269
270    event = vt_map.ScriptedSpriteEvent.Create("Set Camera back to Bronann", bronann, "SetCamera", "");
271    event:AddEventLinkAtEnd("kalya goes back to party");
272
273    event = vt_map.PathMoveSpriteEvent.Create("kalya goes back to party", kalya, bronann, false);
274    event:AddEventLinkAtEnd("end of cave entrance dialogue");
275
276    vt_map.ScriptedEvent.Create("end of cave entrance dialogue", "end_of_cave_entrance_dialogue", "");
277
278    -- Wolfpain necklace dialogue
279    event = vt_map.ScriptedEvent.Create("wolfpain necklace dialogue start", "wolfpain_necklace_dialogue_start", "");
280    event:AddEventLinkAtEnd("necklace event: Kalya moves next to Bronann", 50);
281
282    -- NOTE: The actual destination is set just before the actual start call
283    move_next_to_bronann_event2 = vt_map.PathMoveSpriteEvent.Create("necklace event: Kalya moves next to Bronann", kalya, 0, 0, false);
284    move_next_to_bronann_event2:AddEventLinkAtEnd("kalya:SetCollision(ALL)");
285    move_next_to_bronann_event2:AddEventLinkAtEnd("Kalya looks west");
286    move_next_to_bronann_event2:AddEventLinkAtEnd("Kalya Tells about the necklace");
287
288    vt_map.ScriptedEvent.Create("make fenrir appear and necklace disappear", "wolf_appear_n_necklace_disappear", "");
289
290    vt_map.PathMoveSpriteEvent.Create("make fenrir come", wolf, 30, 17, false);
291
292    dialogue = vt_map.SpriteDialogue.Create();
293    text = vt_system.Translate("What a lovely necklace! I'll take it.");
294    dialogue:AddLineEventEmote(text, kalya, "Bronann looks at Kalya", "Kalya looks north", "exclamation");
295    text = vt_system.Translate("Kalya. We're in the middle of a cave and you're only thinking about wearing jewels?");
296    dialogue:AddLine(text, bronann);
297    text = vt_system.Translate("Jewelry is a gift from the heavens to remind us that beauty can be as pure on the outside as it is on the inside. Besides, it suits me better than it would you.");
298    dialogue:AddLineEvent(text, kalya, "make fenrir appear and necklace disappear", "make fenrir come");
299    text = vt_system.Translate("Kalya! You'd better be careful!");
300    dialogue:AddLineEventEmote(text, bronann, "Bronann looks south", "", "sweat drop");
301    text = vt_system.Translate("Don't even start, this one is all mine.");
302    dialogue:AddLine(text, kalya);
303    text = vt_system.Translate("Not the necklace, the fenrir!");
304    dialogue:AddLineEmote(text, bronann, "exclamation");
305    text = vt_system.Translate("You can't be serious, we would have heard it come.");
306    dialogue:AddLineEvent(text, kalya, "Kalya looks at Bronann", "Kalya looks south");
307    event = vt_map.DialogueEvent.Create("Kalya Tells about the necklace", dialogue);
308    event:AddEventLinkAtEnd("The Fenrir growls");
309
310    event = vt_map.SoundEvent.Create("The Fenrir growls", "data/sounds/growl1_IFartInUrGeneralDirection_freesound.wav");
311    event:AddEventLinkAtEnd("Kalya realizes for the Fenrir");
312
313    dialogue = vt_map.SpriteDialogue.Create();
314    text = vt_system.Translate("Ah, well. You were serious, weren't you?");
315    dialogue:AddLineEmote(text, kalya, "sweat drop");
316    event = vt_map.DialogueEvent.Create("Kalya realizes for the Fenrir", dialogue);
317    event:AddEventLinkAtEnd("The Fenrir runs toward the hero");
318
319    event = vt_map.PathMoveSpriteEvent.Create("The Fenrir runs toward the hero", wolf, bronann, true);
320    event:AddEventLinkAtEnd("Second Fenrir battle");
321
322    event = vt_map.BattleEncounterEvent.Create("Second Fenrir battle");
323    event:SetMusic("data/music/accion-OGA-djsaryon.ogg");
324    event:SetBackground("data/battles/battle_scenes/desert_cave/desert_cave.png");
325    event:AddScript("data/battles/battle_scenes/desert_cave_battle_anim.lua");
326    event:AddEnemy(7, 512, 500);
327    event:SetBoss(true);
328    event:AddEventLinkAtEnd("Make the fenrir disappear");
329
330    event = vt_map.ScriptedEvent.Create("Make the fenrir disappear", "make_wolf_invisible", "");
331    event:AddEventLinkAtEnd("Get the wolfpain necklace");
332
333    event = vt_map.TreasureEvent.Create("Get the wolfpain necklace");
334    event:AddItem(20002, 1); -- The wolfpain key item
335    event:AddEventLinkAtEnd("Kalya talks after the battle");
336
337    dialogue = vt_map.SpriteDialogue.Create();
338    text = vt_system.Translate("It ran away again. I'm glad we survived. Let's get out of here before it comes back.");
339    dialogue:AddLineEventEmote(text, kalya, "Kalya looks at Bronann", "", "sweat drop");
340    event = vt_map.DialogueEvent.Create("Kalya talks after the battle", dialogue);
341    event:AddEventLinkAtEnd("kalya:SetCollision(NONE)");
342    event:AddEventLinkAtEnd("Set Camera back to Bronann2");
343
344    event = vt_map.ScriptedSpriteEvent.Create("Set Camera back to Bronann2", bronann, "SetCamera", "");
345    event:AddEventLinkAtEnd("end of necklace dialogue");
346    event:AddEventLinkAtEnd("necklace event: kalya goes back to party");
347
348    vt_map.PathMoveSpriteEvent.Create("necklace event: kalya goes back to party", kalya, bronann, false);
349
350    vt_map.ScriptedEvent.Create("end of necklace dialogue", "end_of_necklace_dialogue", "");
351end
352
353-- zones
354local to_cave_1_2_zone = nil
355local to_cave_exit_zone = nil
356
357-- Create the different map zones triggering events
358function _CreateZones()
359    -- N.B.: left, right, top, bottom
360    to_cave_1_2_zone = vt_map.CameraZone.Create(0, 1, 24, 28);
361    to_cave_exit_zone = vt_map.CameraZone.Create(24, 29, 47, 48);
362end
363
364-- Check whether the active camera has entered a zone. To be called within Update()
365function _CheckZones()
366    if (to_cave_1_2_zone:IsCameraEntering() == true) then
367        hero:SetMoving(false);
368        EventManager:StartEvent("to cave 1-2");
369    elseif (to_cave_exit_zone:IsCameraEntering() == true) then
370        hero:SetMoving(false);
371        EventManager:StartEvent("to south east exit");
372    end
373end
374
375-- Effect time used when applying the heal light effect
376local heal_effect_time = 0;
377local heal_color = vt_video.Color(0.0, 1.0, 0.0, 1.0); -- green effect
378
379-- Map Custom functions
380-- Used through scripted events
381map_functions = {
382    SetCamera = function(sprite)
383        Map:SetCamera(sprite, 800);
384    end,
385
386    Sprite_Collision_on = function(sprite)
387        if (sprite ~= nil) then
388            sprite:SetCollisionMask(vt_map.MapMode.ALL_COLLISION);
389        end
390    end,
391
392    Sprite_Collision_off = function(sprite)
393        if (sprite ~= nil) then
394            sprite:SetCollisionMask(vt_map.MapMode.NO_COLLISION);
395        end
396    end,
397
398    heal_party_sp = function()
399        hero:SetMoving(false);
400        -- Should be sufficient to heal anybody's SP
401        local character_handler = GlobalManager:GetCharacterHandler()
402        character_handler:GetActiveParty():AddSkillPoints(10000)
403        Map:SetStamina(10000)
404        Map:RemoveNegativeActiveStatusEffects()
405        AudioManager:PlaySound("data/sounds/heal_spell.wav");
406        heal_effect:SetPosition(hero:GetXPosition(), hero:GetYPosition());
407        heal_effect:Start();
408        heal_effect_time = 0;
409    end,
410
411    heal_done = function()
412        heal_effect_time = heal_effect_time + SystemManager:GetUpdateTime();
413
414        if (heal_effect_time < 300.0) then
415            heal_color:SetAlpha(heal_effect_time / 300.0 / 3.0);
416            Map:GetEffectSupervisor():EnableLightingOverlay(heal_color);
417            return false;
418        end
419
420        if (heal_effect_time < 1000.0) then
421            heal_color:SetAlpha(((1000.0 - heal_effect_time) / 700.0) / 3.0);
422            Map:GetEffectSupervisor():EnableLightingOverlay(heal_color);
423            return false;
424        end
425        return true;
426    end,
427
428    -- cave entrance - start event.
429    cave_entrance_dialogue_start = function()
430        Map:PushState(vt_map.MapMode.STATE_SCENE);
431        hero:SetMoving(false);
432
433        bronann:SetPosition(hero:GetXPosition(), hero:GetYPosition())
434        bronann:SetDirection(hero:GetDirection())
435        bronann:SetVisible(true)
436        hero:SetVisible(false)
437        Map:SetCamera(bronann)
438        hero:SetPosition(0, 0)
439
440        kalya:SetVisible(true);
441        kalya:SetPosition(bronann:GetXPosition(), bronann:GetYPosition());
442        bronann:SetCollisionMask(vt_map.MapMode.ALL_COLLISION);
443        kalya:SetCollisionMask(vt_map.MapMode.NO_COLLISION);
444
445        Map:SetCamera(kalya, 800);
446
447        move_next_to_bronann_event:SetDestination(bronann:GetXPosition() - 2.0, bronann:GetYPosition(), false);
448    end,
449
450    end_of_cave_entrance_dialogue = function()
451        Map:PopState();
452        kalya:SetPosition(0, 0);
453        kalya:SetVisible(false);
454        kalya:SetCollisionMask(vt_map.MapMode.NO_COLLISION);
455
456        hero:SetPosition(bronann:GetXPosition(), bronann:GetYPosition())
457        hero:SetDirection(bronann:GetDirection())
458        hero:SetVisible(true)
459        bronann:SetVisible(false)
460        Map:SetCamera(hero)
461        bronann:SetPosition(0, 0)
462        hero:SetDirection(vt_map.MapMode.NORTH);
463
464        -- Set event as done
465        GlobalManager:GetGameEvents():SetEventValue("story", "kalya_speech_in_wolf_cave", 1);
466    end,
467
468    -- Kalya takes the wolfpain necklace - start event.
469    wolfpain_necklace_dialogue_start = function()
470        Map:PushState(vt_map.MapMode.STATE_SCENE);
471        hero:SetMoving(false);
472
473        bronann:SetPosition(hero:GetXPosition(), hero:GetYPosition())
474        bronann:SetDirection(hero:GetDirection())
475        bronann:SetVisible(true)
476        hero:SetVisible(false)
477        Map:SetCamera(bronann)
478        hero:SetPosition(0, 0)
479
480        kalya:SetVisible(true);
481        kalya:SetPosition(bronann:GetXPosition(), bronann:GetYPosition());
482        bronann:SetCollisionMask(vt_map.MapMode.ALL_COLLISION);
483        kalya:SetCollisionMask(vt_map.MapMode.NO_COLLISION);
484
485        Map:SetCamera(kalya, 800);
486
487        move_next_to_bronann_event2:SetDestination(bronann:GetXPosition() + 2.0, bronann:GetYPosition(), false);
488    end,
489
490    wolf_appear_n_necklace_disappear = function()
491        -- Make the necklace disappear
492        necklace:SetVisible(false);
493        necklace:SetPosition(0, 0);
494        -- Prevents the event to start again
495        necklace_npc:SetPosition(0, 0);
496        light_tilt:SetVisible(false);
497
498        -- Place the wolf
499        wolf:SetVisible(true);
500        wolf:SetPosition(27, 26);
501        wolf:SetDirection(vt_map.MapMode.NORTH);
502
503        -- Set event as done
504        GlobalManager:GetGameEvents():SetEventValue("story", "wolfpain_necklace_obtained", 1);
505    end,
506
507    make_wolf_invisible = function()
508        wolf:SetVisible(false);
509        wolf:SetPosition(0, 0);
510    end,
511
512    end_of_necklace_dialogue = function()
513        kalya:SetPosition(0, 0);
514        kalya:SetVisible(false);
515        kalya:SetCollisionMask(vt_map.MapMode.NO_COLLISION);
516
517        hero:SetPosition(bronann:GetXPosition(), bronann:GetYPosition())
518        hero:SetDirection(bronann:GetDirection())
519        hero:SetVisible(true)
520        bronann:SetVisible(false)
521        Map:SetCamera(hero)
522        bronann:SetPosition(0, 0)
523        hero:SetDirection(vt_map.MapMode.NORTH);
524
525        Map:PopState();
526    end
527}
528