Index: scripts/globals/icanheararainbow.lua =================================================================== --- scripts/globals/icanheararainbow.lua (revision 0) +++ scripts/globals/icanheararainbow.lua (working copy) @@ -0,0 +1,172 @@ +-- Functions below used in quest: I Can Hear a Rainbow + +require( "scripts/globals/status"); +require( "scripts/globals/quests"); +require( "scripts/globals/weather"); + +colorsAvailable = { 102, 103, 104, 105, 106, 108, 109, 110, 111, 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 123, 124, 125}; -- Zone IDs + +-- Data below from http://wiki.ffxiclopedia.org/wiki/I_Can_Hear_a_Rainbow - Feb. 02, 2013 + +colorsAvailable[102] = { false, false, false, true, true, false, false}; -- La Theine Plateau +colorsAvailable[103] = { true, false, true, false, false, false, false}; -- Valkurm Dunes +colorsAvailable[104] = { false, false, false, false, true, false, true }; -- Jugner Forest +colorsAvailable[105] = { false, false, true, false, false, true, false}; -- Batallia Downs +colorsAvailable[106] = { false, true, false, false, false, false, false}; -- North Gustaberg +colorsAvailable[108] = { false, false, true, false, false, false, true }; -- Konschtat Highlands +colorsAvailable[109] = { false, false, false, false, true, false, true }; -- Pashhow Marshlands +colorsAvailable[110] = { true, false, false, false, true, false, false}; -- Rolanberry Fields +colorsAvailable[111] = { false, false, false, false, false, true, false}; -- Beaucedine Glacier +colorsAvailable[112] = { false, false, false, false, false, true, false}; -- Xarcabard +colorsAvailable[113] = { true, false, false, true, false, false, false}; -- Cape Teriggan +colorsAvailable[114] = { true, true, true, false, false, false, false}; -- Eastern Altepa Desert +colorsAvailable[115] = { false, true, false, false, false, false, false}; -- West Sarutabaruta +colorsAvailable[116] = { false, true, false, false, false, false, false}; -- East Sarutabaruta +colorsAvailable[117] = { false, false, true, true, false, false, false}; -- Tahrongi Canyon +colorsAvailable[118] = { false, true, false, true, true, false, false}; -- Buburimu Peninsula +colorsAvailable[119] = { true, false, true, false, false, false, false}; -- Meriphataud Mountains +colorsAvailable[120] = { false, false, true, false, false, false, true }; -- Sauromugue Champaign +colorsAvailable[121] = { false, false, false, false, true, false, true }; -- The Sanctuary of Zi'Tah +colorsAvailable[123] = { true, false, false, false, true, false, false}; -- Yuhtunga Jungle +colorsAvailable[124] = { true, true, false, false, true, false, false}; -- Yhoator Jungle +colorsAvailable[125] = { true, false, true, false, false, false, false}; -- Western Altepa Desert + +-- The Event IDs to trigger the light cutscene for the following 3 zones is currently unknown. +-- They are included only because they are listed at http://wiki.ffxiclopedia.org/wiki/I_Can_Hear_a_Rainbow + +-- colorsAvailable[128] = { false, false, false, true, false, false, false}; -- Valley of Sorrows +-- colorsAvailable[136] = { false, false, false, false, false, true, false}; -- Beaucedine Glacier (S) +-- colorsAvailable[205] = { true, false, false, false, false, false, false}; -- Ifrit's Cauldron + +----------------------------------- +-- triggerLightCutscene +----------------------------------- + +function triggerLightCutscene( player) + + cutsceneTriggered = false; + + RED = 1; + ORANGE = 2; + YELLOW = 3; + GREEN = 4; + BLUE = 5; + INDIGO = 6; + VIOLET = 7; + + if( player:hasItem( 1125, 0)) then -- Player has Carbuncle's Ruby? + + if( player:getQuestStatus( WINDURST, I_CAN_HEAR_A_RAINBOW) == QUEST_ACCEPTED) then + + colors = player:getVar( "I_CAN_HEAR_A_RAINBOW"); + + if( colors == nil) then -- Variable 'I_CAN_HEAR_A_RAINBOW' not set + colors = 0; + end + + hasRed = ( tonumber( colors) % 2 >= 1); + hasOrange = ( tonumber( colors) % 4 >= 2); + hasYellow = ( tonumber( colors) % 8 >= 4); + hasGreen = ( tonumber( colors) % 16 >= 8); + hasBlue = ( tonumber( colors) % 32 >= 16); + hasIndigo = ( tonumber( colors) % 64 >= 32); + hasViolet = ( tonumber( colors) % 128 >= 64); + + zone = player:getZone(); + weather = player:getWeather(); + + if( hasRed == false and ( weather == WEATHER_HOT_SPELL or weather == WEATHER_HEAT_WAVE )) then + if( colorsAvailable[zone][RED]) then + cutsceneTriggered = true; + player:setVar( "I_CAN_HEAR_A_RAINBOW", colors + 1); + player:setVar( "I_CAN_HEAR_A_RAINBOW_Weather", weather); + end + elseif( hasOrange == false and ( weather == WEATHER_NONE or weather == WEATHER_SUNSHINE )) then + if( colorsAvailable[zone][ORANGE]) then + cutsceneTriggered = true; + player:setVar( "I_CAN_HEAR_A_RAINBOW", colors + 2); + player:setVar( "I_CAN_HEAR_A_RAINBOW_Weather", weather); + end + elseif( hasYellow == false and ( weather == WEATHER_DUST_STORM or weather == WEATHER_SAND_STORM )) then + if( colorsAvailable[zone][YELLOW]) then + cutsceneTriggered = true; + player:setVar( "I_CAN_HEAR_A_RAINBOW", colors + 4); + player:setVar( "I_CAN_HEAR_A_RAINBOW_Weather", weather); + end + elseif( hasGreen == false and ( weather == WEATHER_WIND or weather == WEATHER_GALES )) then + if( colorsAvailable[zone][GREEN]) then + cutsceneTriggered = true; + player:setVar( "I_CAN_HEAR_A_RAINBOW", colors + 8); + player:setVar( "I_CAN_HEAR_A_RAINBOW_Weather", weather); + end + elseif( hasBlue == false and ( weather == WEATHER_RAIN or weather == WEATHER_SQUALL )) then + if( colorsAvailable[zone][BLUE]) then + cutsceneTriggered = true; + player:setVar( "I_CAN_HEAR_A_RAINBOW", colors + 16); + player:setVar( "I_CAN_HEAR_A_RAINBOW_Weather", weather); + end + elseif( hasIndigo == false and ( weather == WEATHER_SNOW or weather == WEATHER_BLIZZARDS )) then + if( colorsAvailable[zone][INDIGO]) then + cutsceneTriggered = true; + player:setVar( "I_CAN_HEAR_A_RAINBOW", colors + 32); + player:setVar( "I_CAN_HEAR_A_RAINBOW_Weather", weather); + end + elseif( hasViolet == false and ( weather == WEATHER_THUNDER or weather == WEATHER_THUNDERSTORMS)) then + if( colorsAvailable[zone][VIOLET]) then + cutsceneTriggered = true; + player:setVar( "I_CAN_HEAR_A_RAINBOW", colors + 64); + player:setVar( "I_CAN_HEAR_A_RAINBOW_Weather", weather); + end + end + + if( cutsceneTriggered) then + fixChocoboBug( player); + end + end + end + + return cutsceneTriggered; +end; + +----------------------------------- +-- lightCutsceneUpdate +----------------------------------- + +function lightCutsceneUpdate( player) + + weather = player:getVar( "I_CAN_HEAR_A_RAINBOW_Weather"); + + if( weather == WEATHER_SUNSHINE) then -- In some zones the light cutscene does not handle WEATHER_SUNSHINE properly + weather = WEATHER_NONE; + end + + if( player:getVar( "I_CAN_HEAR_A_RAINBOW") < 127) then + player:updateEvent( 0, 0, weather); + else + player:updateEvent( 0, 0, weather, 6); + end +end; + +----------------------------------- +-- lightCutsceneFinish +----------------------------------- + +function lightCutsceneFinish( player) + + fixChocoboBug( player); + player:setVar( "I_CAN_HEAR_A_RAINBOW_Weather", 0); +end; + +----------------------------------- +-- fixChocoboBug +----------------------------------- + +function fixChocoboBug( player) + if( player:hasStatusEffect( EFFECT_CHOCOBO)) then + if( player:getAnimation() == 5) then + player:setAnimation( 0); + elseif( player:getAnimation() == 0) then + player:setAnimation( 5); + end + end +end; Index: scripts/globals/weather.lua =================================================================== --- scripts/globals/weather.lua (revision 0) +++ scripts/globals/weather.lua (working copy) @@ -0,0 +1,24 @@ +----------------------------------- +-- Weather Conditions +----------------------------------- + +WEATHER_NONE = 0; +WEATHER_SUNSHINE = 1; +WEATHER_CLOUDS = 2; +WEATHER_FOG = 3; +WEATHER_HOT_SPELL = 4; +WEATHER_HEAT_WAVE = 5; +WEATHER_RAIN = 6; +WEATHER_SQUALL = 7; +WEATHER_DUST_STORM = 8; +WEATHER_SAND_STORM = 9; +WEATHER_WIND = 10; +WEATHER_GALES = 11; +WEATHER_SNOW = 12; +WEATHER_BLIZZARDS = 13; +WEATHER_THUNDER = 14; +WEATHER_THUNDERSTORMS = 15; +WEATHER_AURORAS = 16; +WEATHER_STELLAR_GLARE = 17; +WEATHER_GLOOM = 18; +WEATHER_DARKNESS = 19; Index: scripts/zones/Batallia_Downs/Zone.lua =================================================================== --- scripts/zones/Batallia_Downs/Zone.lua (revision 2482) +++ scripts/zones/Batallia_Downs/Zone.lua (working copy) @@ -4,82 +4,66 @@ -- ----------------------------------- -package.loaded["scripts/zones/Batallia_Downs/TextIDs"] = nil; -require("scripts/globals/quests"); -require("scripts/globals/settings"); -require("scripts/zones/Batallia_Downs/TextIDs"); +package.loaded[ "scripts/zones/Batallia_Downs/TextIDs"] = nil; +require( "scripts/zones/Batallia_Downs/TextIDs"); +require( "scripts/globals/icanheararainbow"); + ----------------------------------- -- onInitialize ----------------------------------- -function onInitialize(zone) -end; +function onInitialize( zone) +end; ------------------------------------ --- onZoneIn ------------------------------------ +----------------------------------- +-- onZoneIn +----------------------------------- -function onZoneIn(player,prevZone) +function onZoneIn( player, prevZone) + cs = -1; - wc = player:getWeather(); - if ((player:getXPos() == 0) and (player:getYPos() == 0) and (player:getZPos() == 0)) then - player:setPos(-693.609,-14.583,173.59,30); - end - if (player:getQuestStatus(WINDURST, I_CAN_HEAR_A_RAINBOW) == QUEST_ACCEPTED and player:hasItem(1125,0)) then - colors = player:getVar("ICanHearARainbow"); - o = (tonumber(colors) % 4 >= 2); - y = (tonumber(colors) % 8 >= 4); - i = (tonumber(colors) % 64 >= 32); + + if( player:getXPos() == 0 and player:getYPos() == 0 and player:getZPos() == 0) then + player:setPos( -693.609, -14.583, 173.59, 30); + end + + if( triggerLightCutscene( player)) then -- Quest: I Can Hear A Rainbow cs = 0x0385; - if (o == false and wc < 4) then - player:setVar("ICanHearARainbow_Weather",1); - player:setVar("ICanHearARainbow",colors+2); - elseif (y == false and (wc == 8 or wc == 9)) then - player:setVar("ICanHearARainbow_Weather",8); - player:setVar("ICanHearARainbow",colors+4); - elseif (i == false and (wc == 12 or wc == 13)) then - player:setVar("ICanHearARainbow_Weather",12); - player:setVar("ICanHearARainbow",colors+32); - else - cs = -1; - end - end - return cs; -end; + end ------------------------------------ --- onRegionEnter ------------------------------------ + return cs; +end; -function onRegionEnter(player,region) -end; +----------------------------------- +-- onRegionEnter +----------------------------------- ------------------------------------ --- onEventUpdate ------------------------------------ +function onRegionEnter( player, region) +end; -function onEventUpdate(player,csid,option) - --printf("CSID: %u",csid); - --printf("RESULT: %u",option); - if (csid == 0x0385) then - weather = player:getVar("ICanHearARainbow_Weather"); - if (player:getVar("ICanHearARainbow") < 127) then - player:updateEvent(0,0,weather); - else - player:updateEvent(0,0,weather,6); - end - end -end; +----------------------------------- +-- onEventUpdate +----------------------------------- ------------------------------------ --- onEventFinish ------------------------------------ +function onEventUpdate( player, csid, option) +--printf("CSID: %u",csid); +--printf("RESULT: %u",option); -function onEventFinish(player,csid,option) - --printf("CSID: %u",csid); - --printf("RESULT: %u",option); - if (csid == 0x0385) then - player:setVar("ICanHearARainbow_Weather",0); - end + if( csid == 0x0385) then + lightCutsceneUpdate( player); -- Quest: I Can Hear A Rainbow + end end; + +----------------------------------- +-- onEventFinish +----------------------------------- + +function onEventFinish( player, csid, option) +--printf("CSID: %u",csid); +--printf("RESULT: %u",option); + + if( csid == 0x0385) then + lightCutsceneFinish( player); -- Quest: I Can Hear A Rainbow + end +end; Index: scripts/zones/Beaucedine_Glacier/Zone.lua =================================================================== --- scripts/zones/Beaucedine_Glacier/Zone.lua (revision 2482) +++ scripts/zones/Beaucedine_Glacier/Zone.lua (working copy) @@ -4,82 +4,71 @@ -- ----------------------------------- -package.loaded["scripts/zones/Beaucedine_Glacier/TextIDs"] = nil; -require("scripts/globals/quests"); -require("scripts/globals/settings"); -require("scripts/zones/Beaucedine_Glacier/TextIDs"); -require("scripts/globals/missions"); +package.loaded[ "scripts/zones/Beaucedine_Glacier/TextIDs"] = nil; + +require( "scripts/zones/Beaucedine_Glacier/TextIDs"); +require( "scripts/globals/missions"); +require( "scripts/globals/icanheararainbow"); + ----------------------------------- -- onInitialize ----------------------------------- -function onInitialize(zone) -end; +function onInitialize( zone) +end; ------------------------------------ --- onZoneIn ------------------------------------ +----------------------------------- +-- onZoneIn +----------------------------------- -function onZoneIn(player,prevZone) +function onZoneIn( player, prevZone) + cs = -1; - wc = player:getWeather(); - if ((player:getXPos() == 0) and (player:getYPos() == 0) and (player:getZPos() == 0)) then - player:setPos(-247.911,-82.165,260.207,248); - end - if (player:getCurrentMission(COP) == DESIRES_OF_EMPTINESS and player:getVar("PromathiaStatus")==9)then - cs=0x00CE; - elseif (player:getQuestStatus(WINDURST, I_CAN_HEAR_A_RAINBOW) == QUEST_ACCEPTED and player:hasItem(1125,0)) then - colors = player:getVar("ICanHearARainbow"); - i = (tonumber(colors) % 64 >= 32); - o = (tonumber(colors) % 4 >= 2); + + if( player:getXPos() == 0 and player:getYPos() == 0 and player:getZPos() == 0) then + player:setPos( -247.911, -82.165, 260.207, 248); + end + + if( player:getCurrentMission( COP) == DESIRES_OF_EMPTINESS and player:getVar( "PromathiaStatus") == 9) then + cs = 0x00CE; + elseif( triggerLightCutscene( player)) then -- Quest: I Can Hear A Rainbow cs = 0x0072; - if (o == false and wc < 4) then - player:setVar("ICanHearARainbow_Weather",1); - player:setVar("ICanHearARainbow",colors+2); - elseif (i == false and (wc == 12 or wc == 13)) then - player:setVar("ICanHearARainbow_Weather",12); - player:setVar("ICanHearARainbow",colors+32); - else - cs = -1; - end - end - return cs; -end; + end + + return cs; +end; ------------------------------------ --- onRegionEnter ------------------------------------ +----------------------------------- +-- onRegionEnter +----------------------------------- -function onRegionEnter(player,region) -end; +function onRegionEnter( player, region) +end; ------------------------------------ --- onEventUpdate ------------------------------------ +----------------------------------- +-- onEventUpdate +----------------------------------- -function onEventUpdate(player,csid,option) - --printf("CSID: %u",csid); - --printf("RESULT: %u",option); - if (csid == 0x0072) then - weather = player:getVar("ICanHearARainbow_Weather"); - if (player:getVar("ICanHearARainbow") < 127) then - player:updateEvent(0,0,weather); - else - player:updateEvent(0,0,weather,6); - end - end -end; +function onEventUpdate( player, csid, option) +--printf("CSID: %u",csid); +--printf("RESULT: %u",option); ------------------------------------ --- onEventFinish ------------------------------------ + if (csid == 0x0072) then + lightCutsceneUpdate( player); -- Quest: I Can Hear A Rainbow + end +end; -function onEventFinish(player,csid,option) - --printf("CSID: %u",csid); - --printf("RESULT: %u",option); - if (csid == 0x0072) then - player:setVar("ICanHearARainbow_Weather",0); - elseif(csid == 0x00CE)then - player:setVar("PromathiaStatus",10); - end -end; +----------------------------------- +-- onEventFinish +----------------------------------- + +function onEventFinish( player, csid, option) +--printf("CSID: %u",csid); +--printf("RESULT: %u",option); + + if( csid == 0x00CE) then + player:setVar("PromathiaStatus",10); + elseif( csid == 0x0072) then + lightCutsceneFinish( player); -- Quest: I Can Hear A Rainbow + end +end; Index: scripts/zones/Buburimu_Peninsula/Zone.lua =================================================================== --- scripts/zones/Buburimu_Peninsula/Zone.lua (revision 2482) +++ scripts/zones/Buburimu_Peninsula/Zone.lua (working copy) @@ -4,85 +4,66 @@ -- ----------------------------------- -package.loaded["scripts/zones/Buburimu_Peninsula/TextIDs"] = nil; -require("scripts/globals/quests"); -require("scripts/globals/settings"); -require("scripts/zones/Buburimu_Peninsula/TextIDs"); +package.loaded[ "scripts/zones/Buburimu_Peninsula/TextIDs"] = nil; +require( "scripts/zones/Buburimu_Peninsula/TextIDs"); +require( "scripts/globals/icanheararainbow"); + ----------------------------------- -- onInitialize ----------------------------------- -function onInitialize(zone) -end; +function onInitialize(zone) +end; ------------------------------------ --- onZoneIn ------------------------------------ +----------------------------------- +-- onZoneIn +----------------------------------- -function onZoneIn(player,prevZone) +function onZoneIn( player, prevZone) + cs = -1; - wc = player:getWeather(); - if ((player:getXPos() == 0) and (player:getYPos() == 0) and (player:getZPos() == 0)) then - player:setPos(-276.529,16.403,-324.519,14); - end - if (player:getQuestStatus(WINDURST, I_CAN_HEAR_A_RAINBOW) == QUEST_ACCEPTED and player:hasItem(1125,0)) then - colors = player:getVar("ICanHearARainbow"); - o = (tonumber(colors) % 4 >= 2); - g = (tonumber(colors) % 16 >= 8); - b = (tonumber(colors) % 32 >= 16); - cs = 0x0003; - if (o == false and wc < 4) then - player:setVar("ICanHearARainbow_Weather",1); - player:setVar("ICanHearARainbow",colors+2); - elseif (g == false and (wc == 10 or wc == 11)) then - player:setVar("ICanHearARainbow_Weather",10); - player:setVar("ICanHearARainbow",colors+8); - elseif (b == false and (wc == 6 or wc == 7)) then - player:setVar("ICanHearARainbow_Weather",6); - player:setVar("ICanHearARainbow",colors+16); - else - cs = -1; - end - end - return cs; -end; ------------------------------------ --- onRegionEnter ------------------------------------ + if( player:getXPos() == 0 and player:getYPos() == 0 and player:getZPos() == 0) then + player:setPos( -276.529, 16.403, -324.519, 14); + end -function onRegionEnter(player,region) -end; + if( triggerLightCutscene( player)) then -- Quest: I Can Hear A Rainbow + cs = 0x0003; + end ------------------------------------ --- onEventUpdate ------------------------------------ + return cs; +end; -function onEventUpdate(player,csid,option) - --printf("CSID: %u",csid); - --printf("RESULT: %u",option); - if (csid == 0x0003) then - weather = player:getVar("ICanHearARainbow_Weather"); - if (weather == 1) then - weather = 0; - end - if (player:getVar("ICanHearARainbow") < 127) then - player:updateEvent(0,0,weather); - else - player:updateEvent(0,0,weather,6); - end - end -end; +----------------------------------- +-- onRegionEnter +----------------------------------- ------------------------------------ --- onEventFinish ------------------------------------ +function onRegionEnter(player,region) +end; -function onEventFinish(player,csid,option) - --printf("CSID: %u",csid); - --printf("RESULT: %u",option); - if (csid == 0x0003) then - player:setVar("ICanHearARainbow_Weather",0); - end -end; +----------------------------------- +-- onEventUpdate +----------------------------------- + +function onEventUpdate( player, csid, option) +--printf("CSID: %u",csid); +--printf("RESULT: %u",option); + + if (csid == 0x0003) then + lightCutsceneUpdate( player); -- Quest: I Can Hear A Rainbow + end +end; + +----------------------------------- +-- onEventFinish +----------------------------------- + +function onEventFinish( player, csid, option) +--printf("CSID: %u",csid); +--printf("RESULT: %u",option); + + if (csid == 0x0003) then + lightCutsceneFinish( player); -- Quest: I Can Hear A Rainbow + end +end; Index: scripts/zones/Cape_Teriggan/Zone.lua =================================================================== --- scripts/zones/Cape_Teriggan/Zone.lua (revision 2482) +++ scripts/zones/Cape_Teriggan/Zone.lua (working copy) @@ -4,82 +4,66 @@ -- ----------------------------------- -package.loaded["scripts/zones/Cape_Teriggan/TextIDs"] = nil; -require("scripts/globals/quests"); -require("scripts/globals/settings"); -require("scripts/zones/Cape_Teriggan/TextIDs"); +package.loaded[ "scripts/zones/Cape_Teriggan/TextIDs"] = nil; +require( "scripts/zones/Cape_Teriggan/TextIDs"); +require( "scripts/globals/icanheararainbow"); + ----------------------------------- -- onInitialize ----------------------------------- -function onInitialize(zone) -end; +function onInitialize( zone) +end; ------------------------------------ --- onZoneIn ------------------------------------ +----------------------------------- +-- onZoneIn +----------------------------------- -function onZoneIn(player,prevZone) +function onZoneIn( player, prevZone) + cs = -1; - wc = player:getWeather(); - if ((player:getXPos() == 0) and (player:getYPos() == 0) and (player:getZPos() == 0)) then - player:setPos(315.644,-1.517,-60.633,108); - end - if (player:getQuestStatus(WINDURST, I_CAN_HEAR_A_RAINBOW) == QUEST_ACCEPTED and player:hasItem(1125,0)) then - colors = player:getVar("ICanHearARainbow"); - o = (tonumber(colors) % 4 >= 2); - r = (tonumber(colors) % 2 >= 1); - g = (tonumber(colors) % 16 >= 8); + + if( player:getXPos() == 0 and player:getYPos() == 0 and player:getZPos() == 0) then + player:setPos( 315.644, -1.517, -60.633, 108); + end + + if( triggerLightCutscene( player)) then -- Quest: I Can Hear A Rainbow cs = 0x0002; - if (o == false and wc < 4) then - player:setVar("ICanHearARainbow_Weather",1); - player:setVar("ICanHearARainbow",colors+2); - elseif (r == false and (wc == 4 or wc == 5)) then - player:setVar("ICanHearARainbow_Weather",4); - player:setVar("ICanHearARainbow",colors+1); - elseif (g == false and (wc == 10 or wc == 11)) then - player:setVar("ICanHearARainbow_Weather",10); - player:setVar("ICanHearARainbow",colors+8); - else - cs = -1; - end - end - return cs; -end; + end ------------------------------------ --- onRegionEnter ------------------------------------ + return cs; +end; -function onRegionEnter(player,region) -end; +----------------------------------- +-- onRegionEnter +----------------------------------- ------------------------------------ --- onEventUpdate ------------------------------------ +function onRegionEnter( player, region) +end; -function onEventUpdate(player,csid,option) - --printf("CSID: %u",csid); - --printf("RESULT: %u",option); - if (csid == 0x0002) then - weather = player:getVar("ICanHearARainbow_Weather"); - if (player:getVar("ICanHearARainbow") < 127) then - player:updateEvent(0,0,weather); - else - player:updateEvent(0,0,weather,6); - end - end -end; +----------------------------------- +-- onEventUpdate +----------------------------------- ------------------------------------ --- onEventFinish ------------------------------------ +function onEventUpdate( player, csid, option) +--printf("CSID: %u",csid); +--printf("RESULT: %u",option); -function onEventFinish(player,csid,option) - --printf("CSID: %u",csid); - --printf("RESULT: %u",option); - if (csid == 0x0002) then - player:setVar("ICanHearARainbow_Weather",0); - end + if( csid == 0x0002) then + lightCutsceneUpdate( player); -- Quest: I Can Hear A Rainbow + end end; + +----------------------------------- +-- onEventFinish +----------------------------------- + +function onEventFinish( player, csid, option) +--printf("CSID: %u",csid); +--printf("RESULT: %u",option); + + if (csid == 0x0002) then + lightCutsceneFinish( player); -- Quest: I Can Hear A Rainbow + end +end; Index: scripts/zones/East_Sarutabaruta/Zone.lua =================================================================== --- scripts/zones/East_Sarutabaruta/Zone.lua (revision 2482) +++ scripts/zones/East_Sarutabaruta/Zone.lua (working copy) @@ -3,93 +3,82 @@ -- Zone: East_Sarutabaruta (116) -- ----------------------------------- -package.loaded["scripts/zones/East_Sarutabaruta/TextIDs"] = nil; ------------------------------------ -require("scripts/globals/settings"); -require("scripts/globals/keyitems"); -require("scripts/globals/quests"); -require("scripts/globals/missions"); -require("scripts/zones/East_Sarutabaruta/TextIDs"); +package.loaded[ "scripts/zones/East_Sarutabaruta/TextIDs"] = nil; +require( "scripts/globals/keyitems"); +require( "scripts/globals/missions"); +require( "scripts/globals/icanheararainbow"); +require( "scripts/zones/East_Sarutabaruta/TextIDs"); + ----------------------------------- -- onInitialize ------------------------------------ +----------------------------------- -function onInitialize(zone) -end; +function onInitialize( zone) +end; ------------------------------------ --- onZoneIn ------------------------------------ +----------------------------------- +-- onZoneIn +----------------------------------- -function onZoneIn(player,prevZone) +function onZoneIn( player, prevZone) + cs = -1; - wc = player:getWeather(); - if ((player:getXPos() == 0) and (player:getYPos() == 0) and (player:getZPos() == 0)) then + + if ((player:getXPos() == 0) and (player:getYPos() == 0) and (player:getZPos() == 0)) then player:setPos(305.377,-36.092,660.435,71); - end - -- Check if we are on Windurst Mission 1-2 - if(player:getCurrentMission(WINDURST) == THE_HEART_OF_THE_MATTER and player:getVar("MissionStatus") == 5 and prevZone == 194) then - cs = 0x0030; - elseif(player:getQuestStatus(WINDURST, I_CAN_HEAR_A_RAINBOW) == QUEST_ACCEPTED and player:hasItem(1125,0)) then - colors = player:getVar("ICanHearARainbow"); - o = (tonumber(colors) % 4 >= 2); - cs = 0x0032; - if (o == false and wc < 4) then - player:setVar("ICanHearARainbow_Weather",1); - player:setVar("ICanHearARainbow",colors+2); - else - cs = -1; - end - end - return cs; -end; + end ------------------------------------ --- onRegionEnter ------------------------------------ + -- Check if we are on Windurst Mission 1-2 + if( player:getCurrentMission( WINDURST) == THE_HEART_OF_THE_MATTER and player:getVar( "MissionStatus") == 5 and prevZone == 194) then + cs = 0x0030; + elseif( triggerLightCutscene( player)) then -- Quest: I Can Hear A Rainbow + cs = 0x0032; + end + return cs; +end; -function onRegionEnter(player,region) -end; +----------------------------------- +-- onRegionEnter +----------------------------------- ------------------------------------ --- onEventUpdate ------------------------------------ +function onRegionEnter( player, region) +end; -function onEventUpdate(player,csid,option) - --printf("CSID: %u",csid); - --printf("RESULT: %u",option); - if (csid == 0x0032) then - weather = player:getVar("ICanHearARainbow_Weather"); - if (weather == 1) then - weather = 0; - end - if (player:getVar("ICanHearARainbow") < 127) then - player:updateEvent(0,0,weather); - else - player:updateEvent(0,0,weather,6); - end - end -end; +----------------------------------- +-- onEventUpdate +----------------------------------- ------------------------------------ --- onEventFinish ------------------------------------ +function onEventUpdate( player, csid, option) +--printf("CSID: %u",csid); +--printf("RESULT: %u",option); -function onEventFinish(player,csid,option) - --printf("CSID: %u",csid); - --printf("RESULT: %u",option); - if(csid == 0x0030) then - player:setVar("MissionStatus",6); + if (csid == 0x0032) then + lightCutsceneUpdate( player); -- Quest: I Can Hear A Rainbow + end +end; + +----------------------------------- +-- onEventFinish +----------------------------------- + +function onEventFinish( player, csid, option) +--printf("CSID: %u",csid); +--printf("RESULT: %u",option); + + if( csid == 0x0030) then + player:setVar( "MissionStatus",6); + -- Remove the glowing orb key items - player:delKeyItem(FIRST_GLOWING_MANA_ORB); - player:delKeyItem(SECOND_GLOWING_MANA_ORB); - player:delKeyItem(THIRD_GLOWING_MANA_ORB); - player:delKeyItem(FOURTH_GLOWING_MANA_ORB); - player:delKeyItem(FIFTH_GLOWING_MANA_ORB); - player:delKeyItem(SIXTH_GLOWING_MANA_ORB); - elseif (csid == 0x0032) then - player:setVar("ICanHearARainbow_Weather",0); - end -end; + player:delKeyItem( FIRST_GLOWING_MANA_ORB); + player:delKeyItem( SECOND_GLOWING_MANA_ORB); + player:delKeyItem( THIRD_GLOWING_MANA_ORB); + player:delKeyItem( FOURTH_GLOWING_MANA_ORB); + player:delKeyItem( FIFTH_GLOWING_MANA_ORB); + player:delKeyItem( SIXTH_GLOWING_MANA_ORB); + + elseif( csid == 0x0032) then + lightCutsceneFinish( player); -- Quest: I Can Hear A Rainbow + end +end; Index: scripts/zones/Eastern_Altepa_Desert/Zone.lua =================================================================== --- scripts/zones/Eastern_Altepa_Desert/Zone.lua (revision 2482) +++ scripts/zones/Eastern_Altepa_Desert/Zone.lua (working copy) @@ -5,46 +5,33 @@ ----------------------------------- package.loaded["scripts/zones/Eastern_Altepa_Desert/TextIDs"] = nil; -require("scripts/globals/quests"); -require("scripts/globals/settings"); + require("scripts/zones/Eastern_Altepa_Desert/TextIDs"); +require( "scripts/globals/icanheararainbow"); ----------------------------------- -- onInitialize ----------------------------------- -function onInitialize(zone) +function onInitialize( zone) end; ----------------------------------- -- onZoneIn ----------------------------------- -function onZoneIn(player,prevZone) +function onZoneIn( player, prevZone) + cs = -1; - wc = player:getWeather(); - if ((player:getXPos() == 0) and (player:getYPos() == 0) and (player:getZPos() == 0)) then - player:setPos(260.09,6.013,320.454,76); - end - if (player:getQuestStatus(WINDURST, I_CAN_HEAR_A_RAINBOW) == QUEST_ACCEPTED and player:hasItem(1125,0)) then - colors = player:getVar("ICanHearARainbow"); - o = (tonumber(colors) % 4 >= 2); - r = (tonumber(colors) % 2 >= 1); - y = (tonumber(colors) % 8 >= 4); + + if( player:getXPos() == 0 and player:getYPos() == 0 and player:getZPos() == 0) then + player:setPos( 260.09, 6.013, 320.454, 76); + end + + if( triggerLightCutscene( player)) then -- Quest: I Can Hear A Rainbow cs = 0x0002; - if (o == false and wc < 4) then - player:setVar("ICanHearARainbow_Weather",1); - player:setVar("ICanHearARainbow",colors+2); - elseif (r == false and (wc == 4 or wc == 5)) then - player:setVar("ICanHearARainbow_Weather",4); - player:setVar("ICanHearARainbow",colors+1); - elseif (y == false and (wc == 8 or wc == 9)) then - player:setVar("ICanHearARainbow_Weather",8); - player:setVar("ICanHearARainbow",colors+4); - else - cs = -1; - end - end + end + return cs; end; @@ -52,23 +39,19 @@ -- onRegionEnter ----------------------------------- -function onRegionEnter(player,region) +function onRegionEnter( player, region) end; ----------------------------------- -- onEventUpdate ----------------------------------- -function onEventUpdate(player,csid,option) - --printf("CSID: %u",csid); - --printf("RESULT: %u",option); - if (csid == 0x0002) then - weather = player:getVar("ICanHearARainbow_Weather"); - if (player:getVar("ICanHearARainbow") < 127) then - player:updateEvent(0,0,weather); - else - player:updateEvent(0,0,weather,6); - end +function onEventUpdate( player, csid, option) +--printf("CSID: %u",csid); +--printf("RESULT: %u",option); + + if( csid == 0x0002) then + lightCutsceneUpdate( player); -- Quest: I Can Hear A Rainbow end end; @@ -76,10 +59,11 @@ -- onEventFinish ----------------------------------- -function onEventFinish(player,csid,option) - --printf("CSID: %u",csid); - --printf("RESULT: %u",option); - if (csid == 0x0002) then - player:setVar("ICanHearARainbow_Weather",0); +function onEventFinish( player, csid, option) +--printf("CSID: %u",csid); +--printf("RESULT: %u",option); + + if( csid == 0x0002) then + lightCutsceneFinish( player); -- Quest: I Can Hear A Rainbow end end; Index: scripts/zones/Jugner_Forest/Zone.lua =================================================================== --- scripts/zones/Jugner_Forest/Zone.lua (revision 2482) +++ scripts/zones/Jugner_Forest/Zone.lua (working copy) @@ -4,47 +4,34 @@ -- ----------------------------------- -package.loaded["scripts/zones/Valkurm_Dunes/TextIDs"] = nil; -require("scripts/globals/quests"); -require("scripts/globals/settings"); -require("scripts/zones/Valkurm_Dunes/TextIDs"); +package.loaded[ "scripts/zones/Valkurm_Dunes/TextIDs"] = nil; +require( "scripts/zones/Valkurm_Dunes/TextIDs"); +require( "scripts/globals/icanheararainbow"); + ----------------------------------- -- onInitialize ----------------------------------- -function onInitialize(zone) +function onInitialize( zone) end; ----------------------------------- -- onZoneIn ----------------------------------- -function onZoneIn(player,prevZone) +function onZoneIn( player, prevZone) + cs = -1; - wc = player:getWeather(); - if ((player:getXPos() == 0) and (player:getYPos() == 0) and (player:getZPos() == 0)) then - player:setPos(342,-5,15.117,169); + + if( player:getXPos() == 0 and player:getYPos() == 0 and player:getZPos() == 0) then + player:setPos( 342, -5, 15.117, 169); end - if (player:getQuestStatus(WINDURST, I_CAN_HEAR_A_RAINBOW) == QUEST_ACCEPTED and player:hasItem(1125,0)) then - colors = player:getVar("ICanHearARainbow"); - o = (tonumber(colors) % 4 >= 2); - b = (tonumber(colors) % 32 >= 16); - v = (tonumber(colors) % 128 >= 64); + + if( triggerLightCutscene( player)) then -- Quest: I Can Hear A Rainbow cs = 0x000f; - if (o == false and wc < 4) then - player:setVar("ICanHearARainbow_Weather",1); - player:setVar("ICanHearARainbow",colors+2); - elseif (b == false and (wc == 6 or wc == 7)) then - player:setVar("ICanHearARainbow_Weather",6); - player:setVar("ICanHearARainbow",colors+16); - elseif (v == false and (wc == 14 or wc == 15)) then - player:setVar("ICanHearARainbow_Weather",14); - player:setVar("ICanHearARainbow",colors+64); - else - cs = -1; - end - end + end + return cs; end; @@ -52,23 +39,19 @@ -- onRegionEnter ----------------------------------- -function onRegionEnter(player,region) +function onRegionEnter( player, region) end; ----------------------------------- -- onEventUpdate ----------------------------------- -function onEventUpdate(player,csid,option) - --printf("CSID: %u",csid); - --printf("RESULT: %u",option); - if (csid == 0x000f) then - weather = player:getVar("ICanHearARainbow_Weather"); - if (player:getVar("ICanHearARainbow") < 127) then - player:updateEvent(0,0,weather); - else - player:updateEvent(0,0,weather,6); - end +function onEventUpdate( player, csid, option) +--printf("CSID: %u",csid); +--printf("RESULT: %u",option); + + if( csid == 0x000f) then + lightCutsceneUpdate( player); -- Quest: I Can Hear A Rainbow end end; @@ -76,10 +59,11 @@ -- onEventFinish ----------------------------------- -function onEventFinish(player,csid,option) - --printf("CSID: %u",csid); - --printf("RESULT: %u",option); - if (csid == 0x000f) then - player:setVar("ICanHearARainbow_Weather",0); +function onEventFinish( player, csid, option) +--printf("CSID: %u",csid); +--printf("RESULT: %u",option); + + if( csid == 0x000f) then + lightCutsceneFinish( player); -- Quest: I Can Hear A Rainbow end end; Index: scripts/zones/Konschtat_Highlands/Zone.lua =================================================================== --- scripts/zones/Konschtat_Highlands/Zone.lua (revision 2482) +++ scripts/zones/Konschtat_Highlands/Zone.lua (working copy) @@ -5,9 +5,9 @@ ----------------------------------- package.loaded["scripts/zones/Konschtat_Highlands/TextIDs"] = nil; -require("scripts/globals/quests"); -require("scripts/globals/settings"); + require("scripts/zones/Konschtat_Highlands/TextIDs"); +require( "scripts/globals/icanheararainbow"); ----------------------------------- -- onInitialize @@ -20,31 +20,18 @@ -- onZoneIn ----------------------------------- -function onZoneIn(player,prevZone) +function onZoneIn( player, prevZone) + cs = -1; - wc = player:getWeather(); - if ((player:getXPos() == 0) and (player:getYPos() == 0) and (player:getZPos() == 0)) then - player:setPos(521.922,28.361,747.85,45); + + if( player:getXPos() == 0 and player:getYPos() == 0 and player:getZPos() == 0) then + player:setPos( 521.922, 28.361, 747.85, 45); end - if (player:getQuestStatus(WINDURST, I_CAN_HEAR_A_RAINBOW) == QUEST_ACCEPTED and player:hasItem(1125,0)) then - colors = player:getVar("ICanHearARainbow"); - o = (tonumber(colors) % 4 >= 2); - y = (tonumber(colors) % 8 >= 4); - v = (tonumber(colors) % 128 >= 64); + + if( triggerLightCutscene( player)) then -- Quest: I Can Hear A Rainbow cs = 0x0068; - if (o == false and wc < 4) then - player:setVar("ICanHearARainbow_Weather",1); - player:setVar("ICanHearARainbow",colors+2); - elseif (y == false and (wc == 8 or wc == 9)) then - player:setVar("ICanHearARainbow_Weather",8); - player:setVar("ICanHearARainbow",colors+4); - elseif (v == false and (wc == 14 or wc == 15)) then - player:setVar("ICanHearARainbow_Weather",14); - player:setVar("ICanHearARainbow",colors+64); - else - cs = -1; - end - end + end + return cs; end; @@ -52,23 +39,19 @@ -- onRegionEnter ----------------------------------- -function onRegionEnter(player,region) +function onRegionEnter( player, region) end; ----------------------------------- -- onEventUpdate ----------------------------------- -function onEventUpdate(player,csid,option) - --printf("CSID: %u",csid); - --printf("RESULT: %u",option); - if (csid == 0x0068) then - weather = player:getVar("ICanHearARainbow_Weather"); - if (player:getVar("ICanHearARainbow") < 127) then - player:updateEvent(0,0,weather); - else - player:updateEvent(0,0,weather,6); - end +function onEventUpdate( player, csid, option) +--printf("CSID: %u",csid); +--printf("RESULT: %u",option); + + if( csid == 0x0068) then + lightCutsceneUpdate( player); -- Quest: I Can Hear A Rainbow end end; @@ -76,10 +59,11 @@ -- onEventFinish ----------------------------------- -function onEventFinish(player,csid,option) - --printf("CSID: %u",csid); - --printf("RESULT: %u",option); - if (csid == 0x0068) then - player:setVar("ICanHearARainbow_Weather",0); +function onEventFinish( player, csid, option) +--printf("CSID: %u",csid); +--printf("RESULT: %u",option); + + if( csid == 0x0068) then + lightCutsceneFinish( player); -- Quest: I Can Hear A Rainbow end end; Index: scripts/zones/La_Theine_Plateau/Zone.lua =================================================================== --- scripts/zones/La_Theine_Plateau/Zone.lua (revision 2482) +++ scripts/zones/La_Theine_Plateau/Zone.lua (working copy) @@ -5,46 +5,34 @@ ----------------------------------- package.loaded["scripts/zones/La_Theine_Plateau/TextIDs"] = nil; + require("scripts/globals/settings"); require("scripts/globals/quests"); require("scripts/zones/La_Theine_Plateau/TextIDs"); +require( "scripts/globals/icanheararainbow"); ----------------------------------- -- onInitialize ----------------------------------- -function onInitialize(zone) +function onInitialize( zone) end; ----------------------------------- -- onZoneIn ----------------------------------- -function onZoneIn(player,prevZone) +function onZoneIn( player, prevZone) + cs = -1; - wc = player:getWeather(); - if ((player:getXPos() == 0) and (player:getYPos() == 0) and (player:getZPos() == 0)) then - player:setPos(-272.118,21.715,98.859,243); - end - if(player:getQuestStatus(WINDURST, I_CAN_HEAR_A_RAINBOW) == QUEST_ACCEPTED and player:hasItem(1125,0)) then - colors = player:getVar("ICanHearARainbow"); - o = (tonumber(colors) % 4 >= 2); - g = (tonumber(colors) % 16 >= 8); - b = (tonumber(colors) % 32 >= 16); + + if( player:getXPos() == 0 and player:getYPos() == 0 and player:getZPos() == 0) then + player:setPos( -272.118, 21.715, 98.859, 243); + end + + if( triggerLightCutscene( player)) then -- Quest: I Can Hear A Rainbow cs = 0x007b; - if (o == false and wc < 4) then - player:setVar("ICanHearARainbow_Weather",1); - player:setVar("ICanHearARainbow",colors+2); - elseif (g == false and (wc == 10 or wc == 11)) then - player:setVar("ICanHearARainbow_Weather",10); - player:setVar("ICanHearARainbow",colors+8); - elseif (b == false and (wc == 6 or wc == 7)) then - player:setVar("ICanHearARainbow_Weather",6); - player:setVar("ICanHearARainbow",colors+16); - else - cs = -1; - end - elseif(prevZone == 193 and player:getVar("darkPuppetCS") == 5 and player:getFreeSlotsCount() >= 1) then + elseif( prevZone == 193 and player:getVar( "darkPuppetCS") == 5 and player:getFreeSlotsCount() >= 1) then cs = 0x007a; end return cs; @@ -54,23 +42,19 @@ -- onRegionEnter ----------------------------------- -function onRegionEnter(player,region) +function onRegionEnter( player, region) end; ----------------------------------- -- onEventUpdate ----------------------------------- -function onEventUpdate(player,csid,option) - --printf("CSID: %u",csid); - --printf("RESULT: %u",option); - if(csid == 0x007b) then - weather = player:getVar("ICanHearARainbow_Weather"); - if(player:getVar("ICanHearARainbow") < 127) then - player:updateEvent(0,0,weather); - else - player:updateEvent(0,0,weather,6); - end +function onEventUpdate( player, csid, option) +--printf("CSID: %u",csid); +--printf("RESULT: %u",option); + + if( csid == 0x007b) then + lightCutsceneUpdate( player); -- Quest: I Can Hear A Rainbow end end; @@ -78,16 +62,17 @@ -- onEventFinish ----------------------------------- -function onEventFinish(player,csid,option) - --printf("CSID: %u",csid); - --printf("RESULT: %u",option); - if(csid == 0x007b) then - player:setVar("ICanHearARainbow_Weather",0); - elseif(csid == 0x007a) then - player:addItem(14096); - player:messageSpecial(ITEM_OBTAINED,14096); -- Chaos Sollerets - player:setVar("darkPuppetCS",0); - player:addFame(BASTOK,AF2_FAME); - player:completeQuest(BASTOK,DARK_PUPPET); +function onEventFinish( player, csid, option) +--printf("CSID: %u",csid); +--printf("RESULT: %u",option); + + if( csid == 0x007b) then + lightCutsceneFinish( player); -- Quest: I Can Hear A Rainbow + elseif( csid == 0x007a) then + player:addItem( 14096); + player:messageSpecial( ITEM_OBTAINED, 14096); -- Chaos Sollerets + player:setVar( "darkPuppetCS", 0); + player:addFame( BASTOK, AF2_FAME); + player:completeQuest( BASTOK,DARK_PUPPET); end end; Index: scripts/zones/Meriphataud_Mountains/Zone.lua =================================================================== --- scripts/zones/Meriphataud_Mountains/Zone.lua (revision 2482) +++ scripts/zones/Meriphataud_Mountains/Zone.lua (working copy) @@ -5,9 +5,9 @@ ----------------------------------- package.loaded["scripts/zones/Meriphataud_Mountains/TextIDs"] = nil; -require("scripts/globals/quests"); -require("scripts/globals/settings"); + require("scripts/zones/Meriphataud_Mountains/TextIDs"); +require( "scripts/globals/icanheararainbow"); ----------------------------------- -- onInitialize @@ -20,31 +20,18 @@ -- onZoneIn ----------------------------------- -function onZoneIn(player,prevZone) +function onZoneIn( player, prevZone) + cs = -1; - wc = player:getWeather(); - if ((player:getXPos() == 0) and (player:getYPos() == 0) and (player:getZPos() == 0)) then - player:setPos(752.632,-33.761,-40.035,129); - end - if (player:getQuestStatus(WINDURST, I_CAN_HEAR_A_RAINBOW) == QUEST_ACCEPTED and player:hasItem(1125,0)) then - colors = player:getVar("ICanHearARainbow"); - o = (tonumber(colors) % 4 >= 2); - r = (tonumber(colors) % 2 >= 1); - y = (tonumber(colors) % 8 >= 4); + + if (player:getXPos() == 0 and player:getYPos() == 0 and player:getZPos() == 0) then + player:setPos( 752.632, -33.761, -40.035, 129); + end + + if( triggerLightCutscene( player)) then -- Quest: I Can Hear A Rainbow cs = 0x001f; - if (o == false and wc < 4) then - player:setVar("ICanHearARainbow_Weather",1); - player:setVar("ICanHearARainbow",colors+2); - elseif (r == false and (wc == 4 or wc == 5)) then - player:setVar("ICanHearARainbow_Weather",4); - player:setVar("ICanHearARainbow",colors+1); - elseif (y == false and (wc == 8 or wc == 9)) then - player:setVar("ICanHearARainbow_Weather",8); - player:setVar("ICanHearARainbow",colors+4); - else - cs = -1; - end - end + end + return cs; end; @@ -52,23 +39,19 @@ -- onRegionEnter ----------------------------------- -function onRegionEnter(player,region) +function onRegionEnter( player, region) end; ----------------------------------- -- onEventUpdate ----------------------------------- -function onEventUpdate(player,csid,option) - --printf("CSID: %u",csid); - --printf("RESULT: %u",option); +function onEventUpdate( player, csid, option) +--printf("CSID: %u",csid); +--printf("RESULT: %u",option); + if (csid == 0x001f) then - weather = player:getVar("ICanHearARainbow_Weather"); - if (player:getVar("ICanHearARainbow") < 127) then - player:updateEvent(0,0,weather); - else - player:updateEvent(0,0,weather,6); - end + lightCutsceneUpdate( player); -- Quest: I Can Hear A Rainbow end end; @@ -76,10 +59,11 @@ -- onEventFinish ----------------------------------- -function onEventFinish(player,csid,option) - --printf("CSID: %u",csid); - --printf("RESULT: %u",option); - if (csid == 0x001f) then - player:setVar("ICanHearARainbow_Weather",0); +function onEventFinish( player, csid, option) +--printf("CSID: %u",csid); +--printf("RESULT: %u",option); + + if( csid == 0x001f) then + lightCutsceneFinish( player); -- Quest: I Can Hear A Rainbow end end; Index: scripts/zones/North_Gustaberg/Zone.lua =================================================================== --- scripts/zones/North_Gustaberg/Zone.lua (revision 2482) +++ scripts/zones/North_Gustaberg/Zone.lua (working copy) @@ -5,38 +5,33 @@ ----------------------------------- package.loaded["scripts/zones/North_Gustaberg/TextIDs"] = nil; -require("scripts/globals/quests"); -require("scripts/globals/settings"); + require("scripts/zones/North_Gustaberg/TextIDs"); +require( "scripts/globals/icanheararainbow"); ----------------------------------- -- onInitialize ----------------------------------- -function onInitialize(zone) +function onInitialize( zone) end; ----------------------------------- -- onZoneIn ----------------------------------- -function onZoneIn(player,prevZone) +function onZoneIn( player, prevZone) + cs = -1; - wc = player:getWeather(); - if ((player:getXPos() == 0) and (player:getYPos() == 0) and (player:getZPos() == 0)) then - player:setPos(-518.867,35.538,588.64,50); - end - if (player:getQuestStatus(WINDURST, I_CAN_HEAR_A_RAINBOW) == QUEST_ACCEPTED and player:hasItem(1125,0)) then - colors = player:getVar("ICanHearARainbow"); - o = (tonumber(colors) % 4 >= 2); + + if( player:getXPos() == 0 and player:getYPos() == 0 and player:getZPos() == 0) then + player:setPos( -518.867, 35.538, 588.64, 50); + end + + if( triggerLightCutscene( player)) then -- Quest: I Can Hear A Rainbow cs = 0x00f4; - if (o == false and wc < 4) then - player:setVar("ICanHearARainbow_Weather",1); - player:setVar("ICanHearARainbow",colors+2); - else - cs = -1; - end - end + end + return cs; end; @@ -44,26 +39,19 @@ -- onRegionEnter ----------------------------------- -function onRegionEnter(player,region) +function onRegionEnter( player, region) end; ----------------------------------- -- onEventUpdate ----------------------------------- -function onEventUpdate(player,csid,option) - --printf("CSID: %u",csid); - --printf("RESULT: %u",option); +function onEventUpdate( player, csid, option) +--printf("CSID: %u",csid); +--printf("RESULT: %u",option); + if (csid == 0x00f4) then - weather = player:getVar("ICanHearARainbow_Weather"); - if (weather == 1) then - weather = 0; - end - if (player:getVar("ICanHearARainbow") < 127) then - player:updateEvent(0,0,weather); - else - player:updateEvent(0,0,weather,6); - end + lightCutsceneUpdate( player); -- Quest: I Can Hear A Rainbow end end; @@ -71,10 +59,11 @@ -- onEventFinish ----------------------------------- -function onEventFinish(player,csid,option) - --printf("CSID: %u",csid); - --printf("RESULT: %u",option); +function onEventFinish( player, csid, option) +--printf("CSID: %u",csid); +--printf("RESULT: %u",option); + if (csid == 0x00f4) then - player:setVar("ICanHearARainbow_Weather",0); + lightCutsceneFinish( player); -- Quest: I Can Hear A Rainbow end end; Index: scripts/zones/Pashhow_Marshlands/Zone.lua =================================================================== --- scripts/zones/Pashhow_Marshlands/Zone.lua (revision 2482) +++ scripts/zones/Pashhow_Marshlands/Zone.lua (working copy) @@ -3,86 +3,66 @@ -- Zone: Pashhow_Marshlands (109) -- ----------------------------------- -package.loaded["scripts/zones/Pashhow_Marshlands/TextIDs"] = nil; -package.loaded["scripts/globals/missions"] = nil; +package.loaded[ "scripts/zones/Pashhow_Marshlands/TextIDs"] = nil; +package.loaded[ "scripts/globals/missions"] = nil; ----------------------------------- -require("scripts/globals/settings"); -require("scripts/globals/missions"); -require("scripts/globals/quests"); -require("scripts/zones/Pashhow_Marshlands/TextIDs"); +require( "scripts/globals/settings"); +require( "scripts/globals/missions"); +require( "scripts/globals/quests"); +require( "scripts/zones/Pashhow_Marshlands/TextIDs"); +require( "scripts/globals/icanheararainbow"); ----------------------------------- -- onInitialize ----------------------------------- -function onInitialize(zone) +function onInitialize( zone) end; ----------------------------------- -- onZoneIn ----------------------------------- -function onZoneIn(player,prevZone) -cs = -1; -wc = player:getWeather(); +function onZoneIn( player, prevZone) - if((player:getXPos() == 0) and (player:getYPos() == 0) and (player:getZPos() == 0)) then - player:setPos(547.841,23.192,696.323,136); - end - if(prevZone == 147 and player:getCurrentMission(BASTOK) == THE_FOUR_MUSKETEERS) then + cs = -1; + + if( player:getXPos() == 0 and player:getYPos() == 0 and player:getZPos() == 0) then + player:setPos( 547.841, 23.192, 696.323, 136); + end + + if( prevZone == 147 and player:getCurrentMission( BASTOK) == THE_FOUR_MUSKETEERS) then missionStatus = player:getVar("MissionStatus"); if(missionStatus < 22) then cs = 0x000a; elseif(missionStatus == 22) then cs = 0x000b; end - elseif(player:getQuestStatus(WINDURST, I_CAN_HEAR_A_RAINBOW) == QUEST_ACCEPTED and player:hasItem(1125,0)) then - colors = player:getVar("ICanHearARainbow"); - o = (tonumber(colors) % 4 >= 2); - b = (tonumber(colors) % 32 >= 16); - v = (tonumber(colors) % 128 >= 64); + elseif( triggerLightCutscene( player)) then -- Quest: I Can Hear A Rainbow cs = 0x000d; - if (o == false and wc < 4) then - player:setVar("ICanHearARainbow_Weather",1); - player:setVar("ICanHearARainbow",colors+2); - elseif (b == false and (wc == 6 or wc == 7)) then - player:setVar("ICanHearARainbow_Weather",6); - player:setVar("ICanHearARainbow",colors+16); - elseif (v == false and (wc == 14 or wc == 15)) then - player:setVar("ICanHearARainbow_Weather",14); - player:setVar("ICanHearARainbow",colors+64); - else - cs = -1; - end - end + end return cs; - end; ----------------------------------- -- onRegionEnter ----------------------------------- -function onRegionEnter(player,region) +function onRegionEnter( player, region) end; ----------------------------------- -- onEventUpdate ----------------------------------- -function onEventUpdate(player,csid,option) +function onEventUpdate( player, csid, option) --printf("CSID: %u",csid); --printf("RESULT: %u",option); - if(csid == 0x000d) then - weather = player:getVar("ICanHearARainbow_Weather"); - if(player:getVar("ICanHearARainbow") < 127) then - player:updateEvent(0,0,weather); - else - player:updateEvent(0,0,weather,6); - end + if( csid == 0x000d) then + lightCutsceneUpdate( player); -- Quest: I Can Hear A Rainbow end end; @@ -91,17 +71,17 @@ -- onEventFinish ----------------------------------- -function onEventFinish(player,csid,option) +function onEventFinish( player, csid, option) --printf("CSID: %u",csid); --printf("RESULT: %u",option); - if(csid == 0x000a) then - player:setPos(578, 25, -376, 126); - elseif(csid == 0x000b) then - finishMissionTimeline(player,1,csid,option); - player:setPos(578, 25, -376, 126); - elseif(csid == 0x000d) then - player:setVar("ICanHearARainbow_Weather",0); + if( csid == 0x000a) then + player:setPos( 578, 25, -376, 126); + elseif( csid == 0x000b) then + finishMissionTimeline( player, 1, csid, option); + player:setPos( 578, 25, -376, 126); + elseif( csid == 0x000d) then + lightCutsceneFinish( player); -- Quest: I Can Hear A Rainbow end end; \ No newline at end of file Index: scripts/zones/Rolanberry_Fields/Zone.lua =================================================================== --- scripts/zones/Rolanberry_Fields/Zone.lua (revision 2482) +++ scripts/zones/Rolanberry_Fields/Zone.lua (working copy) @@ -5,46 +5,33 @@ ----------------------------------- package.loaded["scripts/zones/Rolanberry_Fields/TextIDs"] = nil; -require("scripts/globals/quests"); -require("scripts/globals/settings"); + require("scripts/zones/Rolanberry_Fields/TextIDs"); +require( "scripts/globals/icanheararainbow"); ----------------------------------- -- onInitialize ----------------------------------- -function onInitialize(zone) +function onInitialize( zone) end; ----------------------------------- -- onZoneIn ----------------------------------- -function onZoneIn(player,prevZone) +function onZoneIn( player, prevZone) + cs = -1; - wc = player:getWeather(); - if ((player:getXPos() == 0) and (player:getYPos() == 0) and (player:getZPos() == 0)) then - player:setPos(-381.747,-31.068,-788.092,211); - end - if (player:getQuestStatus(WINDURST, I_CAN_HEAR_A_RAINBOW) == QUEST_ACCEPTED and player:hasItem(1125,0)) then - colors = player:getVar("ICanHearARainbow"); - o = (tonumber(colors) % 4 >= 2); - r = (tonumber(colors) % 2 >= 1); - b = (tonumber(colors) % 32 >= 16); + + if( player:getXPos() == 0 and player:getYPos() == 0 and player:getZPos() == 0) then + player:setPos( -381.747, -31.068, -788.092, 211); + end + + if( triggerLightCutscene( player)) then -- Quest: I Can Hear A Rainbow cs = 0x0002; - if (o == false and wc < 4) then - player:setVar("ICanHearARainbow_Weather",1); - player:setVar("ICanHearARainbow",colors+2); - elseif (r == false and (wc == 4 or wc == 5)) then - player:setVar("ICanHearARainbow_Weather",4); - player:setVar("ICanHearARainbow",colors+1); - elseif (b == false and (wc == 6 or wc == 7)) then - player:setVar("ICanHearARainbow_Weather",6); - player:setVar("ICanHearARainbow",colors+16); - else - cs = -1; - end - end + end + return cs; end; @@ -52,23 +39,19 @@ -- onRegionEnter ----------------------------------- -function onRegionEnter(player,region) +function onRegionEnter( player, region) end; ----------------------------------- -- onEventUpdate ----------------------------------- -function onEventUpdate(player,csid,option) - --printf("CSID: %u",csid); - --printf("RESULT: %u",option); - if (csid == 0x0002) then - weather = player:getVar("ICanHearARainbow_Weather"); - if (player:getVar("ICanHearARainbow") < 127) then - player:updateEvent(0,0,weather); - else - player:updateEvent(0,0,weather,6); - end +function onEventUpdate( player, csid, option) +--printf("CSID: %u",csid); +--printf("RESULT: %u",option); + + if ( csid == 0x0002) then + lightCutsceneUpdate( player); -- Quest: I Can Hear A Rainbow end end; @@ -76,10 +59,11 @@ -- onEventFinish ----------------------------------- -function onEventFinish(player,csid,option) - --printf("CSID: %u",csid); - --printf("RESULT: %u",option); - if (csid == 0x0002) then - player:setVar("ICanHearARainbow_Weather",0); +function onEventFinish( player, csid, option) +--printf("CSID: %u",csid); +--printf("RESULT: %u",option); + + if( csid == 0x0002) then + lightCutsceneFinish( player); -- Quest: I Can Hear A Rainbow end end; Index: scripts/zones/Sauromugue_Champaign/Zone.lua =================================================================== --- scripts/zones/Sauromugue_Champaign/Zone.lua (revision 2482) +++ scripts/zones/Sauromugue_Champaign/Zone.lua (working copy) @@ -5,47 +5,33 @@ ----------------------------------- package.loaded["scripts/zones/Sauromugue_Champaign/TextIDs"] = nil; -require("scripts/globals/quests"); -require("scripts/globals/settings"); + require("scripts/zones/Sauromugue_Champaign/TextIDs"); +require( "scripts/globals/icanheararainbow"); ----------------------------------- -- onInitialize ----------------------------------- -function onInitialize(zone) +function onInitialize( zone) end; ----------------------------------- -- onZoneIn ----------------------------------- -function onZoneIn(player,prevZone) +function onZoneIn( player, prevZone) + cs = -1; - wc = player:getWeather(); - if ((player:getXPos() == 0) and (player:getYPos() == 0) and (player:getZPos() == 0)) then - player:setPos(-103.991,-25.956,-425.221,190); - end - if (player:getQuestStatus(WINDURST, I_CAN_HEAR_A_RAINBOW) == QUEST_ACCEPTED and player:hasItem(1125,0)) then - colors = player:getVar("ICanHearARainbow"); - o = (tonumber(colors) % 4 >= 2); - y = (tonumber(colors) % 8 >= 4); - v = (tonumber(colors) % 128 >= 64); - wc = player:getWeather(); + + if( player:getXPos() == 0 and player:getYPos() == 0 and player:getZPos() == 0) then + player:setPos( -103.991, -25.956, -425.221, 190); + end + + if( triggerLightCutscene( player)) then -- Quest: I Can Hear A Rainbow cs = 0x0003; - if (o == false and wc < 4) then - player:setVar("ICanHearARainbow_Weather",1); - player:setVar("ICanHearARainbow",colors+2); - elseif (y == false and (wc == 8 or wc == 9)) then - player:setVar("ICanHearARainbow_Weather",6); - player:setVar("ICanHearARainbow",colors+4); - elseif (v == false and (wc == 14 or wc == 15)) then - player:setVar("ICanHearARainbow_Weather",14); - player:setVar("ICanHearARainbow",colors+64); - else - cs = -1; - end - end + end + return cs; end; @@ -53,23 +39,19 @@ -- onRegionEnter ----------------------------------- -function onRegionEnter(player,region) +function onRegionEnter( player, region) end; ----------------------------------- -- onEventUpdate ----------------------------------- -function onEventUpdate(player,csid,option) - --printf("CSID: %u",csid); - --printf("RESULT: %u",option); - if (csid == 0x0003) then - weather = player:getVar("ICanHearARainbow_Weather"); - if (player:getVar("ICanHearARainbow") < 127) then - player:updateEvent(0,0,weather); - else - player:updateEvent(0,0,weather,6); - end +function onEventUpdate( player, csid, option) +--printf("CSID: %u",csid); +--printf("RESULT: %u",option); + + if( csid == 0x0003) then + lightCutsceneUpdate( player); -- Quest: I Can Hear A Rainbow end end; @@ -77,10 +59,11 @@ -- onEventFinish ----------------------------------- -function onEventFinish(player,csid,option) - --printf("CSID: %u",csid); - --printf("RESULT: %u",option); - if (csid == 0x0003) then - player:setVar("ICanHearARainbow_Weather",0); +function onEventFinish( player, csid, option) +--printf("CSID: %u",csid); +--printf("RESULT: %u",option); + + if( csid == 0x0003) then + lightCutsceneFinish( player); -- Quest: I Can Hear A Rainbow end end; Index: scripts/zones/Tahrongi_Canyon/Zone.lua =================================================================== --- scripts/zones/Tahrongi_Canyon/Zone.lua (revision 2482) +++ scripts/zones/Tahrongi_Canyon/Zone.lua (working copy) @@ -5,9 +5,9 @@ ----------------------------------- package.loaded["scripts/zones/Tahrongi_Canyon/TextIDs"] = nil; -require("scripts/globals/quests"); -require("scripts/globals/settings"); + require("scripts/zones/Tahrongi_Canyon/TextIDs"); +require( "scripts/globals/icanheararainbow"); ----------------------------------- -- onInitialize @@ -20,31 +20,18 @@ -- onZoneIn ----------------------------------- -function onZoneIn(player,prevZone) +function onZoneIn( player, prevZone) + cs = -1; - wc = player:getWeather(); - if ((player:getXPos() == 0) and (player:getYPos() == 0) and (player:getZPos() == 0)) then - player:setPos(442.781,-1.641,-40.144,160); - end - if (player:getQuestStatus(WINDURST, I_CAN_HEAR_A_RAINBOW) == QUEST_ACCEPTED and player:hasItem(1125,0)) then - colors = player:getVar("ICanHearARainbow"); - o = (tonumber(colors) % 4 >= 2); - y = (tonumber(colors) % 8 >= 4); - g = (tonumber(colors) % 16 >= 8); + + if( player:getXPos() == 0 and player:getYPos() == 0 and player:getZPos() == 0) then + player:setPos( 442.781, -1.641, -40.144, 160); + end + + if( triggerLightCutscene( player)) then -- Quest: I Can Hear A Rainbow cs = 0x0023; - if (o == false and wc < 4) then - player:setVar("ICanHearARainbow_Weather",1); - player:setVar("ICanHearARainbow",colors+2); - elseif (y == false and (wc == 8 or wc == 9)) then - player:setVar("ICanHearARainbow_Weather",8); - player:setVar("ICanHearARainbow",colors+4); - elseif (g == false and (wc == 10 or wc == 11)) then - player:setVar("ICanHearARainbow_Weather",10); - player:setVar("ICanHearARainbow",colors+8); - else - cs = -1; - end - end + end + return cs; end; @@ -52,23 +39,19 @@ -- onRegionEnter ----------------------------------- -function onRegionEnter(player,region) +function onRegionEnter( player, region) end; ----------------------------------- -- onEventUpdate ----------------------------------- -function onEventUpdate(player,csid,option) - --printf("CSID: %u",csid); - --printf("RESULT: %u",option); - if (csid == 0x0023) then - weather = player:getVar("ICanHearARainbow_Weather"); - if (player:getVar("ICanHearARainbow") < 127) then - player:updateEvent(0,0,weather); - else - player:updateEvent(0,0,weather,6); - end +function onEventUpdate( player, csid, option) +--printf("CSID: %u",csid); +--printf("RESULT: %u",option); + + if( csid == 0x0023) then + lightCutsceneUpdate( player); -- Quest: I Can Hear A Rainbow end end; @@ -76,10 +59,11 @@ -- onEventFinish ----------------------------------- -function onEventFinish(player,csid,option) - --printf("CSID: %u",csid); - --printf("RESULT: %u",option); - if (csid == 0x0023) then - player:setVar("ICanHearARainbow_Weather",0); +function onEventFinish( player, csid, option) +--printf("CSID: %u",csid); +--printf("RESULT: %u",option); + + if( csid == 0x0023) then + lightCutsceneFinish( player); -- Quest: I Can Hear A Rainbow end end; Index: scripts/zones/The_Sanctuary_of_ZiTah/Zone.lua =================================================================== --- scripts/zones/The_Sanctuary_of_ZiTah/Zone.lua (revision 2482) +++ scripts/zones/The_Sanctuary_of_ZiTah/Zone.lua (working copy) @@ -5,46 +5,33 @@ ----------------------------------- package.loaded["scripts/zones/The_Sanctuary_of_ZiTah/TextIDs"] = nil; -require("scripts/globals/quests"); -require("scripts/globals/settings"); + require("scripts/zones/The_Sanctuary_of_ZiTah/TextIDs"); +require( "scripts/globals/icanheararainbow"); ----------------------------------- -- onInitialize ----------------------------------- -function onInitialize(zone) +function onInitialize( zone) end; ----------------------------------- -- onZoneIn ----------------------------------- -function onZoneIn(player,prevZone) +function onZoneIn( player, prevZone) + cs = -1; - wc = player:getWeather(); - if ((player:getXPos() == 0) and (player:getYPos() == 0) and (player:getZPos() == 0)) then - player:setPos(539.901,3.379,-580.218,126); - end - if (player:getQuestStatus(WINDURST, I_CAN_HEAR_A_RAINBOW) == QUEST_ACCEPTED and player:hasItem(1125,0)) then - colors = player:getVar("ICanHearARainbow"); - o = (tonumber(colors) % 4 >= 2); - b = (tonumber(colors) % 32 >= 16); - v = (tonumber(colors) % 128 >= 64); + + if( player:getXPos() == 0 and player:getYPos() == 0 and player:getZPos() == 0) then + player:setPos( 539.901, 3.379, -580.218, 126); + end + + if( triggerLightCutscene( player)) then -- Quest: I Can Hear A Rainbow cs = 0x0002; - if (o == false and wc < 4) then - player:setVar("ICanHearARainbow_Weather",1); - player:setVar("ICanHearARainbow",colors+2); - elseif (b == false and (wc == 6 or wc == 7)) then - player:setVar("ICanHearARainbow_Weather",6); - player:setVar("ICanHearARainbow",colors+16); - elseif (v == false and (wc == 14 or wc == 15)) then - player:setVar("ICanHearARainbow_Weather",14); - player:setVar("ICanHearARainbow",colors+64); - else - cs = -1; - end - end + end + return cs; end; @@ -52,23 +39,19 @@ -- onRegionEnter ----------------------------------- -function onRegionEnter(player,region) +function onRegionEnter( player, region) end; ----------------------------------- -- onEventUpdate ----------------------------------- -function onEventUpdate(player,csid,option) - --printf("CSID: %u",csid); - --printf("RESULT: %u",option); - if (csid == 0x0002) then - weather = player:getVar("ICanHearARainbow_Weather"); - if (player:getVar("ICanHearARainbow") < 127) then - player:updateEvent(0,0,weather); - else - player:updateEvent(0,0,weather,6); - end +function onEventUpdate( player, csid, option) +--printf("CSID: %u",csid); +--printf("RESULT: %u",option); + + if( csid == 0x0002) then + lightCutsceneUpdate( player); -- Quest: I Can Hear A Rainbow end end; @@ -76,10 +59,11 @@ -- onEventFinish ----------------------------------- -function onEventFinish(player,csid,option) - --printf("CSID: %u",csid); - --printf("RESULT: %u",option); - if (csid == 0x0002) then - player:setVar("ICanHearARainbow_Weather",0); +function onEventFinish( player, csid, option) +--printf("CSID: %u",csid); +--printf("RESULT: %u",option); + + if( csid == 0x0002) then + lightCutsceneFinish( player); -- Quest: I Can Hear A Rainbow end end; Index: scripts/zones/Valkurm_Dunes/Zone.lua =================================================================== --- scripts/zones/Valkurm_Dunes/Zone.lua (revision 2482) +++ scripts/zones/Valkurm_Dunes/Zone.lua (working copy) @@ -5,9 +5,9 @@ ----------------------------------- package.loaded["scripts/zones/Valkurm_Dunes/TextIDs"] = nil; -require("scripts/globals/quests"); -require("scripts/globals/settings"); + require("scripts/zones/Valkurm_Dunes/TextIDs"); +require( "scripts/globals/icanheararainbow"); ----------------------------------- -- onInitialize @@ -20,31 +20,18 @@ -- onZoneIn ----------------------------------- -function onZoneIn(player,prevZone) +function onZoneIn( player, prevZone) + cs = -1; - wc = player:getWeather(); - if ((player:getXPos() == 0) and (player:getYPos() == 0) and (player:getZPos() == 0)) then - player:setPos(60.989,-4.898,-151.001,198); - end - if (player:getQuestStatus(WINDURST, I_CAN_HEAR_A_RAINBOW) == QUEST_ACCEPTED and player:hasItem(1125,0)) then - colors = player:getVar("ICanHearARainbow"); - o = (tonumber(colors) % 4 >= 2); - r = (tonumber(colors) % 2 >= 1); - y = (tonumber(colors) % 8 >= 4); + + if( player:getXPos() == 0 and player:getYPos() == 0 and player:getZPos() == 0) then + player:setPos( 60.989, -4.898, -151.001, 198); + end + + if( triggerLightCutscene( player)) then -- Quest: I Can Hear A Rainbow cs = 0x0003; - if (o == false and wc < 4) then - player:setVar("ICanHearARainbow_Weather",1); - player:setVar("ICanHearARainbow",colors+2); - elseif (r == false and (wc == 4 or wc == 5)) then - player:setVar("ICanHearARainbow_Weather",4); - player:setVar("ICanHearARainbow",colors+1); - elseif (y == false and (wc == 8 or wc == 9)) then - player:setVar("ICanHearARainbow_Weather",8); - player:setVar("ICanHearARainbow",colors+4); - else - cs = -1; - end - end + end + return cs; end; @@ -52,23 +39,19 @@ -- onRegionEnter ----------------------------------- -function onRegionEnter(player,region) +function onRegionEnter( player, region) end; ----------------------------------- -- onEventUpdate ----------------------------------- -function onEventUpdate(player,csid,option) - --printf("CSID: %u",csid); - --printf("RESULT: %u",option); - if (csid == 0x0003) then - weather = player:getVar("ICanHearARainbow_Weather"); - if (player:getVar("ICanHearARainbow") < 127) then - player:updateEvent(0,0,weather); - else - player:updateEvent(0,0,weather,6); - end +function onEventUpdate( player, csid, option) +--printf("CSID: %u",csid); +--printf("RESULT: %u",option); + + if( csid == 0x0003) then + lightCutsceneUpdate( player); -- Quest: I Can Hear A Rainbow end end; @@ -76,10 +59,11 @@ -- onEventFinish ----------------------------------- -function onEventFinish(player,csid,option) - --printf("CSID: %u",csid); - --printf("RESULT: %u",option); - if (csid == 0x0003) then - player:setVar("ICanHearARainbow_Weather",0); +function onEventFinish( player, csid, option) +--printf("CSID: %u",csid); +--printf("RESULT: %u",option); + + if( csid == 0x0003) then + lightCutsceneFinish( player); -- Quest: I Can Hear A Rainbow end end; Index: scripts/zones/West_Sarutabaruta/Zone.lua =================================================================== --- scripts/zones/West_Sarutabaruta/Zone.lua (revision 2482) +++ scripts/zones/West_Sarutabaruta/Zone.lua (working copy) @@ -4,39 +4,34 @@ -- ----------------------------------- -package.loaded["scripts/zones/West_Sarutabaruta/TextIDs"] = nil; -require("scripts/zones/West_Sarutabaruta/TextIDs"); -require("scripts/globals/quests"); -require("scripts/globals/settings"); +package.loaded[ "scripts/zones/West_Sarutabaruta/TextIDs"] = nil; +require( "scripts/zones/West_Sarutabaruta/TextIDs"); +require( "scripts/globals/icanheararainbow"); + ----------------------------------- -- onInitialize ----------------------------------- -function onInitialize(zone) +function onInitialize( zone) end; ----------------------------------- -- onZoneIn ----------------------------------- -function onZoneIn(player,prevZone) +function onZoneIn( player, prevZone) + cs = -1; - wc = player:getWeather(); - if ((player:getXPos() == 0) and (player:getYPos() == 0) and (player:getZPos() == 0)) then - player:setPos(-374.008,-23.712,63.289,213); - end - if (player:getQuestStatus(WINDURST, I_CAN_HEAR_A_RAINBOW) == QUEST_ACCEPTED and player:hasItem(1125,0)) then - colors = player:getVar("ICanHearARainbow"); - o = (tonumber(colors) % 4 >= 2); + + if( player:getXPos() == 0 and player:getYPos() == 0 and player:getZPos() == 0) then + player:setPos( -374.008, -23.712, 63.289, 213); + end + + if( triggerLightCutscene( player)) then -- Quest: I Can Hear A Rainbow cs = 0x0030; - if (o == false and wc < 4) then - player:setVar("ICanHearARainbow_Weather",1); - player:setVar("ICanHearARainbow",colors+2); - else - cs = -1; - end end + return cs; end; @@ -44,26 +39,19 @@ -- onRegionEnter ----------------------------------- -function onRegionEnter(player,region) +function onRegionEnter( player, region) end; ----------------------------------- -- onEventUpdate ----------------------------------- -function onEventUpdate(player,csid,option) - --printf("CSID: %u",csid); - --printf("RESULT: %u",option); +function onEventUpdate( player, csid, option) +--printf("CSID: %u",csid); +--printf("RESULT: %u",option); + if (csid == 0x0030) then - weather = player:getVar("ICanHearARainbow_Weather"); - if (weather == 1) then - weather = 0; - end - if (player:getVar("ICanHearARainbow") < 127) then - player:updateEvent(0,0,weather); - else - player:updateEvent(0,0,weather,6); - end + lightCutsceneUpdate( player); -- Quest: I Can Hear A Rainbow end end; @@ -71,10 +59,11 @@ -- onEventFinish ----------------------------------- -function onEventFinish(player,csid,option) - --printf("CSID: %u",csid); - --printf("RESULT: %u",option); +function onEventFinish( player, csid, option) +--printf("CSID: %u",csid); +--printf("RESULT: %u",option); + if (csid == 0x0030) then - player:setVar("ICanHearARainbow_Weather",0); + lightCutsceneFinish( player); -- Quest: I Can Hear A Rainbow end end; Index: scripts/zones/Western_Altepa_Desert/Zone.lua =================================================================== --- scripts/zones/Western_Altepa_Desert/Zone.lua (revision 2482) +++ scripts/zones/Western_Altepa_Desert/Zone.lua (working copy) @@ -5,9 +5,9 @@ ----------------------------------- package.loaded["scripts/zones/Western_Altepa_Desert/TextIDs"] = nil; -require("scripts/globals/quests"); -require("scripts/globals/settings"); + require("scripts/zones/Western_Altepa_Desert/TextIDs"); +require( "scripts/globals/icanheararainbow"); ----------------------------------- -- onInitialize @@ -20,31 +20,18 @@ -- onZoneIn ----------------------------------- -function onZoneIn(player,prevZone) +function onZoneIn( player, prevZone) + cs = -1; - wc = player:getWeather(); - if ((player:getXPos() == 0) and (player:getYPos() == 0) and (player:getZPos() == 0)) then - player:setPos(-19.901,13.607,440.058,78); - end - if (player:getQuestStatus(WINDURST, I_CAN_HEAR_A_RAINBOW) == QUEST_ACCEPTED and player:hasItem(1125,0)) then - colors = player:getVar("ICanHearARainbow"); - o = (tonumber(colors) % 4 >= 2); - r = (tonumber(colors) % 2 >= 1); - y = (tonumber(colors) % 8 >= 4); + + if( player:getXPos() == 0 and player:getYPos() == 0 and player:getZPos() == 0) then + player:setPos( -19.901, 13.607, 440.058, 78); + end + + if( triggerLightCutscene( player)) then -- Quest: I Can Hear A Rainbow cs = 0x0002; - if (o == false and wc < 4) then - player:setVar("ICanHearARainbow_Weather",1); - player:setVar("ICanHearARainbow",colors+2); - elseif (r == false and (wc == 4 or wc == 5)) then - player:setVar("ICanHearARainbow_Weather",4); - player:setVar("ICanHearARainbow",colors+1); - elseif (y == false and (wc == 8 or wc == 9)) then - player:setVar("ICanHearARainbow_Weather",8); - player:setVar("ICanHearARainbow",colors+4); - else - cs = -1; - end - end + end + return cs; end; @@ -52,23 +39,19 @@ -- onRegionEnter ----------------------------------- -function onRegionEnter(player,region) +function onRegionEnter( player, region) end; ----------------------------------- -- onEventUpdate ----------------------------------- -function onEventUpdate(player,csid,option) - --printf("CSID: %u",csid); - --printf("RESULT: %u",option); - if (csid == 0x0002) then - weather = player:getVar("ICanHearARainbow_Weather"); - if (player:getVar("ICanHearARainbow") < 127) then - player:updateEvent(0,0,weather); - else - player:updateEvent(0,0,weather,6); - end +function onEventUpdate( player, csid, option) +--printf("CSID: %u",csid); +--printf("RESULT: %u",option); + + if( csid == 0x0002) then + lightCutsceneUpdate( player); -- Quest: I Can Hear A Rainbow end end; @@ -76,10 +59,11 @@ -- onEventFinish ----------------------------------- -function onEventFinish(player,csid,option) - --printf("CSID: %u",csid); - --printf("RESULT: %u",option); +function onEventFinish( player, csid, option) +--printf("CSID: %u",csid); +--printf("RESULT: %u",option); + if (csid == 0x0002) then - player:setVar("ICanHearARainbow_Weather",0); + lightCutsceneFinish( player); -- Quest: I Can Hear A Rainbow end end; Index: scripts/zones/Xarcabard/Zone.lua =================================================================== --- scripts/zones/Xarcabard/Zone.lua (revision 2482) +++ scripts/zones/Xarcabard/Zone.lua (working copy) @@ -4,46 +4,37 @@ -- ----------------------------------- -require("scripts/globals/quests"); -require("scripts/globals/keyitems"); +package.loaded[ "scripts/zones/Xarcabard/TextIDs"] = nil; +require( "scripts/zones/Xarcabard/TextIDs"); +require( "scripts/globals/icanheararainbow"); +require( "scripts/globals/keyitems"); + ----------------------------------- -- onInitialize ----------------------------------- -function onInitialize(zone) +function onInitialize( zone) end; ----------------------------------- -- onZoneIn ----------------------------------- -function onZoneIn(player,prevZone) +function onZoneIn( player, prevZone) local cs = -1; - local wc = player:getWeather(); - if((player:getXPos() == 0) and (player:getYPos() == 0) and (player:getZPos() == 0)) then - player:setPos(-136.287,-23.268,137.302,91); - end - if(player:hasKeyItem(VIAL_OF_SHROUDED_SAND) == false and player:getRank() >= 6 and player:getMainLvl() >= 65 and player:getVar("Dynamis_Status") == 0) then - player:setVar("Dynamis_Status",1); + if( player:getXPos() == 0 and player:getYPos() == 0 and player:getZPos() == 0) then + player:setPos( -136.287, -23.268, 137.302, 91); + end + + if( player:hasKeyItem( VIAL_OF_SHROUDED_SAND) == false and player:getRank() >= 6 and player:getMainLvl() >= 65 and player:getVar( "Dynamis_Status") == 0) then + player:setVar( "Dynamis_Status", 1); cs = 0x000D; - elseif(player:getQuestStatus(WINDURST,I_CAN_HEAR_A_RAINBOW) == QUEST_ACCEPTED and player:hasItem(1125,0)) then - local colors = player:getVar("ICanHearARainbow"); - - if((tonumber(colors) % 4 >= 2) == false and wc < 4) then - player:setVar("ICanHearARainbow_Weather",1); - player:setVar("ICanHearARainbow",colors+2); - elseif ((tonumber(colors) % 64 >= 32) == false and (wc == 12 or wc == 13)) then - player:setVar("ICanHearARainbow_Weather",12); - player:setVar("ICanHearARainbow",colors+32); - else - cs = -1; - end - + elseif( triggerLightCutscene( player)) then -- Quest: I Can Hear A Rainbow cs = 0x0009; - end + end return cs; @@ -53,25 +44,19 @@ -- onRegionEnter ----------------------------------- -function onRegionEnter(player,region) +function onRegionEnter( player, region) end; ----------------------------------- -- onEventUpdate ----------------------------------- -function onEventUpdate(player,csid,option) +function onEventUpdate( player, csid, option) --printf("CSID: %u",csid); --printf("RESULT: %u",option); - if(csid == 0x0009) then - local weather = player:getVar("ICanHearARainbow_Weather"); - - if(player:getVar("ICanHearARainbow") < 127) then - player:updateEvent(0,0,weather); - else - player:updateEvent(0,0,weather,6); - end + if( csid == 0x0009) then + lightCutsceneUpdate( player); -- Quest: I Can Hear A Rainbow end end; @@ -80,12 +65,12 @@ -- onEventFinish ----------------------------------- -function onEventFinish(player,csid,option) +function onEventFinish( player, csid, option) --printf("CSID: %u",csid); --printf("RESULT: %u",option); - if(csid == 0x0009) then - player:setVar("ICanHearARainbow_Weather",0); + if( csid == 0x0009) then + lightCutsceneFinish( player); -- Quest: I Can Hear A Rainbow end end; Index: scripts/zones/Yhoator_Jungle/Zone.lua =================================================================== --- scripts/zones/Yhoator_Jungle/Zone.lua (revision 2482) +++ scripts/zones/Yhoator_Jungle/Zone.lua (working copy) @@ -4,74 +4,54 @@ -- ----------------------------------- -package.loaded["scripts/zones/Yhoator_Jungle/TextIDs"] = nil; -require("scripts/globals/quests"); -require("scripts/globals/settings"); -require("scripts/zones/Yhoator_Jungle/TextIDs"); +package.loaded[ "scripts/zones/Yhoator_Jungle/TextIDs"] = nil; +require( "scripts/zones/Yhoator_Jungle/TextIDs"); +require( "scripts/globals/icanheararainbow"); + ----------------------------------- -- onInitialize ----------------------------------- -function onInitialize(zone) +function onInitialize( zone) end; ----------------------------------- -- onZoneIn ----------------------------------- -function onZoneIn(player,prevZone) +function onZoneIn( player, prevZone) + cs = -1; - wc = player:getWeather(); - if ((player:getXPos() == 0) and (player:getYPos() == 0) and (player:getZPos() == 0)) then - player:setPos(299.997,-5.838,-622.998,190); - end - if (player:getQuestStatus(WINDURST, I_CAN_HEAR_A_RAINBOW) == QUEST_ACCEPTED and player:hasItem(1125,0)) then - colors = player:getVar("ICanHearARainbow"); - r = (tonumber(colors) % 2 >= 1); - o = (tonumber(colors) % 8 >= 4); - b = (tonumber(colors) % 32 >= 16); - cs = 0x0002; - if (r == false and (wc == 4 or wc == 5)) then - player:setVar("ICanHearARainbow_Weather",4); - player:setVar("ICanHearARainbow",colors+1); - elseif (o == false and wc < 4) then - player:setVar("ICanHearARainbow_Weather",1); - player:setVar("ICanHearARainbow",colors+2); - elseif (b == false and (wc == 6 or wc == 7)) then - player:setVar("ICanHearARainbow_Weather",6); - player:setVar("ICanHearARainbow",colors+16); - else - cs = -1; - end + + if( player:getXPos() == 0 and player:getYPos() == 0 and player:getZPos() == 0) then + player:setPos( 299.997, -5.838, -622.998, 190); + end + + if( triggerLightCutscene( player)) then -- Quest: I Can Hear A Rainbow + cs = 0x0002; end return cs; end; ------------------------------------ +------------------------ +----------- -- onRegionEnter ----------------------------------- -function onRegionEnter(player,region) +function onRegionEnter( player, region) end; ----------------------------------- -- onEventUpdate ----------------------------------- -function onEventUpdate(player,csid,option) - --printf("CSID: %u",csid); - --printf("RESULT: %u",option); - if (csid == 0x0002) then - weather = player:getVar("ICanHearARainbow_Weather"); - if (weather == 1) then - weather = 0; - end - if (player:getVar("ICanHearARainbow") < 127) then - player:updateEvent(0,0,weather); - else - player:updateEvent(0,0,weather,6); - end +function onEventUpdate( player, csid, option) +--printf("CSID: %u",csid); +--printf("RESULT: %u",option); + + if( csid == 0x0002) then + lightCutsceneUpdate( player); -- Quest: I Can Hear A Rainbow end end; @@ -79,10 +59,11 @@ -- onEventFinish ----------------------------------- -function onEventFinish(player,csid,option) - --printf("CSID: %u",csid); - --printf("RESULT: %u",option); - if (csid == 0x0002) then - player:setVar("ICanHearARainbow_Weather",0); +function onEventFinish( player, csid, option) +--printf("CSID: %u",csid); +--printf("RESULT: %u",option); + + if( csid == 0x0002) then + lightCutsceneFinish( player); -- Quest: I Can Hear A Rainbow end end; Index: scripts/zones/Yuhtunga_Jungle/Zone.lua =================================================================== --- scripts/zones/Yuhtunga_Jungle/Zone.lua (revision 2482) +++ scripts/zones/Yuhtunga_Jungle/Zone.lua (working copy) @@ -5,46 +5,33 @@ ----------------------------------- package.loaded["scripts/zones/Yuhtunga_Jungle/TextIDs"] = nil; -require("scripts/globals/quests"); -require("scripts/globals/settings"); + require("scripts/zones/Yuhtunga_Jungle/TextIDs"); +require( "scripts/globals/icanheararainbow"); ----------------------------------- -- onInitialize ----------------------------------- -function onInitialize(zone) +function onInitialize( zone) end; ----------------------------------- -- onZoneIn ----------------------------------- -function onZoneIn(player,prevZone) +function onZoneIn( player, prevZone) + cs = -1; - wc = player:getWeather(); - if ((player:getXPos() == 0) and (player:getYPos() == 0) and (player:getZPos() == 0)) then - player:setPos(116.825,6.613,100,140); - end - if (player:getQuestStatus(WINDURST, I_CAN_HEAR_A_RAINBOW) == QUEST_ACCEPTED and player:hasItem(1125,0)) then - colors = player:getVar("ICanHearARainbow"); - o = (tonumber(colors) % 4 >= 2); - r = (tonumber(colors) % 2 >= 1); - b = (tonumber(colors) % 32 >= 16); + + if( player:getXPos() == 0 and player:getYPos() == 0 and player:getZPos() == 0) then + player:setPos( 116.825, 6.613, 100, 140); + end + + if( triggerLightCutscene( player)) then -- Quest: I Can Hear A Rainbow cs = 0x000b; - if (o == false and wc < 4) then - player:setVar("ICanHearARainbow_Weather",1); - player:setVar("ICanHearARainbow",colors+2); - elseif (r == false and (wc == 4 or wc == 5)) then - player:setVar("ICanHearARainbow_Weather",4); - player:setVar("ICanHearARainbow",colors+1); - elseif (b == false and (wc == 6 or wc == 7)) then - player:setVar("ICanHearARainbow_Weather",6); - player:setVar("ICanHearARainbow",colors+16); - else - cs = -1; - end - end + end + return cs; end; @@ -52,23 +39,19 @@ -- onRegionEnter ----------------------------------- -function onRegionEnter(player,region) +function onRegionEnter( player, region) end; ----------------------------------- -- onEventUpdate ----------------------------------- -function onEventUpdate(player,csid,option) - --printf("CSID: %u",csid); - --printf("RESULT: %u",option); +function onEventUpdate( player, csid, option) +--printf("CSID: %u",csid); +--printf("RESULT: %u",option); + if (csid == 0x000b) then - weather = player:getVar("ICanHearARainbow_Weather"); - if (player:getVar("ICanHearARainbow") < 127) then - player:updateEvent(0,0,weather); - else - player:updateEvent(0,0,weather,6); - end + lightCutsceneUpdate( player); -- Quest: I Can Hear A Rainbow end end; @@ -76,10 +59,11 @@ -- onEventFinish ----------------------------------- -function onEventFinish(player,csid,option) - --printf("CSID: %u",csid); - --printf("RESULT: %u",option); +function onEventFinish( player, csid, option) +--printf("CSID: %u",csid); +--printf("RESULT: %u",option); + if (csid == 0x000b) then - player:setVar("ICanHearARainbow_Weather",0); + lightCutsceneFinish( player); -- Quest: I Can Hear A Rainbow end end;