I think it may be the name of the greater potion, is it the uiName or Name that you are calling? if it helps this is my setup below
Heres how its set up so I've got the functions above but I'll repeat them anyway
first this in a script entity called f
Code: Select all
function ndItemNameInside(entity, itemName)
if (entity == nil or itemName == nil) then
print("need two variables")
return false
end
for i in entity:containedItems() do
if (i.name == itemName) then
return true
end
end
return false
end
function ndItemIDInside(entity, itemID)
if (entity == nil or itemID == nil) then
print("need two variables")
return false
end
for i in entity:containedItems() do
if (i.id == itemID) then
return true
end
end
return false
end
them these 3 functions hooked up to a receptor (sub out the names as required)
Code: Select all
function ManaChannel()
if (f.ndItemNameInside(reciever, "blank_scroll") and
(f.ndItemNameInside(agent, "Arcane_bottle")))
then
forge: addItem (spawn "scroll_Channel")
playSound("level_up")
end
end
Code: Select all
function Check1()
if reciever == "none" then return end
for i in reciever:containedItems() do
if i.name == "blank_scroll" then
i:destroy()
end
end
end
function Check2()
if agent == "none" then return end
for i in agent:containedItems() do
if i.name == "Arcane_bottle" then
i:destroy()
end
end
end
The so the script is connected to a receptor which activates the forge when the player is sure that the items are correct. obiviously there are two alcoves named receiver and agent and an altar named forge for the result to spawn onto.
In this form it will also destroy any correct items even if the wrong combination is put in so for the above section if a blank scroll was placed with a dagger it would destroy the scroll but leave the dagger and create no new item. I've set this up so there is some trial and error available with more common reagents, but if you wanted you could add a timer that activates only if the correct two items are present and then runns the check functions.
Also if it helps heres the definition for the greater potion, obviously using a custom icon atlas so remove that part or make one with the same name
Code: Select all
defineObject{
name = "potion_greater",
model ="assets/models/items/flask.fbx",
uiName = "Arcane Potion",
class= "Item",
gfxAtlas = "mod_assets/textures/icon_atlasS.tga",
gfxIndex = 3,
description = "Liquid swirls constantly about the bottle, even when you leave it at rest",
consumable = true,
potion= true,
weight= 0.1,
onUseItem = function(self,champion)
champion:modifyStat("health", 150)
champion:modifyStat("energy",50)
playSound("consume_potion")
return true
end
}