onPickUpItem - Static item (original item vs mod item)
Posted: Sun Mar 03, 2013 5:15 pm
I try to make a game item to static. Impossible to pick up.
It works very well with an item of original games. But if I try to create my own item, it does not work anymore. I don't know why.
Example with the original skull :
items.lua
init.lua
skull_fake is static. It's OK.
But when I want to take an item from a mod. It does not work. Example with the skull pack of Asteroth6
items.lua
init.lua
The skull_stone_fake is still picked up. I'm close but I don't understand why.
It works very well with an item of original games. But if I try to create my own item, it does not work anymore. I don't know why.
Example with the original skull :
items.lua
SpoilerShow
Code: Select all
defineObject{
name = "skull_fake",
class = "Item",
uiName = "Skull",
model = "assets/models/items/skull.fbx",
gfxIndex = 31,
weight = 1.0,
} SpoilerShow
Code: Select all
cloneObject{
name = "party",
baseObject = "party",
onPickUpItem = function(party, item) -- called when any item is picked up
if item.name == "skull_fake" then
return false -- cancel the pickup action
end
end,
} But when I want to take an item from a mod. It does not work. Example with the skull pack of Asteroth6
items.lua
SpoilerShow
Code: Select all
defineObject{
name = "skull_stone_fake",
class = "Item",
gfxAtlas = "mod_assets/textures/icons/items_s.tga",
uiName = "Stone Skull",
model = "mod_assets/models/stone_skull.fbx",
gfxIndex = 29,
weight = 1.0,
}
SpoilerShow
Code: Select all
cloneObject{
name = "party",
baseObject = "party",
onPickUpItem = function(party, item) -- called when any item is picked up
if item.name == "skull_stone_fake" then
return false -- cancel the pickup action
end
end,
}