Page 1 of 2
Editing core aspects of the game
Posted: Tue Nov 20, 2012 5:30 pm
by RegisCastus
Hey everyone, I posted this question in the steam forums and someone pointed me here for more information:
Is it possible to do something like fully removing resting, or at least editing how the rest system works? Or reducing the player party from 4 characters to 1? Haven't seen any way to do anything like this in the editor and I haven't found been able to find anything online stating if you can. Figured maybe someone more experienced in the editor might know around here. Thanks for any information you can give!
As I stated above, I'm looking to (mostly) remove the resting system, the 4 man party system and maybe the hunger system. I'm pretty poor at coding, so I'm wondering if anyone here has made some code that fixes those issues I'm having. Thank you for any help you can provide.
Re: Editing core aspects of the game
Posted: Tue Nov 20, 2012 5:40 pm
by montagneyaya
You can use hook party onRest or method party:isResting() like this
Code: Select all
if party:isResting then
party:wakeUp(true)
end
and Champion:setEnabled(enabled) method for change the number of champion
You can find all method and hook here :
http://www.grimrock.net/modding/scripting-reference/
http://www.grimrock.net/modding/asset-d ... reference/
Re: Editing core aspects of the game
Posted: Tue Nov 20, 2012 6:19 pm
by RegisCastus
montagneyaya wrote:You can use hook party onRest or method party:isResting() like this
Code: Select all
if party:isResting then
party:wakeUp(true)
end
and Champion:setEnabled(enabled) method for change the number of champion
I tried flat out copy pasting them into an LUA file and uh, well as I said I'm pretty terrible at coding, and I really can't grasp...anything really in those reference lists. Is there an opener that I need to put in the LUA, like you would in a C++ file? Sorry for my flat out ignorance of programming, but it's something I never had the patience for.
Re: Editing core aspects of the game
Posted: Tue Nov 20, 2012 6:23 pm
by Grimwold
For the food system, you could have a function that runs regularly to add an amount to all champions food bar.. thus negating the need to eat. (you could even add this to the party onMove hook, so every time the party moved, their food bar would be increased)
Code: Select all
function addFood()
for i = 1,4 do
party:getChampion(i):modifyFood(200)
end
end
As montagneyaya has already said you can disable champions at the start of the dungeon.
You could use scripts to prevent the party from resting, but using the onRest hook in the party definition is probably the best way to do it. you'd need to edit the init.lua file in your dungeon folder and add something like
Code: Select all
cloneObject{
name = "party",
baseObject = "party",
onRest = function()
return false
end,
}
Here the "return false" part of the onRest hook will prevent the party from ever being able to rest.
Re: Editing core aspects of the game
Posted: Tue Nov 20, 2012 6:27 pm
by Grimwold
Try copy/pasting the following into your
init.lua file (found in "documents/Almost Human/Legend of Grimrock/Dungeons/NAME OF YOUR DUNGEON/mod_assets/scripts" folder_
Code: Select all
cloneObject{
name = "party",
baseObject = "party",
onRest = function()
return false
end,
onMove = function()
for i = 1,4 do
party:getChampion(i):modifyFood(200)
end
end,
}
Re: Editing core aspects of the game
Posted: Tue Nov 20, 2012 6:31 pm
by RegisCastus
Grimwold wrote:Try copy/pasting the following into your
init.lua file (found in "documents/Almost Human/Legend of Grimrock/Dungeons/NAME OF YOUR DUNGEON/mod_assets/scripts" folder_
Code: Select all
cloneObject{
name = "party",
baseObject = "party",
onRest = function()
return false
end,
onMove = function()
for i = 1,4 do
party:getChampion(i):modifyFood(200)
end
end,
}
Did that, and it worked. Thanks for clarifying where it was meant to go.
Re: Editing core aspects of the game
Posted: Tue Nov 20, 2012 6:32 pm
by mahric
On my computer recovering from a rest crashes the level, unless I add the onWakeUp() function in there too.
EDIT: if you make the onRest() return true.
Code: Select all
onWakeUp = function()
return true
end,
Is that a fluke in my level, or a known issue?
Re: Editing core aspects of the game
Posted: Tue Nov 20, 2012 6:34 pm
by Grimwold
RegisCastus wrote:Grimwold wrote:Try copy/pasting the following into your
init.lua file (found in "documents/Almost Human/Legend of Grimrock/Dungeons/NAME OF YOUR DUNGEON/mod_assets/scripts" folder_
Code: Select all
cloneObject{
name = "party",
baseObject = "party",
onRest = function()
return false
end,
onMove = function()
for i = 1,4 do
party:getChampion(i):modifyFood(200)
end
end,
}
Did that, and it worked. Thanks for clarifying where it was meant to go.
Glad it worked.
To disable champions... place a script entity in your dungeon and paste in the following
Code: Select all
party:getChampion(1):setEnabled(false)
That will disable the champion in the top left slot as soon as the dungeon starts. To disable more champions, simply add additional lines and change the 1 to 2,3, or 4. to disable the other champions.
Re: Editing core aspects of the game
Posted: Tue Nov 20, 2012 6:37 pm
by Grimwold
mahric wrote:On my computer recovering from a rest crashes the level, unless I add the onWakeUp() function in there too.
EDIT: if you make the onRest() return true.
Code: Select all
onWakeUp = function()
return true
end,
Is that a fluke in my level, or a known issue?
It's not you.. I just did it in a test dungeon and it seems that if the onRest hook is used AND returns true, then you do also need to add the onWakeUp hook as well it seems. in the case of the OP we are using return false for onRest, so onWakeUp is not needed.
Re: Editing core aspects of the game
Posted: Tue Nov 20, 2012 6:39 pm
by RegisCastus
Grimwold wrote:RegisCastus wrote:Grimwold wrote:Try copy/pasting the following into your
init.lua file (found in "documents/Almost Human/Legend of Grimrock/Dungeons/NAME OF YOUR DUNGEON/mod_assets/scripts" folder_
Code: Select all
cloneObject{
name = "party",
baseObject = "party",
onRest = function()
return false
end,
onMove = function()
for i = 1,4 do
party:getChampion(i):modifyFood(200)
end
end,
}
Did that, and it worked. Thanks for clarifying where it was meant to go.
Glad it worked.
To disable champions... place a script entity in your dungeon and paste in the following
Code: Select all
party:getChampion(1):setEnabled(false)
That will disable the champion in the top left slot as soon as the dungeon starts. To disable more champions, simply add additional lines and change the 1 to 2,3, or 4. to disable the other champions.
Got that working too. I find it weird that some things get coded in the editor while others get coded out of it

But whatever works I guess.