Hey all,
Quick question: Are there any hooks we can use for scripting, when the party first enters the game. And, are there any hooks when the party enters or leaves a dungeon level?
Otherwise i would have to place a invisible pressure plate on the parties starting/entering location.
why? scripting once-per-dungeon / once-per-level stuff
thanks for any help!
Enter/Leave Game/Level Hook
Enter/Leave Game/Level Hook
--
Fhizban's Asset Repository - the place where you find all my LoG contributions:
viewtopic.php?f=14&t=3904
Fhizban's Asset Repository - the place where you find all my LoG contributions:
viewtopic.php?f=14&t=3904
Re: Enter/Leave Game/Level Hook
Any script code outside of a function will run when you enter the dungeon, at least.
Re: Enter/Leave Game/Level Hook
For the start of dungeon I would go with the pressure plate route (actually, I'm going with that route, as I have this requirement in my mod).
For the start/end of level you have many options:
For the start/end of level you have many options:
- Pressure plates at the end of the stairs and end of teleports - this might be easy or hard depending on your dungeon
- A timer on any level, checking if the party.level is the same as a level never entered and taking actions - this is ok if you don't require your script to execute exactly as the party enters the level (it will execute some seconds after)
- An hook to party.onMove and the same check as above.
Waking Violet (Steam, PS4, PSVita, Switch) : http://www.wakingviolet.com
The Sunset Gate [MOD]: viewtopic.php?f=14&t=5563
My preciousss: http://www.moonsharp.org
The Sunset Gate [MOD]: viewtopic.php?f=14&t=5563
My preciousss: http://www.moonsharp.org
Re: Enter/Leave Game/Level Hook
I also do this for start of game scripting...Decayer wrote:Any script code outside of a function will run when you enter the dungeon, at least.
e.g. I have a script entity called default_party that just includes the following.
Code: Select all
-- add custom party-scripts here
for champID = 1,4 do
party:getChampion(champID):addSkillPoints(10)
party:getChampion(champID):insertItem(11,spawn("pitroot_bread"))
party:getChampion(champID):insertItem(2,spawn("peasant_tunic"))
party:getChampion(champID):insertItem(3,spawn("peasant_breeches"))
party:getChampion(champID):insertItem(4,spawn("sandals"))
if champID < 3 then
party:getChampion(champID):insertItem(7,spawn("knife"))
end
end
local startArrow = spawn("arrow")
party:getChampion(3):insertItem(8, startArrow)
startArrow:setStackSize(5)
party:getChampion(3):insertItem(7, spawn("short_bow"))
party:getChampion(2):setPortrait("mod_assets/portraits/dwarvenWarrior.tga")
party:getChampion(1):setPortrait("mod_assets/portraits/paladin.tga")
party:getChampion(3):setPortrait("mod_assets/portraits/prodigalSorcerer.tga")
party:getChampion(4):setPortrait("mod_assets/portraits/quirion.tga")
Otherwise I'd use hidden pressure plates as the only downside is that the party have to enter the level via specific locations to activate the hidden pressure plate.
Puzzle Frameworks - http://www.grimrock.net/forum/viewtopic.php?f=14&t=4564
Magic Pack - https://www.nexusmods.com/grimrock/mods/70
Area of Effect Spell System - http://www.grimrock.net/forum/viewtopic ... 150#p44382
Magic Pack - https://www.nexusmods.com/grimrock/mods/70
Area of Effect Spell System - http://www.grimrock.net/forum/viewtopic ... 150#p44382
Re: Enter/Leave Game/Level Hook
thank you all. thats good to know.
okay, a script entity especially for entering the game and pressure plates at the entrance points of dungeon levels, thats how to do it.
okay, a script entity especially for entering the game and pressure plates at the entrance points of dungeon levels, thats how to do it.
--
Fhizban's Asset Repository - the place where you find all my LoG contributions:
viewtopic.php?f=14&t=3904
Fhizban's Asset Repository - the place where you find all my LoG contributions:
viewtopic.php?f=14&t=3904
Re: Enter/Leave Game/Level Hook
The pressure plate route can be hard for some dungeons. Think of pits, cross level teleports, etc. 

Waking Violet (Steam, PS4, PSVita, Switch) : http://www.wakingviolet.com
The Sunset Gate [MOD]: viewtopic.php?f=14&t=5563
My preciousss: http://www.moonsharp.org
The Sunset Gate [MOD]: viewtopic.php?f=14&t=5563
My preciousss: http://www.moonsharp.org
Re: Enter/Leave Game/Level Hook
@Xanathar arrrgggh, yes you are right - so much stuff to think about!
how about this: another script entity that runs automatically with an if-then structure that checks the current dungeon level first?
how about this: another script entity that runs automatically with an if-then structure that checks the current dungeon level first?
Code: Select all
if party.level == 1 then
if var_init == false then
--do dungeon level 1 init stuff
var_init = true
end
end
--
Fhizban's Asset Repository - the place where you find all my LoG contributions:
viewtopic.php?f=14&t=3904
Fhizban's Asset Repository - the place where you find all my LoG contributions:
viewtopic.php?f=14&t=3904