Using Patches to open multiple items - Senscape/Dagon GitHub Wiki
Description - At start, there are four chests with closed lids. Each chest is visible from at least two of the nodes in the room. Each chest needs to be opened individually and then to be seen as open in the other nodes. To open a chest, one must click on it to get a close-up slide, then click on the latch to release the lid, then a video plays of the lid being opened. This is a variation on Agustin's shower patches and I thought it might be useful to someone else.
Assets needed -
-
/Audio/chest_lid_down.ogg
-
/Images/patch_chest1_open_n1.png
-
/Images/patch_chest1_open_n2.png
-
/Images/patch_chest1_open_n3.png
-
/Images/patch_chest3_open_n1.png
-
/Images/patch_chest3_open_n2.png
-
/Images/patch_chest3_open_n3.png
-
/Images/patch_chest4_open_n1.png
-
/Images/patch_chest4_open_n3.png
-
/Images/patch_chest5_open_n1.png
-
/Images/patch_chest5_open_n2.png
-
/Images/still_chest1_closed.png
-
/Images/still_chest1_open.png
-
/Images/still_chest3_closed.png
-
/Images/still_chest3_open.png
-
/Images/still_chest4_closed.png
-
/Images/still_chest4_open.png
-
/Images/still_chest5_closed.png
-
/Images/still_chest5_open.png
-
/Video/Chest1_opens.png
-
/Video/Chest3_opens.png
-
/Video/Chest4_opens.png
-
/Video/Chest5_opens.png
This goes in the room file -
----------------------------------------------------------
--ADDING IN CHEST LID SLIDES, PATCHES, AND ANIMATIONS
---------------------------------------------------------
--patches for the cube faces of the chest lids opened
--need one of these for each chest and for each node where it's seen
--disabled until each chest is opened
chest1open_n1 = Archive1:addSpot( Spot(WEST, {1624, 883, 1725, 883, 1725, 1055, 1624, 1055}) )
chest1open_n1:attach(IMAGE, "patch_chest1_open_n1.png")
chest1open_n1:disable()
chest1open_n2 = Archive2:addSpot( Spot(WEST, {1243, 140, 1755, 140, 1755, 1234, 1243, 1234}) )
chest1open_n2:attach(IMAGE, "patch_chest1_open_n2.png")
chest1open_n2:disable()
chest1open_n3 = Archive3:addSpot( Spot(NORTH, {1317, 864, 1364, 864, 1364, 1062, 1317, 1062}) )
chest1open_n3:attach(IMAGE, "patch_chest1_open_n3.png")
chest1open_n3:disable()
chest5open_n1 = Archive1:addSpot( Spot(WEST, {1276, 917, 1332, 917, 1332, 1048, 1276, 1048}) )
chest5open_n1:attach(IMAGE, "patch_chest5_open_n1.png")
chest5open_n1:disable()
chest5open_n2 = Archive2:addSpot( Spot(WEST, {501, 722, 715, 722, 715, 1100, 501, 1100}) )
chest5open_n2:attach(IMAGE, "patch_chest5_open_n2.png")
chest5open_n2:disable()
chest4open_n1 = Archive1:addSpot( Spot(WEST, {906, 938, 952, 938, 952, 1043, 906, 1043}) )
chest4open_n1:attach(IMAGE, "patch_chest4_open_n1.png")
chest4open_n1:disable()
chest4open_n3 = Archive3:addSpot( Spot(WEST, {1184, 620, 1434, 620, 1434, 1123, 1184, 1123}) )
chest4open_n3:attach(IMAGE, "patch_chest4_open_n3.png")
chest4open_n3:disable()
chest3open_n1 = Archive1:addSpot( Spot(WEST, {986, 922, 1031, 922, 1031, 1047, 986, 1047}) )
chest3open_n1:attach(IMAGE, "patch_chest3_open_n1.png")
chest3open_n1:disable()
chest3open_n2 = Archive2:addSpot( Spot(SOUTH, {1976, 781, 2047, 781, 2047, 865, 1976, 865}) )
chest3open_n2:attach(IMAGE, "patch_chest3_open_n2.png")
chest3open_n2:disable()
chest3open_n3 = Archive3:addSpot( Spot(NORTH, {318, 335, 722, 335, 722, 1187, 318, 1187}) )
chest3open_n3:attach(IMAGE, "patch_chest3_open_n3.png")
chest3open_n3:disable()
----------------------------
--CHEST LID 1
----------------------------
--the two slides for chest1's lid states
chest1closedDetail = Slide("still_Chest1_closed.png", "Detail of first chest closed")
chest1openDetail = Slide("still_Chest1_open.png", "Detail of first chest opened")
--add the spot for chest1's lid closed slide
chest1 = Archive2:addSpot( Spot(WEST, {1208, 255, 1775, 255, 1775, 1233, 1208, 1233}) )
chest1:attach(SWITCH, chest1closedDetail)
--add the spot for chest1's lid opened slide
chest1vis = Archive2:addSpot( Spot(WEST, {1208, 255, 1775, 255, 1775, 1233, 1208, 1233}) )
chest1vis:attach(SWITCH, chest1openDetail)
chest1vis:disable()
--overlays the same image used for the "return" slide
chest1Returntoroom = chest1closedDetail:addSpot( Spot ({0, 0, 1920, 0, 1920, 1200, 0, 1200}) )
chest1Returntoroom:attach(IMAGE, "still_Chest1_open.png")
chest1Returntoroom:disable()
--add the video of the chest lid opening
chest1lid = chest1closedDetail:addSpot( Spot ({0, 0}, {sync = true}) )
chest1lid:attach(AUDIO, "chest_lid_down.ogg")
chest1lid:attach(VIDEO, "Chest1_opens.ogv")
chest1lid:disable()
-- yellow latch on chest
chest1Latch = chest1closedDetail:addSpot( Spot({926, 72, 1007, 72, 1007, 134, 926, 134}) )
chest1Latch:setCursor(USE)
chest1Latch:attach(FUNCTION,
function()
chest1lid:enable() --enable and play video of lid opening
chest1lid:play()
chest1lid:stop()
chest1Returntoroom:enable() --allow the overlay slide of the lid opened
chest1open_n2:enable() --show the patches with chest1 lid opened
chest1open_n1:enable()
chest1open_n3:enable()
chest1:disable() --disable the chest closed hotspot
chest1vis:enable() --enable the chest opened hotspot
self:stop() --deactivate the latch
self:disable()
end)
------------------------------
--CHEST LID 5
--------------------------------
--the two slides for chest5's lid states
chest5closedDetail = Slide("still_Chest5_closed.png", "Detail of fifth chest closed")
chest5openDetail = Slide("still_Chest5_open.png", "Detail of fifth chest opened")
--add the spot for chest5's lid closed slide
chest5 = Archive2:addSpot( Spot(WEST, {482, 724, 731, 724, 731, 1111, 482, 1111}) )
chest5:attach(SWITCH, chest5closedDetail)
--add the spot for chest5's lid opened slide
chest5vis = Archive2:addSpot( Spot(WEST, {482, 724, 731, 724, 731, 1111, 482, 1111}) )
chest5vis:attach(SWITCH, chest5openDetail)
chest5vis:disable()
--overlays the same image used for the "return" slide
chest5Returntoroom = chest5closedDetail:addSpot( Spot ({0, 0, 1920, 0, 1920, 1200, 0, 1200}) )
chest5Returntoroom:attach(IMAGE, "still_Chest5_open.png")
chest5Returntoroom:disable()
--add the video of the chest lid opening
chest5lid = chest5closedDetail:addSpot( Spot ({0, 0}, {sync = true}) )
chest5lid:attach(AUDIO, "chest_lid_down.ogg")
chest5lid:attach(VIDEO, "Chest5_opens.ogv")
chest5lid:disable()
-- yellow latch on chest
chest5Latch = chest5closedDetail:addSpot( Spot({930, 143, 1002, 143, 1002, 205, 930, 205}) )
chest5Latch:setCursor(USE)
chest5Latch:attach(FUNCTION,
function()
chest5lid:enable() --enable and play video of lid opening
chest5lid:play()
chest5lid:stop()
chest5Returntoroom:enable() --allow the overlay slide of the lid opened
chest5open_n2:enable() --show the patches with chest1 lid opened
chest5open_n1:enable()
chest5:disable() --disable the chest closed hotspot
chest5vis:enable() --enable the chest opened hotspot
self:stop() --deactivate the latch
self:disable()
end)
-----------------------
--CHEST LID 3
-----------------------
--the two slides for chest3's lid states
chest3closedDetail = Slide("still_Chest3_closed.png", "Detail of third chest closed")
chest3openDetail = Slide("still_Chest3_open.png", "Detail of third chest opened")
--add the spot for chest3's lid closed slide
chest3 = Archive3:addSpot( Spot(NORTH, {291, 368, 749, 368, 749, 1200, 291, 1200}) )
chest3:attach(SWITCH, chest3closedDetail)
--add the spot for chest3's lid opened slide
chest3vis = Archive3:addSpot( Spot(NORTH, {291, 368, 749, 368, 749, 1200, 291, 1200}) )
chest3vis:attach(SWITCH, chest3openDetail)
chest3vis:disable()
--overlays the same image used for the "return" slide
chest3Returntoroom = chest3closedDetail:addSpot( Spot ({0, 0, 1920, 0, 1920, 1200, 0, 1200}) )
chest3Returntoroom:attach(IMAGE, "still_Chest3_open.png")
chest3Returntoroom:disable()
--add the video of the chest lid opening
chest3lid = chest3closedDetail:addSpot( Spot ({0, 0}, {sync = true}) )
chest3lid:attach(AUDIO, "chest_lid_down.ogg")
chest3lid:attach(VIDEO, "Chest3_opens.ogv")
chest3lid:disable()
--yellow latch on chest
chest3Latch = chest3closedDetail:addSpot( Spot({936, 74, 1014, 74, 1014, 150, 936, 150}) )
chest3Latch:setCursor(USE)
chest3Latch:attach(FUNCTION,
function()
chest3lid:enable() --enable and play video of lid opening
chest3lid:play()
chest3lid:stop()
chest3Returntoroom:enable() --allow the overlay slide of the lid opened
chest3open_n3:enable() --show the patches with chest1 lid opened
chest3open_n2:enable()
chest3open_n1:enable()
chest3:disable() --disable the chest closed hotspot
chest3vis:enable() --enable the chest opened hotspot
self:stop() --deactivate the latch
self:disable()
end)
-------------------------
--CHEST LID 4
-------------------------
--the two slides for chest4's lid states
chest4closedDetail = Slide("still_Chest4_closed.png", "Detail of 4th chest closed")
chest4openDetail = Slide("still_Chest4_open.png", "Detail of 4th chest opened")
--add the spot for chest4's lid closed slide
chest4 = Archive3:addSpot( Spot(WEST, {1154, 649, 1459, 649, 1459, 1131, 1154, 1131}) )
chest4:attach(SWITCH, chest4closedDetail)
--add the spot for chest4's lid opened slide
chest4vis = Archive3:addSpot( Spot(WEST, {1154, 649, 1459, 649, 1459, 1131, 1154, 1131}) )
chest4vis:attach(SWITCH, chest4openDetail)
chest4vis:disable()
--overlays the same image used for the "return" slide
chest4Returntoroom = chest4closedDetail:addSpot( Spot ({0, 0, 1920, 0, 1920, 1200, 0, 1200}) )
chest4Returntoroom:attach(IMAGE, "still_Chest4_open.png")
chest4Returntoroom:disable()
--add the video of the chest lid opening
chest4lid = chest4closedDetail:addSpot( Spot ({0, 0}, {sync = true}) )
chest4lid:attach(AUDIO, "chest_lid_down.ogg")
chest4lid:attach(VIDEO, "Chest4_opens.ogv")
chest4lid:disable()
--yellow latch on chest
chest4Latch = chest4closedDetail:addSpot( Spot({941, 71, 1026, 71, 1026, 144, 941, 144}) )
chest4Latch:setCursor(USE)
chest4Latch:attach(FUNCTION,
function()
chest4lid:enable() --enable and play video of lid opening
chest4lid:play()
chest4lid:stop()
chest4Returntoroom:enable() --allow the overlay slide of the lid opened
chest4open_n3:enable() --show the patches with chest1 lid opened
chest4open_n1:enable()
chest4:disable() --disable the chest closed hotspot
chest4vis:enable() --enable the chest opened hotspot
self:stop() --deactivate the latch
self:disable()
end)
Imari 9-6-2012