Jump to content

Yossitaru

Member
  • Posts

    2
  • Joined

  • Last visited

Recent Profile Visitors

The recent visitors block is disabled and is not being shown to other users.

Yossitaru's Achievements

  1. As you noticed, the distributions table only populates items that are spawned by the world loot spawner. What you need to do here is to make a custom OnCreate function that populates the open package with whatever items you had in mind. Since one of the three variables passed into the function is the result item, filling it is pretty trivial. Add a new lua file (or add the code to an existing lua file) in the mod's media\lua\server folder. And of course, call the function in the recipe's OnCreate parameter. The following code will put a mirror or a credit card in the box with a 50/50 chance. function FillPackage(items, result, player) local inv = result:getInventory(); local randNum = ZombRand(2); if randNum == 0 then inv:AddItem("Base.Mirror"); else inv.AddItem("Base.CreditCard"); end end
  2. I am attempting to replicate the functionality of base game generators, where they exist as items in your inventory, but become fully fledged World Objects on the ground when dropped. The best I was able to find was the MapObjects.OnNewWithSprite function call found in MOGenerator.lua. However, I have no indication of when or if this function is even called, and I can find no other code that handles the creation of the World Object version of the generator, so I feel I have hit a dead end. Am I simply looking for the wrong words in the lua, or is this a special Java functionality that only works for base game generators?
×
×
  • Create New...