Page 1 of 1

onPickUpItem - Static item (original item vs mod item)

Posted: Sun Mar 03, 2013 5:15 pm
by Damonya
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
SpoilerShow

Code: Select all

defineObject{
		name = "skull_fake",
		class = "Item",
		uiName = "Skull",
		model = "assets/models/items/skull.fbx",
		gfxIndex = 31,
		weight = 1.0,
	}	
init.lua
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,
}	
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
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,
	}	
init.lua
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,
}	
The skull_stone_fake is still picked up. I'm close but I don't understand why.

Re: onPickUpItem - Static item (original item vs mod item)

Posted: Sun Mar 03, 2013 5:41 pm
by Komag
is that a second cloned party? only have one, just add another line within the onPickUpItem hook

Re: onPickUpItem - Static item (original item vs mod item)

Posted: Sun Mar 03, 2013 6:08 pm
by Damonya
Komag wrote:is that a second cloned party? only have one, just add another line within the onPickUpItem hook
Ok thanks. Really a newbie error. It works great now of course.

Re: onPickUpItem - Static item (original item vs mod item)

Posted: Sun Mar 03, 2013 6:25 pm
by Komag
No problem :)