Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- -- OPEN AUDITORIUM
- -- AUTHOR : ALTAMURENZA
- --[[
- Created : 21/08/2021
- Last Modified : 19/05/2022
- - SCRIPT INFORMATION -
- I'm sorry for being lazy to make a full comment on this script.
- I'll just provide some notable informations you need to know.
- 1) SETUP table vs FIELD table:
- - SETUP = How the mod prepares everything
- - FIELD = How the mod goes (rule & scope)
- 2) FIELD.SMOOTH_CLEANUP condition
- FIELD.SMOOTH_CLEANUP will make NPCs exit the auditorium once the maximum event time being reached.
- It will happen if you don't leave the auditorium after 6 pm (according to SETUP.EVENT).
- If you exit the auditorium before the time limit, the NPCs will just disappear like a normal day in Bully.
- The rest of them should be easy to understand.
- - AUTHOR'S POLICY -
- You can edit any part of this mod and play it privately.
- However, you cannot upload it as a compiled script or source code.
- It simply because i would never give permission to do so.
- Everything that is not mentioned above is allowed, you don't have to ask me for a permission.
- Q: Can i publish a modified version of this?
- A: No, that's obviously a copy. Too easy, like 5 minutes ready mod.
- Q: Can i use some resources from this script to my mod?
- A: Yes, i'm eager to see your innovation, the community is eager to fresh content.
- ]]
- main = function()
- AreaDisableCameraControlForTransition(true)
- DATLoad("eventsAuditorium.DAT", 0)
- DATLoad("SP_Auditorium.DAT", 0)
- F_PreDATInit()
- DATInit()
- shared.gAreaDATFileLoaded[19] = true
- shared.gAreaDataLoaded = true
- CameraFade(1, 0)
- local HOUR, MINUTE = ClockGet()
- local SETUP = {}
- SETUP.FLAG = false
- SETUP.EVENT = (HOUR >= 12 and HOUR < 18) and true or false
- if not MissionActiveSpecific("3_01C") and not MissionActiveSpecific("1_09") then
- if not SETUP.PROP then
- if ChapterGet() == 2 and not IsMissionCompleated("3_01C") then
- AreaLoadSpecialEntities("nutcracker", true)
- AreaEnsureSpecialEntitiesAreCreated()
- elseif IsMissionCompleated("1_03") and not IsMissionCompleated("1_09") then
- AreaLoadSpecialEntities("vote", true)
- AreaEnsureSpecialEntitiesAreCreated()
- end
- SETUP.PROP = true
- end
- if not SETUP.FLAG then
- DATLoad("3_01C.DAT", 2)
- if ChapterGet() == 2 then
- DATLoad("ClassMusic.DAT", 2)
- DATInit()
- if not IsMissionCompleated("3_01C") and SETUP.EVENT then
- SETUP.NPC = {}
- table.insert(SETUP.NPC, {"MSPETERS", 249, POINTLIST._3_01C_MSPETERS, "/Global/MGMusic/Animations/Teacher", "Act/Conv/MGMusic.act"})
- table.insert(SETUP.NPC, {"MELODY", IsMissionCompleated("3_01D") and 257 or 137, POINTLIST._3_01C_DANCER01, "/Global/3_01C/Flower", "Act/Conv/3_01C.act"})
- table.insert(SETUP.NPC, {"EUNICE", IsMissionCompleated("3_01D") and 256 or 74, POINTLIST._3_01C_DANCER02, "/Global/3_01C/Fairy", "Act/Conv/3_01C.act"})
- table.insert(SETUP.NPC, {"PEDRO", IsMissionCompleated("3_01D") and 258 or 69, POINTLIST._3_01C_DANCER03, "/Global/3_01C/Flower", "Act/Conv/3_01C.act"})
- table.insert(SETUP.NPC, {"PETER", IsMissionCompleated("3_01D") and 255 or 134, POINTLIST._3_01C_BAND02, "/Global/MGMusic/Animations/Gary/Sticks/Timpani", "Act/Conv/MGMusic.act"})
- if not IsMissionCompleated("3_01D") then
- table.insert(SETUP.NPC, {"CONSTANTINOS", 70, POINTLIST._3_01C_PLAYERSTART, "/Global/MGMusic/Animations/Jimmy/Sticks/xylophone", "Act/Conv/MGMusic.act"})
- end
- LoadActionTree("Act/Conv/MGMusic.act")
- LoadActionTree("Act/Conv/3_01C.act")
- WeaponRequestModel(439)
- WeaponRequestModel(443)
- WeaponRequestModel(444)
- for _, V in ipairs(SETUP.NPC) do
- if not PedIsValid(_G[V[1]]) then
- _G[V[1]] = PedCreatePoint(V[2], V[3])
- PedIgnoreStimuli(_G[V[1]], true)
- PedSetStationary(_G[V[1]], true)
- if V[1] == "PETER" then
- SoundLoadBank("MINIGAME\\TIMPANI_01.bnk")
- GeometryInstance("xmas_timpani", false, -762.71301269531, 308.60299682617, 77.249000549316)
- GeometryInstance("xmas_timstick_l", false, -762.61901855469, 307.45700073242, 74.888999938965)
- GeometryInstance("x_cowbell_2p", false, -762.73699951172, 307.45700073242, 74.888999938965)
- PedSetActionNode(_G[V[1]], V[4], V[5])
- Wait(10)
- PedSetActionNode(_G[V[1]], "/Global/MGMusic/Animations/Gary/CustomIdle", "Act/Conv/MGMusic.act")
- elseif V[1] == "CONSTANTINOS" then
- GeometryInstance("xmas_xylophone", false, -763.99597167969, 308.15399169922, 77.249000549316)
- GeometryInstance("xmas_xylostick_r", false, -763.59899902344, 307.45700073242, 74.888999938965)
- GeometryInstance("xmas_xylostick_l", false, -763.48101806641, 307.45700073242, 74.888999938965)
- PedSetActionNode(_G[V[1]], V[4], V[5])
- Wait(10)
- PedSetActionNode(_G[V[1]], "/Global/MGMusic/Animations/Jimmy/CustomIdle", "Act/Conv/MGMusic.act")
- else
- PedSetActionNode(_G[V[1]], V[4], V[5])
- end
- end
- end
- SETUP.ANIM = {
- "Drumming",
- "Pageant",
- "UBO",
- "NPC_Spectator",
- }
- for _, V in ipairs(SETUP.ANIM) do
- if HasAnimGroupLoaded(V) == false then
- LoadAnimationGroup(V)
- end
- end
- end
- else
- if not IsMissionCompleated("1_09") and IsMissionCompleated("1_03") and SETUP.EVENT then
- DATLoad("1_09.DAT", 2)
- DATInit()
- SETUP.NPC = {}
- table.insert(SETUP.NPC, {"EARNEST", 10, POINTLIST._1_09_EARNEST})
- table.insert(SETUP.NPC, {"BEATRICE", 3, POINTLIST._1_09_SEATEDPOINTS, 1})
- table.insert(SETUP.NPC, {"FATTY", 5, POINTLIST._1_09_SEATEDPOINTS, 2})
- table.insert(SETUP.NPC, {"CORNELIUS", 9, POINTLIST._1_09_SEATEDPOINTS, 3})
- table.insert(SETUP.NPC, {"BUCKY", 8, POINTLIST._1_09_SEATEDPOINTS, 4})
- table.insert(SETUP.NPC, {"MELVIN", 6, POINTLIST._1_09_SEATEDPOINTS, 5})
- for _, V in ipairs(SETUP.NPC) do
- if not PedIsValid(_G[V[1]]) then
- _G[V[1]] = PedCreatePoint(V[2], V[3], V[4] or nil)
- PedIgnoreStimuli(_G[V[1]], true)
- PedIgnoreAttacks(_G[V[1]], true)
- PedSetMinHealth(_G[V[1]], 25)
- if V[1] == "EARNEST" then
- PedSetFlag(_G[V[1]], 13, true)
- PedSetActionNode(_G[V[1]], "/Global/NPC1_09/Speech", "Act/Anim/NPC1_09.act")
- else
- PedSetActionNode(_G[V[1]], "/Global/1_09/CustomPedTree", "Act/Conv/1_09.act")
- end
- end
- end
- SETUP.ANIM = {
- "1_09_Candidate",
- "NPC_Mascot",
- "NIS_1_09",
- "IDLE_NERD_A",
- "Cheer_Nerd1",
- }
- for _, V in ipairs(SETUP.ANIM) do
- if HasAnimGroupLoaded(V) == false then
- LoadAnimationGroup(V)
- end
- end
- end
- end
- SETUP.FLAG = true
- end
- end
- local FIELD = {}
- FIELD.VIOLATION = {
- [1] = true, [2] = true, [4] = true, [7] = true, [9] = true,
- [12] = true, [27] = true, [60] = true, [61] = true, [74] = true
- }
- FIELD.BREACH = function()
- if PedInRectangle(gPlayer, -778.45, 306.26, -760.57, 319.52) then
- if not FIELD.INTERRUPT then
- local BX, BY, BZ = PedGetOffsetInWorldCoords(gPlayer, 0, -1.5, 0)
- local RAT = PedCreateXYZ(136, BX, BY, BZ + 12)
- PedSetEffectedByGravity(RAT, false)
- PedSetStationary(RAT, true)
- PedSetAsleep(RAT, true)
- PedSetInvulnerable(RAT, true)
- PedMakeTargetable(RAT, false)
- if PedInRectangle(RAT, -778.45, 306.26, -760.57, 319.52) then
- for _, OFFSET in ipairs({{0, 1.5, 0}, {-1.5, 0, 0}, {1.5, 0, 0}, {0, -2.5, 0}, {0, 2.5, 0}, {-2.5, 0, 0}, {2.5, 0, 0}}) do
- BX, BY, BZ = PedGetOffsetInWorldCoords(gPlayer, unpack(OFFSET))
- PedSetPosXYZ(RAT, BX, BY, BZ + 12)
- if not PedInRectangle(RAT, -778.45, 306.26, -760.57, 319.52) then
- break
- end
- end
- end
- if PedInRectangle(RAT, -778.45, 306.26, -760.57, 319.52) then
- BX, BY, BZ = -769.54, 304.50, 76.40
- end
- PedDelete(RAT)
- PlayerLockButtonInputsExcept(7, true)
- PedMoveToXYZ(gPlayer, 0, BX, BY, BZ)
- CameraSetWidescreen(true)
- FIELD.INTERRUPT, FIELD.INTERRUPT_MAX = GetTimer() + 2000, GetTimer() + 10000
- else
- if FIELD.INTERRUPT < GetTimer() and FIELD.INTERRUPT_MAX < GetTimer() then
- PedMoveToXYZ(gPlayer, 0, -769.54, 304.50, 76.40)
- end
- end
- else
- if FIELD.INTERRUPT then
- if FIELD.INTERRUPT < GetTimer() then
- CameraSetWidescreen(false)
- PlayerLockButtonInputsExcept(false)
- FIELD.INTERRUPT, FIELD.INTERRUPT_MAX = nil, nil
- end
- end
- end
- end
- FIELD.HIT = function()
- if type(SETUP.NPC) == "table" then
- for _, CONTENT in ipairs(SETUP.NPC) do
- if PedIsValid(_G[CONTENT[1]]) and PedMePlaying(_G[CONTENT[1]], "HitTree") and PedGetWhoHitMeLast(_G[CONTENT[1]]) == gPlayer then
- return true
- end
- end
- end
- return false
- end
- AreaDisableCameraControlForTransition(false)
- Wait(250)
- CameraFade(500, 1)
- while AreaGetVisible() == 19 and not SystemShouldEndScript() do
- Wait(0)
- HOUR, MINUTE = ClockGet()
- SETUP.EVENT = (HOUR >= 12 and HOUR < 18) and true or false
- if FIELD.KICK then
- shared.storeTransition = {2, GetPointList(POINTLIST._3_01C_PLAYEREND)}
- LaunchScript("AreaScripts/StoreTransition.lua")
- break
- end
- if SETUP.EVENT then
- if not FIELD.SMOOTH_CLEANUP then
- if PedIsValid(_G.MSPETERS) then
- if IsMissionCompleated("3_01D") then
- SoundPlayStream("MS_MusicClass_Carols01.rsm", 1.2)
- else
- SoundPlayStream("MS_XmasComeRudyLow.rsm", 1.2)
- end
- if PedIsValid(_G.PETER) and PedGetHealth(_G.PETER) > 0 then
- if not PETER_TIMER then
- PETER_TIMER = GetTimer() + math.random(1000, 2500)
- end
- if PETER_TIMER < GetTimer() then
- PedSetActionNode(_G.PETER, "/Global/MGMusic/Animations/Gary/Left/Timpani/Hit", "Act/Conv/MGMusic.act")
- local X, Y, Z = PlayerGetPosXYZ()
- local PX, PY, PZ = PedGetPosXYZ(_G.PETER)
- if math.abs(X - PX) + math.abs(Y - PY) + math.abs(Z - PZ) <= 7 then
- SoundPlay2D("TIMPANI_LEFT_H")
- end
- PETER_TIMER = GetTimer() + math.random(1000, 2500)
- end
- end
- if PedIsValid(_G.CONSTANTINOS) and PedGetHealth(_G.CONSTANTINOS) > 0 then
- if not CONSTANTINOS_TIMER then
- CONSTANTINOS_TIMER = GetTimer() + math.random(700, 2500)
- end
- if CONSTANTINOS_TIMER < GetTimer() then
- local HAND = math.random(1, 2) == 1 and "Right" or "Left"
- PedSetActionNode(_G.CONSTANTINOS, "/Global/MGMusic/Animations/Jimmy/"..HAND.."/xylophone/Hit", "Act/Conv/MGMusic.act")
- CONSTANTINOS_TIMER = GetTimer() + math.random(1000, 2500)
- end
- end
- for _, S in pairs(FIELD.VIOLATION) do
- if (FIELD.HIT() or PedHasGeneratedStimulusOfType(gPlayer, S) or PedInRectangle(gPlayer, -778.45, 306.26, -760.57, 319.52)) and not FIELD.KICK then
- PedFaceXYZ(_G.MSPETERS, PlayerGetPosXYZ())
- SoundStopStream()
- PlayerSetControl(0)
- CameraSetWidescreen(true)
- local CSX, CSY, CSZ = PedGetOffsetInWorldCoords(_G.MSPETERS, 0, 2.5, 1)
- local CLX, CLY, CLZ = PedGetPosXYZ(_G.MSPETERS)
- CameraSetXYZ(CSX, CSY, CSZ, CLX, CLY, CLZ + 1)
- while PedMePlaying(_G.MSPETERS, "HitTree") do
- Wait(0)
- end
- PedSetActionNode(_G.MSPETERS, "/Global/1_08/CafeteriaLady/Point/Point", "Act/Conv/1_08.act")
- SoundStopCurrentSpeechEvent(_G.MSPETERS)
- SoundPlayScriptedSpeechEvent(_G.MSPETERS, "DONT_HIT", 0, "xtralarge", false)
- while SoundSpeechPlaying(_G.MSPETERS) do
- Wait(0)
- end
- Wait(1000)
- CameraFade(500, 0)
- Wait(501)
- FIELD.KICK = true
- break
- end
- end
- end
- if PedIsValid(_G.EARNEST) then
- SoundStopStream()
- if not shared.EARNEST_SPEECH then
- shared.EARNEST_SPEECH = 0
- end
- if not EARNEST_TIMER then
- EARNEST_TIMER = GetTimer() + 1000
- end
- if not SoundSpeechPlaying(_G.EARNEST) and not PedIsPlaying(_G.EARNEST, "/Global/DodgeballGame/Anims/DejectedD", true) and not EARNEST_SPEECH_STOP and not EARNEST_SPEECH_FAIL then
- if EARNEST_TIMER < GetTimer() then
- shared.EARNEST_SPEECH = shared.EARNEST_SPEECH + 1 > 30 and 0 or shared.EARNEST_SPEECH + 1
- if math.random(0, 10) ~= 5 then
- SoundPlayScriptedSpeechEvent(_G.EARNEST, "M_1_09", shared.EARNEST_SPEECH + 2, "xtralarge", true)
- local CONVERTED_NUMBER
- for I = 1, 9 do
- if shared.EARNEST_SPEECH == I then
- CONVERTED_NUMBER = "0"..I
- break
- end
- end
- PedSetActionNode(_G.EARNEST, "/Global/1_09/EarnestSpeech/"..(CONVERTED_NUMBER or shared.EARNEST_SPEECH), "Act/Conv/1_09.act")
- else
- if HOUR < 17 then
- EARNEST_SPEECH_FAIL = true
- end
- end
- EARNEST_TIMER = GetTimer() + (EARNEST_SPEECH_FAIL and 3000 or 1000)
- end
- end
- if EARNEST_SPEECH_FAIL then
- if EARNEST_TIMER < GetTimer() then
- PedSetActionNode(_G.EARNEST, "/Global/DodgeballGame/Anims/DejectedD", "Act/Conv/DodgeballGame.act")
- shared.EARNEST_SPEECH = 0
- EARNEST_TIMER = GetTimer() + 8000
- EARNEST_SPEECH_FAIL = false
- end
- end
- for _, S in pairs(FIELD.VIOLATION) do
- if (FIELD.HIT() or PedHasGeneratedStimulusOfType(gPlayer, S) or PedInRectangle(gPlayer, -778.45, 306.26, -760.57, 319.52)) and not FIELD.KICK then
- EARNEST_SPEECH_STOP = true
- SoundStopCurrentSpeechEvent(_G.EARNEST)
- PedFaceXYZ(_G.EARNEST, PlayerGetPosXYZ())
- SoundStopStream()
- PlayerSetControl(0)
- CameraSetWidescreen(true)
- local CSX, CSY, CSZ = PedGetOffsetInWorldCoords(_G.EARNEST, 0, 2.5, 1)
- local CLX, CLY, CLZ = PedGetPosXYZ(_G.EARNEST)
- CameraSetXYZ(CSX, CSY, CSZ, CLX, CLY, CLZ + 1)
- while PedMePlaying(_G.EARNEST, "HitTree") do
- Wait(0)
- end
- PedSetActionNode(_G.EARNEST, "/Global/1_08/CafeteriaLady/Point/Point", "Act/Conv/1_08.act")
- SoundStopCurrentSpeechEvent(_G.EARNEST)
- SoundPlayScriptedSpeechEvent(_G.EARNEST, "DONT_HIT", 0, "xtralarge", false)
- while SoundSpeechPlaying(_G.EARNEST) do
- Wait(0)
- end
- Wait(1000)
- CameraFade(500, 0)
- Wait(501)
- FIELD.KICK = true
- break
- end
- end
- end
- if not PedIsValid(_G.MSPETERS) and not PedIsValid(_G.EARNEST) then
- FIELD.BREACH()
- end
- else
- FIELD.BREACH()
- end
- else
- SoundStopStream()
- if PedIsValid(_G.MSPETERS) and not FIELD.SMOOTH_CLEANUP then
- for _, V in ipairs(SETUP.NPC) do
- if PedIsValid(_G[V[1]]) then
- PedIgnoreStimuli(_G[V[1]], false)
- PedSetStationary(_G[V[1]], false)
- if V[1] == "PETER" then
- PedSetActionNode(_G[V[1]], "/Global/MGMusic/Animations/Gary/Sticks/RemoveSticks", "Act/Conv/MGMusic.act")
- elseif V[1] == "CONSTANTINOS" then
- PedSetActionNode(_G[V[1]], "/Global/MGMusic/Animations/Jimmy/Sticks/RemoveSticks", "Act/Conv/MGMusic.act")
- end
- PedStop(_G[V[1]])
- PedSetActionNode(_G[V[1]], "/Global", "Act/Globals.act")
- PedSetAITree(_G[V[1]], "/Global/AI", "Act/AI/AI.act")
- PedMakeAmbient(_G[V[1]])
- end
- end
- SoundPlayScriptedSpeechEvent(_G.MSPETERS, IsMissionCompleated("3_01D") and "CONGRATULATIONS" or "SEE_SOMETHING_CRAP", 0, "xtralarge", true)
- FIELD.CLEANUP_TIMER = GetTimer() + math.random(5000, 10000)
- FIELD.SMOOTH_CLEANUP = true
- end
- if PedIsValid(_G.EARNEST) and not FIELD.SMOOTH_CLEANUP then
- for _, V in ipairs(SETUP.NPC) do
- if PedIsValid(_G[V[1]]) then
- PedIgnoreStimuli(_G[V[1]], false)
- PedIgnoreAttacks(_G[V[1]], false)
- PedSetMinHealth(_G[V[1]], 0)
- if V[1] == "EARNEST" then
- SoundStopCurrentSpeechEvent(_G[V[1]])
- PedSetFlag(_G[V[1]], 13, false)
- PedSetActionNode(_G[V[1]], "/Global", "Act/Globals.act")
- else
- PedSetActionNode(_G[V[1]], "/Global/1_09/CustomPedTree/Break", "Act/Conv/1_09.act")
- local PFX, PFY, PFZ = PedGetOffsetInWorldCoords(_G[V[1]], 0, 1, 0)
- PedMoveToXYZ(_G[V[1]], 0, PFX, PFY, PFZ)
- end
- PedMakeAmbient(_G[V[1]])
- end
- end
- SoundPlayScriptedSpeechEvent(_G.EARNEST, "M_1_09", 36, "xtralarge", true)
- FIELD.CLEANUP_TIMER = GetTimer() + math.random(4000, 7000)
- FIELD.SMOOTH_CLEANUP = true
- end
- if FIELD.SMOOTH_CLEANUP then
- if FIELD.CLEANUP_TIMER then
- if FIELD.CLEANUP_TIMER < GetTimer() then
- for _, V in ipairs(SETUP.NPC) do
- if PedIsValid(_G[V[1]]) and PedGetHealth(_G[V[1]]) > 0 then
- PedMoveToXYZ(_G[V[1]], math.random(1, 3) == 2 and 1 or 0, -777.85, 288.00, 77.95)
- end
- end
- FIELD.CLEANUP_TIMER = nil
- end
- else
- for _, V in ipairs(SETUP.NPC) do
- if PedIsValid(_G[V[1]]) and PedIsInAreaXYZ(_G[V[1]], -777.85, 288.00, 77.95, 1.5) then
- PedDelete(_G[V[1]])
- end
- end
- end
- end
- FIELD.BREACH()
- end
- end
- if SETUP.PROP then
- if ChapterGet() == 2 and not IsMissionCompleated("3_01C") then
- AreaLoadSpecialEntities("nutcracker", false)
- AreaEnsureSpecialEntitiesAreCreated()
- elseif IsMissionCompleated("1_03") and not IsMissionCompleated("1_09") then
- AreaLoadSpecialEntities("vote", false)
- AreaEnsureSpecialEntitiesAreCreated()
- end
- SETUP.PROP = false
- end
- if SETUP.FLAG then
- DATUnload(2)
- if type(SETUP.NPC) == "table" then
- for _, V in ipairs(SETUP.NPC) do
- if PedIsValid(_G[V[1]]) then
- PedDelete(_G[V[1]])
- end
- end
- if ChapterGet() == 2 and not IsMissionCompleated("3_01C") then
- SoundUnLoadBank("MINIGAME\\TIMPANI_01.bnk")
- end
- SoundStopStream()
- if FIELD.KICK then
- PlayerSetControl(1)
- EARNEST_SPEECH_STOP = false
- FIELD.KICK = false
- end
- for _, V in ipairs(SETUP.ANIM) do
- if HasAnimGroupLoaded(V) then
- UnLoadAnimationGroup(V)
- end
- end
- SETUP.NPC = nil
- SETUP.ANIM = nil
- end
- FIELD.SMOOTH_CLEANUP = false
- SETUP.FLAG = false
- end
- DATUnload(0)
- shared.gAreaDataLoaded = false
- shared.gAreaDATFileLoaded[19] = false
- SETUP = nil
- FIELD = nil
- collectgarbage()
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement