custom torches and torchholders
custom torches and torchholders
so far ive created a new torch holder:
cloneObject{
name = "sacrificial_torch_holder",
baseObject = "torch_holder",
}
and a new torch:
cloneObject{
name = "sacrificial_torch",
baseObject = "torch_everburning",
uiName = "sacrificial_torch",
attackPower = 8,
damageType = "fire",
description = "This Torch is rapped in bandages, its fire seems brighter.",
}
now i would like this torch holder to trigger a event only when this special torch is put in
I've no idea how script this
cloneObject{
name = "sacrificial_torch_holder",
baseObject = "torch_holder",
}
and a new torch:
cloneObject{
name = "sacrificial_torch",
baseObject = "torch_everburning",
uiName = "sacrificial_torch",
attackPower = 8,
damageType = "fire",
description = "This Torch is rapped in bandages, its fire seems brighter.",
}
now i would like this torch holder to trigger a event only when this special torch is put in
I've no idea how script this
Re: custom torches and torchholders
Well since the torch holder is cloned from the original, you should be able to add a connector from it like any other torch holder, no?
I'm going to clone your code and see what I can come up with. If my theory proves right, the new torch holder should have all the capabilities of the original torch holder, only it is unique.
Note: I'm fairly certain the torch holder will belong in the object.lua and not the item.lua file.
Edit: Thinking further on this, what would be the way to keep it from being activated by any other torch?
I'm going to clone your code and see what I can come up with. If my theory proves right, the new torch holder should have all the capabilities of the original torch holder, only it is unique.
Note: I'm fairly certain the torch holder will belong in the object.lua and not the item.lua file.
Edit: Thinking further on this, what would be the way to keep it from being activated by any other torch?
"I'm okay with being referred to as a goddess."
Community Model Request Thread
See what I'm working on right now: Neikun's Workshop
Lead Coordinator for Legends of the Northern Realms Project
Community Model Request Thread
See what I'm working on right now: Neikun's Workshop
Lead Coordinator for Legends of the Northern Realms Project
- Message me to join in!
Re: custom torches and torchholders
that's precisely the question!
Finished Dungeons - complete mods to play
Re: custom torches and torchholders
Maybe you could make a custom alcove using the torchholder model, but not sure how it would handle items being placed into it
Finished Dungeons - complete mods to play
Re: custom torches and torchholders
Well there is still a work around by removing the torch, but that's lame and doesn't highlight that the torch is special.Komag wrote:that's precisely the question!
But if you use the torch itself on lets say, an alcove, that much should still be easy enough.
"I'm okay with being referred to as a goddess."
Community Model Request Thread
See what I'm working on right now: Neikun's Workshop
Lead Coordinator for Legends of the Northern Realms Project
Community Model Request Thread
See what I'm working on right now: Neikun's Workshop
Lead Coordinator for Legends of the Northern Realms Project
- Message me to join in!
Re: custom torches and torchholders
do you mean script it to remove any regular torches? how would it detect that?
Finished Dungeons - complete mods to play
Re: custom torches and torchholders
Oh no! I've been totally misunderstood.
Remove the sacrificial torch from the sacrificial holder.
Remove the sacrificial torch from the sacrificial holder.
"I'm okay with being referred to as a goddess."
Community Model Request Thread
See what I'm working on right now: Neikun's Workshop
Lead Coordinator for Legends of the Northern Realms Project
Community Model Request Thread
See what I'm working on right now: Neikun's Workshop
Lead Coordinator for Legends of the Northern Realms Project
- Message me to join in!
Re: custom torches and torchholders
So i figured out a way to do this, but it's a hack that requires that there are no torches on the ground in the holders square that was placed there in the editor(facing the same way as the holder) or thrown there facing the holder, if there are the script will tell the player to remove them.
You need a torch holder that triggers this script with id "special_torch_holder", and right now it checks the id for a torch with the id "special_torch" but for your new torch types change the check to look at the name instead of the id.
You need a torch holder that triggers this script with id "special_torch_holder", and right now it checks the id for a torch with the id "special_torch" but for your new torch types change the check to look at the name instead of the id.
Code: Select all
function addTorch()
x = special_torch_holder.x
y = special_torch_holder.y
l = special_torch_holder.level
-- Gather all torches avaible in the square
torch_table = {}
for i in entitiesAt(l, x, y) do
-- Does the item have torch in the name
if( string.find(i.name, "torch") ~= nil ) then
-- Make sure it dosent have holder in it's name
if( string.find(i.name, "holder") == nil ) then
table.insert(torch_table,i)
end
end
end
print(#torch_table)
for id, torch in ipairs(torch_table) do
-- Exlude all that is on heroes
for hero = 1, 4 do
champ = party:getChampion(hero)
for i = 1, 31 do
if( champ:getItem(i) == torch ) then
table.remove(torch_table,id)
end
end
end
-- Remove all torches not facing the same way as the torch holder
if( torch.facing ~= special_torch_holder.facing ) then
table.remove(torch_table,id)
end
end
-- Now torch_table only includes items on the ground or in the holder
-- and facing the same way as the holder
-- Only activate if there is only one torch
if( #torch_table == 1 ) then
-- Get the last item in the table, and the only item
torch = table.remove(torch_table)
-- Here you can change it to check (torch.name == "sacrificial_torch") instead
if( torch.id == "special_torch" ) then
-- Do the stuff it should when the special torch is inserted
hudPrint("Special torch inserted")
end
else
hudPrint("Remove all other torches from the floor")
end
end
Re: custom torches and torchholders
i was kind of hoping for a hook in the objects file simular to the daemon eye socket one ,,,,
Re: custom torches and torchholders
I'VE GOT IT!
Make your torch holder a lock and your torch a key!
Make your torch holder a lock and your torch a key!
"I'm okay with being referred to as a goddess."
Community Model Request Thread
See what I'm working on right now: Neikun's Workshop
Lead Coordinator for Legends of the Northern Realms Project
Community Model Request Thread
See what I'm working on right now: Neikun's Workshop
Lead Coordinator for Legends of the Northern Realms Project
- Message me to join in!