Jump to content

Tiax

Member
  • Posts

    22
  • Joined

  • Last visited

Posts posted by Tiax

  1. 3 hours ago, trombonaught said:

    Erm... in comparison to furniture, as the post says 😆

     

    Where did you find the 2x multiplier? I guess "bug" is the wrong word and I'm more curious just to hear if it's intended or an oversight. Sitting on a dirt floor is currently more restful than sitting on a couch which to me just suggests unintended.

     

    (But I got comments like yours back from facebook and discord as well so like, maybe I'm the only person who just doesn't find dirt better than chairs irl 😅)

    The rest action is in the lua files. For the sitting on ground, for comparison, you'll have to dig a little deeper into the java classes. I'll add the formulas/code snippets here, when home.

     

    I do agree though: the current system is not really intuitive from a game logic perspective (cold floor > comfy sofa).

     

    Edit:

    -- lua\client\TimedActions\ISRestAction.lua:13
    -- note: self.mul = 2
    
    function ISRestAction:update()
        if self.character then
            local endurance = self.character:getStats():getEndurance() + ((ZomboidGlobals.ImobileEnduranceIncrease * self.character:getRecoveryMod() * self.mul) * getGameTime():getMultiplier())
            if endurance > 1 then endurance = 1 end
            if endurance < 0 then endurance = 0 end
            self.character:getStats():setEndurance(endurance)
    
            self.character:setMetabolicTarget(Metabolics.SeatedResting);
        end
    end
    // IsoPlayer.java:2800
    // Note: public static double SittingEnduranceMultiplier = 5.0D;
    
    private void updateEndurance(float var1) {
          Stats var10000;
          float var2;
    
          if (this.isSitOnGround()) {
             var2 = (float)ZomboidGlobals.SittingEnduranceMultiplier;
             var2 *= 1.0F - this.stats.fatigue;
             var2 *= GameTime.instance.getMultiplier();
             var10000 = this.stats;
             var10000.endurance = (float)((double)var10000.endurance + ZomboidGlobals.ImobileEnduranceReduce * SandboxOptions.instance.getEnduranceRegenMultiplier() * (double)this.getRecoveryMod() * (double)var2);
             this.stats.endurance = PZMath.clamp(this.stats.endurance, 0.0F, 1.0F);
          } 
      
      // rest omitted
    }

     

  2. "Too much" in comparison to what?

     

    Looking at the code, sitting on ground has a 5x multiplier and is same as sitting in a car. Using the "Rest" action on furniture only has a 2x multiplier (and also seems to ignore Sandbox settings and fatigue for recovery). 

     

    If anything, the "Rest" action recovers too little. Probably because you can combine the two, which is an odd concept by itself - they should be mutually exclusive, with resting giving a bonus over ground.

  3. This is relatively easy to reproduce:

     

    • Have a large stack of items in your inventory, try with 100 threads for good effect (or ripped sheets or practically anything else)
    • Expand the stack in the inventory pane
    • Click on the stack's "heading" to select the full stack

     

    Now, right click any of the contents: You'll see context menu options of other items coming after that item stack in your inventory (e.g. load bullets into magazine, wear clothes, whatever comes later in the list). The inventory considers those all selected due to key conflicts with how the lua tables (ISInventoryPane.items, ISInventoryPane.selected) are populated.

     

    If you drop the stack like that, it will also drop those others things it considers selected. There's probably more side effects.

     

    image.png.726ca282795ba169be7b16c3c424b1c1.png

     

    image.png.c4bdf45f9719d3641bf4d7a90aee39ec.png

  4. On 12/21/2020 at 10:54 AM, Batsphinx said:

    When ignoreZombieDensity=true, the chance of an item spawning is not affected by the zombie density in that part of the map

    This does not seem to work at all. I can see no code change for it either. Can you confirm this has been merged properly?

  5. On 11/28/2020 at 6:14 PM, Asilar said:

    This is doable Tiax. I do it very often in the mod I'm working on. You have to use ModData and item:setToolTip().

    I can give you some code and/or help you if you want, just ping me on discord.

    Doing it like that seems like a bit of a hack though, since you're changing it globally, not just based on the current player?

     

    Edit: this *has* to be done with an event. You could have multiple players look at an item in a container. You will need to show each player a tooltip based on the player's state, which may not be the same one, when sticking to the read/unread example.

  6. Well the change could be as simple as adding a lua table instead of a string to the Distribution.

     

    Let's go with wallets on inventorymale:

    inventorymale = {
      rolls = 1,
      items = {
        ...
        "RiversideMap",0.1,
        "Wallet", 1,
        "Wallet2", 1,
        "Wallet3", 1,
        "Wallet4", 1,
        "Locket", 1,
        ...
      }
    },

    becomes

    inventorymale = {
      rolls = 1,
      items = {
        ...
        "RiversideMap", 0.1,
        { "Wallet", "Wallet2", "Wallet3", "Wallet4" }, 4,
        "Locket", 1,
        ...
      }
    },

    Type being string/list should be easy to check in the java. If it's string nothing changes, if it's a list pick a string from it at random (all same chance). Wouldn't break anything and open a lot of possibilities. You could now add a thousand wallet types and wouldn't drown in drops :)

    Want some wallets to be more common than others? Add them multiple times to the list!

  7. Let's talk about how loot tables currently work. I made a mod adding a bunch of items, added them to the loot tables for zombie male+female as a (what I thought was a rare chance) drop and to my surprise got stuff from every couple of zombies. Really... stuff dropped like crazy.

     

    Checking the the java implementation, I found the equation for loot to be generated in a container is:

     

    Roll N times (that's a var in the table) for every item in the table check if:

    Rand.Next(10000) <= loot_table_chance × 100.0 × luck_modifier × world_loot_modifier + chunk_zombie_intensity_modifier

    Problem #1:

    the chunk_zombie_intensity_modifier sets a lower bound for the minimum drop chance, which you CANNOT influence (unless you set a negative drop chance, but that breaks pretty much every mechanic of lucky/unlucky traits and world_loot_modifier etc., so let's disregard that "hack"). This makes it so by definition you cannot make rare drops, if you add many items. You can expect this to max out at 80  (=0.8% bonus) quickly, which doesn't sound like a lot, but it adds up very quickly, which leads me to problem 2...

     

    Problem #2:

    It always rolls for every item in the table; there are no groups in the drops. Let's assume your mod adds 20 items to a container with a drop chance of literally zero, you'll still find at least one of those 20 items at almost 15% chance, assuming maxed out chunk_zombie_intensity_modifier (1 - (1-0.008)^20 = 0.148). This explained my observation of stuff dropping like crazy.

     

    With drop groups introduced to the existing tables, it could (also) roll if a group is "hit"  (think: a drop group for a container to have ANY handgun, another one for pills like antideps, beta blockers and the likes) and then pick something from those lists. That would also resolve stuff like zombies dropping two pistols, which with the current implementation you cannot prevent (though the chances for it to happen are rare, of course!).

  8. Request: OnInventoryItemTooltip

     

    It would be nice, if mods could implement dynamic tooltips on inventory items, based on the game's or character's state. Example: achieve something like the vanilla game's "already read" on literature items.

  9. Was doing some testing with the nutrition system and enabled the "stored calorie" display in ISCharacterScreen.lua

     

    While jogging (SHIFT key) seems to increase the calorie burn drastically, sprinting (ALT key) burns the same calories as standing/walking!

  10. From checking the LUA, it looks like smaller food items (based on "hunger" value) will always be forced to the same consumption time as cigarettes:

     

    steamapps\common\ProjectZomboid\media\lua\client\TimedActions\ISEatFoodAction.lua

    o.maxTime = math.abs(item:getBaseHunger() * 150 * o.percentage) * 8;
    
    if o.maxTime > math.abs(item:getHungerChange() * 150 * 8) then
        o.maxTime = math.abs(item:getHungerChange() * 150 * 8);
    end
    
    -- Cigarettes don't reduce hunger
    if o.maxTime < 100 then o.maxTime = 450 end

     

    I published a small mod to fix it on the Steam workshop, if you cannot wait for an official fix: https://steamcommunity.com/sharedfiles/filedetails/?id=1902015925

×
×
  • Create New...