Beacon essence script
Beacon essence script
Could someone tell me how to make the air beacon only accept the air essence. Thanks Ian
- Duncan1246
- Posts: 404
- Joined: Mon Jan 19, 2015 7:42 pm
Re: Beacon essence script
Hi Ian,ian363 wrote:Could someone tell me how to make the air beacon only accept the air essence. Thanks Ian
Edit "beacon_air" and modify it like this:
Code: Select all
`defineObject{
name = "beacon__only_air",
baseObject = "base_obstacle",
components = {
{
class = "Model",
model = "assets/models/env/elemental_holder_air.fbx",
staticShadow = true,
},
{
class = "Light",
offset = vec(0, 1.2, -1.1),
range = 6,
color = vec(0.4, 0.5, 1),
brightness = 8,
castShadow = false,
staticShadows = false,
fadeOut = 0,
onUpdate = function(self)
local socket = self.go.socket
if socket:count() > 0 then
local it = socket:getItem()
if it.go.name == "essence_air" then
it.go:setWorldPositionY(0.85 + math.sin(Time.currentTime()) * 0.05)
--elseif it:hasTrait("essence") then -----------HERE: this is not any more useful
-- it.go:setWorldPositionY(0.75)
end
end
end,
},
{
class = "Sound",
sound = "essence_ambient",
fadeOut = 0,
},
{
class = "Clickable",
offset = vec(0.0, 1.1, -1.1),
size = vec(0.6, 0.6, 0.1),
maxDistance = 1,
frontFacing = true,
--debugDraw = true,
},
{
class = "Socket",
offset = vec(0, 0.85, -1.1),
onAcceptItem = function(self, item)
return (item.go.name == "essence_air") and self:count() == 0 ---HERE:this limits beacon to "essence_air"
end,
onInsertItem = function(self, item)
if item.go.name == "essence_air" then
self.go.light:fadeIn(1)
self.go.sound:fadeIn(1)
end
end,
onRemoveItem = function(self, item)
if item.go.name == "essence_air" then
self.go.light:fadeOut(1)
self.go.sound:fadeOut(1)
end
end,
--debugDraw = true,
},
},
--placement = "wall",
--editorIcon = 88,
}The Blue Monastery (LOG1)
download at:http://www.nexusmods.com/grimrock/mods/399/?
Finisterrae(LOG2)
download at:http://www.nexusmods.com/legendofgrimrock2/mods/61/?
download at:http://www.nexusmods.com/grimrock/mods/399/?
Finisterrae(LOG2)
download at:http://www.nexusmods.com/legendofgrimrock2/mods/61/?
Re: Beacon essence script
Thank you for the info but this is a bit beyond me. I don't know how to edit an item and I'm not sure what I would need to alter for the earth, fire and water beacons to work. I was hoping it would be simple. I wonder why they made it work this way, I would have the beacon only react to the right essence in the first place. Thanks once again Ian
Re: Beacon essence script
It DOES only react to the right essence in the first place. If the wrong essence is placed in the socket then it won't bob up and down.
And it is simple, but you need to know at least a little bit of programming and Lua to do anything significant in Grimrock mods.
And it is simple, but you need to know at least a little bit of programming and Lua to do anything significant in Grimrock mods.
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.
Grimrock 2 resources
I no longer answer scripting questions in private messages. Please ask in a forum topic or this Discord server.
Re: Beacon essence script
You are correct that the essence needs to be correct to visually light the beacon but any essence will trigger the 'connector', say open a door. This means you only need one essence to make all beacons work. In the original game all four beacons had to be active to open the castle door but I'm using them individually to do something.minmay wrote:It DOES only react to the right essence in the first place. If the wrong essence is placed in the socket then it won't bob up and down.
And it is simple, but you need to know at least a little bit of programming and Lua to do anything significant in Grimrock mods.
Re: Beacon essence script
So? Just connect the connector to a script_entity and check for the specific essence there.ian363 wrote:You are correct that the essence needs to be correct to visually light the beacon but any essence will trigger the 'connector', say open a door. This means you only need one essence to make all beacons work. In the original game all four beacons had to be active to open the castle door but I'm using them individually to do something.minmay wrote:It DOES only react to the right essence in the first place. If the wrong essence is placed in the socket then it won't bob up and down.
And it is simple, but you need to know at least a little bit of programming and Lua to do anything significant in Grimrock mods.
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.
Grimrock 2 resources
I no longer answer scripting questions in private messages. Please ask in a forum topic or this Discord server.
Re: Beacon essence script
Yes, that was the whole point of the thread in the first place but I don't know much about scripts and I'm not sure how to edit the script I was given earlier. Also it doesn't change the fact that it would be a lot simpler if the beacon only reacted to the right essence.minmay wrote:So? Just connect the connector to a script_entity and check for the specific essence there.ian363 wrote:You are correct that the essence needs to be correct to visually light the beacon but any essence will trigger the 'connector', say open a door. This means you only need one essence to make all beacons work. In the original game all four beacons had to be active to open the castle door but I'm using them individually to do something.minmay wrote:It DOES only react to the right essence in the first place. If the wrong essence is placed in the socket then it won't bob up and down.
And it is simple, but you need to know at least a little bit of programming and Lua to do anything significant in Grimrock mods.
I understand (from other replies) you find my approach odd but not everyone knows how to write scripts and it would be simpler if they were needed as little as possible (alcove drop down menu). Anyway I have decided to be stubborn and not use scripts at all. My game is nearly complete and I'll let others decided if you can get away with not using scripts.
- Duncan1246
- Posts: 404
- Joined: Mon Jan 19, 2015 7:42 pm
Re: Beacon essence script
If you want to do that, it's very easy:ian363 wrote:Thank you for the info but this is a bit beyond me. I don't know how to edit an item and I'm not sure what I would need to alter for the earth, fire and water beacons to work. I was hoping it would be simple. I wonder why they made it work this way, I would have the beacon only react to the right essence in the first place. Thanks once again Ian
- In your mod folder, open the file objects.lua in mod_assets with a text editor (EditPad Lite, by exemple, it's free)
Copy the code in my previous mail and paste it in objects.lua
Save the file, reload your mod: the new object "beacon_only_air" will appear in the editor object window
Use it instead of "beacon_air" when you needs it, that's all
The Blue Monastery (LOG1)
download at:http://www.nexusmods.com/grimrock/mods/399/?
Finisterrae(LOG2)
download at:http://www.nexusmods.com/legendofgrimrock2/mods/61/?
download at:http://www.nexusmods.com/grimrock/mods/399/?
Finisterrae(LOG2)
download at:http://www.nexusmods.com/legendofgrimrock2/mods/61/?
Re: Beacon essence script
Thanks I'll give it a go for a future game but I've decided to be stubborn and use no scripts this time. I think I've become obsessed with making things work without them, yes madness. Thanks again Ian.Duncan1246 wrote:If you want to do that, it's very easy:ian363 wrote:Thank you for the info but this is a bit beyond me. I don't know how to edit an item and I'm not sure what I would need to alter for the earth, fire and water beacons to work. I was hoping it would be simple. I wonder why they made it work this way, I would have the beacon only react to the right essence in the first place. Thanks once again IanThe solution of an external script is also possible, as Minmay says, but it's also programming...
- In your mod folder, open the file objects.lua in mod_assets with a text editor (EditPad Lite, by exemple, it's free)
Copy the code in my previous mail and paste it in objects.lua
Save the file, reload your mod: the new object "beacon_only_air" will appear in the editor object window
Use it instead of "beacon_air" when you needs it, that's all
Re: Beacon essence script
There is a great many things that you can accomplish without knowing any LUA and implementing virtually zero script. Creativity goes a long way, but you also have to make sure to design the game around features that support your anti-script approach. If you want to trigger an event based on an objects unique and specific contents, then you have entered the world of scripting.
Maybe a better approach is to work with someone to write the scripts for you!
Maybe a better approach is to work with someone to write the scripts for you!