I didn't want to make own tread for this so I renamed the thread and post it in here.
Autotrigger-script
This entity is a combination of floortrigger and script entity, and it will automatically execute its own execute-method when the floortrigger is activated.
Just add this to your init.lua
Code: Select all
defineObject{
name = 'script_autotrigger',
baseObject = 'script_entity',
components = {
{
class = 'FloorTrigger'
},
{
class = "Script",
source = [[
function execute(trigger)
-- your code here
end
self.go.floortrigger:addConnector('onActivate',self.go.id,'execute')
]]
}
}
}
then place script_autotrigger entity to your dungeon and type your code inside of its execute method (in editor, don't modify the definition)
This just saves a lots of time since you don't have to add connectors and script entities manually. And this same trick can be used with anything basically, for example buttons, levers or torch_holders.
(I got this idea from Xanathar's GrimQ library for LoG1, sorry for copying your ideas if you happen to read this

. I loved those autoexec-scripts)