Jump to content

[solved] Difference between InventoryItem and Item (accessing properties/methods like MagazineType and MaxAmmo)


s_f

Recommended Posts

EDIT: nvm. solved it myself.  The  solution is as follows (for people who might need it)

----

-- Assume that we have a scriptItem we get from getSCcriptManager():getAllItems()

local scriptItem = ...

-- the way to access some properties/methods like MaxAmmo and MagazineType is to use the id to create an InventoryItem

local item = InventoryItemFactory.CreateItem(scriptItem:getFullName())

-- then we can access those properties

local magazineType = item:getMagazineType()
local maxAmmo = item:getMaxAmmo()



Hope this is useful for somebody

----

 

I supposed that getScriptManager():getAllItems() returns all item definitions in the game as a Item type.

 

However, it does not seem to have some methods/properties that the in-game InventoryItem type does

for example 

getMagazineType()/MagazineType

getMaxAmmo()/MaxAmmo

 

Both the methods and the properties are undefined.

 

How could I get such properties from the Item type (returned by getAllItems)?

 

Thanks in advance

Edited by s_f
Link to comment
Share on other sites

seems like the modding community (for scripting) is either not very active, or this forum isn't the place? 

If anybody know of a better place to get help on scripting, please give me the directions.  It will be very much welcomed.

Or it may seem that my foray into PZ modding have to be ended prematurely...

Link to comment
Share on other sites

  • s_f changed the title to [solved] Difference between InventoryItem and Item (accessing properties/methods like MagazineType and MaxAmmo)

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...