Completing a Mod - Cinematics/Ending [Solved]

Ask for help about creating mods and scripts for Grimrock 2 or share your tips, scripts, tools and assets with other modders here. Warning: forum contains spoilers!
Post Reply
Slayer82
Posts: 303
Joined: Thu Feb 05, 2015 10:19 am

Completing a Mod - Cinematics/Ending [Solved]

Post by Slayer82 »

I require some assistance in getting the proper ending to complete my mod.
I am using an unlocked portal to instigate the cinematic sequence to complete the game. It works, as it should, except I do not wish to have the default LoG2 ending.

I have created more simple epilogue scroll for the game's end, but cannot get it to function.

I have also converted it to an .ivf file and tested in-game using the GameMode.playVideo(filename) function and it does work (once exported).
In addition, I have added the correct pathname using the GameMode.completeGame(filename) function. The path mod_assets/cinematics/"myexampleofanending".ivf is correct too.
Looking at the portal.lua file, I can see where it looks to commence the ending sequence, but I cannot get it to work.

Once this is solved I will be able to complete testing and finally release it.

Hopefully, this is the last time I will need to bother people here by asking for help.
Last edited by Slayer82 on Thu Apr 02, 2015 6:16 am, edited 1 time in total.
Mods - Isle of the Deranged & The Allure of Nightfall
http://grimrock.net/forum/viewtopic.php?f=23&t=9513
viewtopic.php?f=23&t=14762
User avatar
Isaac
Posts: 3192
Joined: Fri Mar 02, 2012 10:02 pm

Re: Completing a Mod - Cinematics/Ending

Post by Isaac »

Slayer82 wrote:The path mod_assets/cinematics/"myexampleofanending".ivf
Is this a forum typo (as I expect), or a copy/paste from the script?

Could you paste the actual script you are using?

I just tried this myself:

Code: Select all

function complete()
GameMode.completeGame("mod_assets/video/custom.ivf")
end
... and it works when called.

(But it would work whatever the path; so long as it exists within the mod_assets folder; or subfolders)
Slayer82
Posts: 303
Joined: Thu Feb 05, 2015 10:19 am

Re: Completing a Mod - Cinematics/Ending

Post by Slayer82 »

What I typed before was just an example.
Here is the script I'm using
SpoilerShow
function ending()
GameMode.completeGame("mod_assets/cinematics/creditsending.ivf")
end
Both the name of the .ivf file and the path are correct. Do you know what the issue is?
Mods - Isle of the Deranged & The Allure of Nightfall
http://grimrock.net/forum/viewtopic.php?f=23&t=9513
viewtopic.php?f=23&t=14762
User avatar
Isaac
Posts: 3192
Joined: Fri Mar 02, 2012 10:02 pm

Re: Completing a Mod - Cinematics/Ending

Post by Isaac »

The portal has a portal component with an 'onArrival' hook present. This hook plays the end-game video.

Either change the onArrival hook function to play your own video instead, or you can disable the portal component in the editor, but then you won't get the fade to white effect, done automatically. Good if your video starts out solid black.
Slayer82
Posts: 303
Joined: Thu Feb 05, 2015 10:19 am

Re: Completing a Mod - Cinematics/Ending

Post by Slayer82 »

Thank you for taking the time to assist me.
However, I am confused as to how the onArrival hook function works. If I uncheck the portal component on the portal object, then the players walk through it as it is not engaged. Therefore, there is no ending.
If it is checked, then the players will walk through triggering the default ending.
How will the game read my script_entity if there is nothing to trigger it?
It makes sense what you are saying, I'm just finding it difficult to comprehend.

Is there a need to edit the objects/portal.lua file?

It must be frustrating trying to convey a simple concept, but I do put in a lot of hours before asking for help.
Cheers.
Mods - Isle of the Deranged & The Allure of Nightfall
http://grimrock.net/forum/viewtopic.php?f=23&t=9513
viewtopic.php?f=23&t=14762
minmay
Posts: 2790
Joined: Mon Sep 23, 2013 2:24 am

Re: Completing a Mod - Cinematics/Ending

Post by minmay »

PortalComponent has an onArrival field which is a function executed when the party passes through the PortalComponent. Look at objects/portal.lua and define a new version of whichever portal you want, with an onArrival hook that plays the video you want.
Grimrock 1 dungeon
Grimrock 2 resources
I no longer answer scripting questions in private messages. Please ask in a forum topic or this Discord server.
User avatar
Isaac
Posts: 3192
Joined: Fri Mar 02, 2012 10:02 pm

Re: Completing a Mod - Cinematics/Ending

Post by Isaac »

minmay wrote:Look at objects/portal.lua and define a new version of whichever portal you want, with an onArrival hook that plays the video you want.
This is also what I would recommend. However, it is certainly possible to place a floor trigger on the spot past the portal, and use that to trigger the script instead. You'll lose the automatic portal fade effect though.

Alternatively, you could redefine the portal component at runtime:

Code: Select all

portal_1:createComponent("Portal")
		:addConnector("onArrival", self.go.id, "arrivalHook");

function arrivalHook()
	GameMode.completeGame("mod_assets/cinematics/creditsending.ivf")
end
Slayer82
Posts: 303
Joined: Thu Feb 05, 2015 10:19 am

Re: Completing a Mod - Cinematics/Ending

Post by Slayer82 »

Excellent! Thanks for the help.
Finally, after more than four months I have completed my mod!

If it weren't for people like you assisting and pointing others in the right direction, then I'm sure many mods would still be incomplete.

Thanks, again.
Mods - Isle of the Deranged & The Allure of Nightfall
http://grimrock.net/forum/viewtopic.php?f=23&t=9513
viewtopic.php?f=23&t=14762
Post Reply