Page 1 of 1

How do you end the mod?

Posted: Tue Oct 23, 2012 11:20 am
by Jaymann
Is there a simple way to roll the credits when you reach the end of the mod?

Thanks!

Re: How do you end the mod?

Posted: Tue Oct 23, 2012 11:24 am
by Grimwold
just call the completeGame() function

e.g.

Code: Select all

completeGame("mod_assets/cinematics/ending.lua")
Then create a script file called ending.lua in the same manner as intro.lua


This actually means you can have multiple endings.

Re: How do you end the mod?

Posted: Tue Oct 23, 2012 11:38 am
by Jaymann
Grimwold wrote:just call the completeGame() function

e.g.

Code: Select all

completeGame("mod_assets/cinematics/ending.lua")
Then create a script file called ending.lua in the same manner as intro.lua


This actually means you can have multiple endings.
That makes sense, but how do you create such a script file? I don't see intro.lua anywhere in the mod_assets.

Re: How do you end the mod?

Posted: Tue Oct 23, 2012 11:44 am
by Grimwold
Have a look at this thread, it has some good discussion on cinematics.
viewtopic.php?f=14&t=3377

There's also a page in the modding documentation about cinematics:
http://www.grimrock.net/modding/how-to- ... inematics/


As far as creating the file goes... you can create it in your favourite text editor, as long as you make sure you change the extension to .lua and not .txt

Re: How do you end the mod?

Posted: Tue Oct 23, 2012 9:32 pm
by Jaymann
Grimwold wrote:Have a look at this thread, it has some good discussion on cinematics.
viewtopic.php?f=14&t=3377

There's also a page in the modding documentation about cinematics:
http://www.grimrock.net/modding/how-to- ... inematics/


As far as creating the file goes... you can create it in your favourite text editor, as long as you make sure you change the extension to .lua and not .txt
OK, none of these scripts are working (error messages crash game), and I do not see the original files on my PC (is this because I downloaded from steam??).

Here is the file structure i have:

Documents\Almost Human\Legend of Grimrock\Dungeons\Test 03\mod_assets\

animations\(empty)
cinematics\(empty)
models\(empty)
scripts\dungeon.lua
scripts\init.lua
scripts\items.lua
scripts\materials.lua
scripts\monsters.lua
scripts\objects.lua
sdripts\recipies.lua
scripts\sounds.lua
scripts\spells.lua
scripts\wall_sets.lua
sounds\(empty)
textures\(empty)

Can someone please tell me exactly what goes where? Thanks!

Re: How do you end the mod?

Posted: Tue Oct 23, 2012 9:47 pm
by Phitt
By default the cinematics folder is empty, that's completely normal. Like Grimwold already said, you can use any text editor (even the default windows notepad) to create an ending.lua or intro.lua. Just change the extension from txt to lua. Put the lua(s) you created in the cinematics folder and you're good to go. Best is if you start small if you've never scripted before, otherwise you'll have tons of errors and never find out why it doesn't work.

Re: How do you end the mod?

Posted: Tue Oct 23, 2012 10:06 pm
by Jaymann
Phitt wrote:By default the cinematics folder is empty, that's completely normal. Like Grimwold already said, you can use any text editor (even the default windows notepad) to create an ending.lua or intro.lua. Just change the extension from txt to lua. Put the lua(s) you created in the cinematics folder and you're good to go. Best is if you start small if you've never scripted before, otherwise you'll have tons of errors and never find out why it doesn't work.
I am with you so far, and I agree start simple. But what text goes in the ending.lua (or intro) I am creating?

Re: How do you end the mod?

Posted: Wed Oct 24, 2012 12:07 am
by Jaymann
This is hilarious, I got the credits to roll, but as soon as I enter the mod LOL! How do I get the script_entity to not kick in until I hit the pressure plate connector?

Re: How do you end the mod?

Posted: Wed Oct 24, 2012 12:17 am
by Grimwold
I should have been more detailed when I explained about using completeGame()

Try adding something like this in a script entity:

Code: Select all

function endGame()
  completeGame("mod_assets/cinematics/myending.lua")
end
without the function part, the completeGame() will just fire as soon as the dungeon is loaded, which I guess is what you are seeing happen.

Now it won't complete the game until the function is called. To do this, add a connector from your pressure plate to the script entity, with the action endGame... now when you step on the plate it will run all code in the function endGame() and activate the completeGame command.

Re: How do you end the mod?

Posted: Wed Oct 24, 2012 12:34 am
by Jaymann
That did the trick. Nothing custom yet, but at least you know the game is over.

You are a gentleman and a scholar!