Jump to content

Stormy

Member
  • Posts

    64
  • Joined

  • Last visited

Community Answers

  1. Stormy's post in Help with reload system was marked as the answer   
    I'm at work so I can't see the fields but here we go...
     
    The principle of the setUpGun method is to determine whether the item that has been clicked on is a reloadable item.....
     
    It checks that there is a corresponding lua weapon type (which was created and added into ReloadUtil:addWeaponType(wepBow1)) for the item that was clicked on and uses the item name to do so.
     
    If it finds one, it looks at the lua weapon type's reloadClass field... and then sets up the item to use the corresponding lua file for performing the reload activities.
     
    It is important to remember that this is done once for an item. After the first time, it uses the item's modData (information about the item that is saved out each time PZ saves). One of the pieces of information saved is the reloadClass.
     
    What I want to do is twofold...
     
    1. Everytime you see an if statement checking the reload class in the two functions I mentioned, print the reloadClass before the if statement so we can make sure it is correct.
     
    2. Make sure you are using a clean save so that nothing incorrect has persisted.
     
    I'll admit the reloading stuff can be a bit confusing. I can try the script myself and see if it works. Is there anything in addition to the snippets you've posted to test this?
  2. Stormy's post in Extending existing item was marked as the answer   
    The language used in the item.txt is zomboid's own.
     
    Extending these items isn't really possible, you just copy the entry and replace the values you want.
     
    I don't have the code in front of me so this probably won't be very useful but I'm guessing the recipes are operating in one of two ways...
     
    a) you define a list of possible items that can be used as each ingredient. in which case you just add the new item to the respective ingredient list
     
    b ) you have a series of near-identical recipes with slightly different names and ingredients. In which case you need to add your own.
  3. Stormy's post in how to start fire and stop zombie from moving was marked as the answer   
    gridSquare:AddTileObject(IsoFire.new(gridSquare:getCell(), gridSquare, true, 2))
     
    Not sure what that end number is for and the fire seems to spawn long after I call the function but that definitely does add a fire to a square.
  4. Stormy's post in Reloading Weapons was marked as the answer   
    Regarding the different amounts being reloaded I'm still looking into this. On easy mode, one value is being used and on hardcore another. Furthermore, firing off rounds uses two rounds at a time. I'm looking into the causes of both of these. They should both be using the lua code to determine the capacity.
     
    The magazine is used to determine the ammo being used by the pistol in both easy and hardcore. The difficulty setting can be changed from the options screen (must be done each time the game loads).
     
    See here for more info:
     
    http://theindiestone.com/forums/index.php/topic/3238-adding-more-guns/
  5. Stormy's post in mod directory for steam game runing osx was marked as the answer   
    Run the game and from the main menu click mods
     
    There is small print at the bottom of the window that will tell you your path
     
    More info:
     
    http://theindiestone.com/forums/index.php/topic/61-robomats-modding-tutorials-updated-08112013/
    http://theindiestone.com/forums/index.php/topic/2011-how-to-use-the-modloader/
  6. Stormy's post in how to delay processing of a function? was marked as the answer   
    Okay so here's a little program I've tested in zomboid:
     
    http://www.mediafire.com/download/lk48iyy5e178fhg/Scheduler.zip
     
    Essentially, the effects can largely be summed up from the temp.lua and you don't really need to pay much attention to the other two classes. The code there is as follows:
    local checkFunction = function(ticksAtCreation, ticks) print("ticksAtCreation"..ticksAtCreation) print("ticks"..ticks) return ticks - ticksAtCreation> 5endlocal performFunction = function() print("Action performed")endlocal postFunction = function() return nilendlocal newEvent = ScheduledEvent:new(ticks, checkFunction, performFunction, postFunction)EventManager.onTickTable[1] = newEventI create three local variables that each hold a function. The check function should return a boolean. It checks the conditions at any given moment and returns true or false. For example, in the above example it checks if 5 ticks have passed (this is a very short amount of time).
     
    The ScheduledEventManager is forced to pass those exact parameters to that function. However, if you could access a global variable (like the in-game date, or the player) you could have any type of condition here (e.g. the player has an item in their inventory or a certain date has been reached).
     
    The performFunction is the action that is performed when the condition is met. In this case, it just prints out to the console.
     
    The postFunction should return the next ScheduledEvent that you want to execute. After the performFunction executes, the postFunction is called and the value it returns replaces the 1 index in the onTickTable.
     
    A ScheduledEvent takes those functions in its constructor. So if you want a new function to execute after the current one you'd write three more functions, add them to a ScheduledEvent, have the postFunction of the first one return that object. If you don't want any more to execute, do as I do and return nil.
     
    The last step is adding the ScheduledEvent we wish to execute first to the EventManager's onTickTable.
     
    I've left some debug statements in there for assistance.
×
×
  • Create New...