I only have Daemon Eyes for you!
Re: I only have Daemon Eyes for you!
In my theory this could be something like: onPickuUp destroy picked item and place new (same as before) item into slot.
Huder's Assets newest: Wooden Shield
Re: I only have Daemon Eyes for you!
Ok,
so using the onPickUpItem hook, destroy the item and then replace it into the eye socket
I may well be able to improvise on some other script I have used to destroy objects and replace them somewhere..
Let me play and I will get back to you....
Thanks again
so using the onPickUpItem hook, destroy the item and then replace it into the eye socket
I may well be able to improvise on some other script I have used to destroy objects and replace them somewhere..
Let me play and I will get back to you....
Thanks again

Labyrinth of Lies (viewtopic.php?f=14&t=4400)
Legacy of Lies (viewtopic.php?f=22&t=12983&hilit=+legacy)
Legacy of Lies (viewtopic.php?f=22&t=12983&hilit=+legacy)
Re: I only have Daemon Eyes for you!
If you use the OnPickupItem hook, you can use "return false" to actually prevent the item being picked up.Huder wrote:In my theory this could be something like: onPickuUp destroy picked item and place new (same as before) item into slot.
So if you know exactly which gem is being picked up you can 'test' it's id and return false if it is your gem.
e.g.
Code: Select all
if item.id == "blue_gem_fake" then
return false
else
return true
end
e.g.
Code: Select all
function switchGems()
blue_gem_original:destroy()
daemon_eye_socket_left:addItem(spawn("blue_gem",nil,nil,nil,nil,"blue_gem_fake"))
end
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: I only have Daemon Eyes for you!
Thanks guys! No joy yet but I think I am very close.... this is what I have done so far:
1.Cloned a blue gem fake into items.lua
2.Defined a new left eye socket into objects.lua, using the onPickUpItem hook (this might be where I am not correct....)
3. Connected the new left eye socket hold > script that runs this:
Now, when blue gem is inserted, it is destroyed and replaced with blue gem fake (seamlessly). However, I can still pick up the blue gem fake from the eye socket.... Have I fumbled up the onPickUpItem hook??
Thank you all again for your help
1.Cloned a blue gem fake into items.lua
2.Defined a new left eye socket into objects.lua, using the onPickUpItem hook (this might be where I am not correct....)
SpoilerShow
Code: Select all
defineObject{
name = "daemon_eye_left_hold",
class = "Alcove",
anchorPos = vec(0.21, 1.58, -0.45),
targetPos = vec(0.2, 1.65, -0.45),
targetSize = vec(0.1, 0.1, 0.1),
placement = "wall",
onInsertItem = function(self, item)
return item.name == "blue_gem" and self:getItemCount() == 0
end,
onPickUpItem = function(self, item)
if item.name == "blue_gem_fake" then
return false
else
return true
end
end,
editorIcon = 92,
SpoilerShow
Code: Select all
function gemCheckBlue()
local itemFound = nil
for i in daemon_eye_left_hold_1:containedItems() do
if i .name == "blue_gem" then
itemFound = i.id
end
end
if itemFound ~= nil then
gem = findEntity(itemFound)
gem:destroy()
daemon_eye_left_hold_1:addItem(spawn("blue_gem_fake", nil, nil, nil, nil))
end
end
Thank you all again for your help

Labyrinth of Lies (viewtopic.php?f=14&t=4400)
Legacy of Lies (viewtopic.php?f=22&t=12983&hilit=+legacy)
Legacy of Lies (viewtopic.php?f=22&t=12983&hilit=+legacy)
Re: I only have Daemon Eyes for you!
I have also tried connecting the eye socket to a script running this code:
But I can still take the fake blue gem out of the socket... 
---sorry spacing is messy^^ but it is correct in editor
SpoilerShow
Code: Select all
function fakeBlueGem()
onPickUpItem = function(self, item)
if item.name == "blue_gem_fake" then
return false
else
return true
end
end,

---sorry spacing is messy^^ but it is correct in editor
Labyrinth of Lies (viewtopic.php?f=14&t=4400)
Legacy of Lies (viewtopic.php?f=22&t=12983&hilit=+legacy)
Legacy of Lies (viewtopic.php?f=22&t=12983&hilit=+legacy)
Re: I only have Daemon Eyes for you!
Is it just me or do the eye sockets need to be scripted, I can't add any connectors to the deamon_head_eye_slots.
Edit : Dumb question... I forgot to add eye_socket L or R never mind, however it seems to accept only blue gem ?
Edit : Dumb question... I forgot to add eye_socket L or R never mind, however it seems to accept only blue gem ?
The Lurker
Re: I only have Daemon Eyes for you!
Hey Trudel,
yes, from the asset pack v1.. you can see in the objects file that the eyes and mouth are coded to only accept the certain colours:
I am assuming you can change this if you like by altering the gem colour and pasting a new clone or definition of the eye/mouth socketsinto your mod assets/scripts/objects file... Eg:
So that the mouth will accept red gems (I have not tried this though....)
yes, from the asset pack v1.. you can see in the objects file that the eyes and mouth are coded to only accept the certain colours:
SpoilerShow
Code: Select all
defineObject{
name = "eye_socket_left",
class = "Alcove",
anchorPos = vec(0.21, 1.58, -0.45),
targetPos = vec(0.2, 1.65, -0.45),
targetSize = vec(0.1, 0.1, 0.1),
placement = "wall",
onInsertItem = function(self, item)
return item.name == "blue_gem" and self:getItemCount() == 0
end,
editorIcon = 92,
}
defineObject{
name = "eye_socket_right",
class = "Alcove",
anchorPos = vec(-0.21, 1.58, -0.45),
targetPos = vec(-0.2, 1.65, -0.45),
targetSize = vec(0.1, 0.1, 0.1),
placement = "wall",
onInsertItem = function(self, item)
return item.name == "blue_gem" and self:getItemCount() == 0
end,
editorIcon = 92,
}
defineObject{
name = "mouth_socket",
class = "Alcove",
anchorPos = vec(0, 1.1, -0.38),
targetPos = vec(0, 1.1, -0.38),
targetSize = vec(0.3, 0.3, 0.3),
placement = "wall",
onInsertItem = function(self, item)
return item.name == "green_gem" and self:getItemCount() == 0
end,
editorIcon = 92,
}
SpoilerShow
Code: Select all
defineObject{
name = "mouth_socket",
class = "Alcove",
anchorPos = vec(0, 1.1, -0.38),
targetPos = vec(0, 1.1, -0.38),
targetSize = vec(0.3, 0.3, 0.3),
placement = "wall",
onInsertItem = function(self, item)
return item.name == "red_gem" and self:getItemCount() == 0
end,
editorIcon = 92,
Labyrinth of Lies (viewtopic.php?f=14&t=4400)
Legacy of Lies (viewtopic.php?f=22&t=12983&hilit=+legacy)
Legacy of Lies (viewtopic.php?f=22&t=12983&hilit=+legacy)
Re: I only have Daemon Eyes for you!
Alcoves (including eyes) don't have a onPickUpItem hook; you'd have to put that check in Party:onPickUpItem instead.akroma222 wrote:Now, when blue gem is inserted, it is destroyed and replaced with blue gem fake (seamlessly). However, I can still pick up the blue gem fake from the eye socket.... Have I fumbled up the onPickUpItem hook??
Thank you all again for your help
Re: I only have Daemon Eyes for you!
I do apologise for not being very thorough in my explanation.akroma222 wrote: Now, when blue gem is inserted, it is destroyed and replaced with blue gem fake (seamlessly). However, I can still pick up the blue gem fake from the eye socket.... Have I fumbled up the onPickUpItem hook??
Thank you all again for your help
onPickupItem is a Party hook... so you need to create a clone of the party in your lua files (usually this is done in init.lua)
Like so:
Code: Select all
cloneObject{
name = "party",
baseObject = "party",
onPickUpItem = function(party,item)
if item.id == "blue_gem_fake" then
return false
else
return true
end
end,
}
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: I only have Daemon Eyes for you!
Yes indeed! Silly me...
Ok, so I have pasted the party script into init.lua but unfortunately I have the same result: turns to blue gem fake once placed into the eye socket, and is able to picked up from the socket (as well as the ground)..
I will try to investigate further, thanks again John and Decayer!
Ok, so I have pasted the party script into init.lua but unfortunately I have the same result: turns to blue gem fake once placed into the eye socket, and is able to picked up from the socket (as well as the ground)..
I will try to investigate further, thanks again John and Decayer!
Labyrinth of Lies (viewtopic.php?f=14&t=4400)
Legacy of Lies (viewtopic.php?f=22&t=12983&hilit=+legacy)
Legacy of Lies (viewtopic.php?f=22&t=12983&hilit=+legacy)