Jump to content

Tykvesh

Member
  • Posts

    82
  • Joined

  • Last visited

Posts posted by Tykvesh

  1. 41.78.16, Singleplayer, Vanilla, New save

     

    While stress from cigarettes is barely above Anxious, each zombie kill causes the moodle to disappear and pop up again.

    • Smoker should not be able to reduce stress from kills (unless above the cap from cigarettes?), so it won't lead to this visual noise.
  2. According to ClimateManager, precipitationIntensity is used both for snow and rain, which makes sense.

    This forageSystem function will return "isRaining" during snow, because it tests for any precipitation.

    I have not 100% confirmed it, but figured it was worth mentioning.

     

    function forageSystem.getWeatherType()
    	if getClimateManager():getPrecipitationIntensity() > 0 then return "isRaining"; end;
    	if getPuddlesManager():getPuddlesSize() > 0.1 then return "hasRained"; end;
    	if getClimateManager():getSnowStrength() > 0 then return "isSnowing"; end;
    	return "isNormal";
    end

     

    public float getPrecipitationIntensity() {
    	return this.precipitationIntensity.finalValue;
    }
    
    public boolean isRaining() {
    	return this.getPrecipitationIntensity() > 0.0f && !this.getPrecipitationIsSnow();
    }
    
    public float getRainIntensity() {
    	return this.isRaining() ? this.getPrecipitationIntensity() : 0.0f;
    }
    
    public boolean isSnowing() {
    	return this.getPrecipitationIntensity() > 0.0f && this.getPrecipitationIsSnow();
    }
    
    public float getSnowIntensity() {
    	return this.isSnowing() ? this.getPrecipitationIntensity() : 0.0f;
    }
  3. Can UI3DScene be expanded to support vehicle color, rust and skin? Usage example:

    self.javaObject:fromLua2("setVehicleRust", "vehicle", 1)
    self.javaObject:fromLua2("setVehicleSkinIndex", "vehicle", 0)
    self.javaObject:fromLua4("setVehicleColorHSV", "vehicle", 0, 0.5, 0.5)

     

    I'm using it for a vehicle preview

    ProjectZomboidScreenshot2023_03.30-11_35_09_51.png.3cf2eb83662ac605ed6f21e8dddeac0e.png

  4. On 2/12/2022 at 2:55 PM, Kielo said:

    Tell me please, where can I check all recipe methods like getResult()?

    There's probably a better way, but you can get a list of functions by peeking into metatables:

    --prints functions from userdata type objects
    local function PrintUserdataFunctions(userdata)
    	for k, v in pairs(getmetatable(userdata).__index) do
    		print(k)
    	end
    end
    
    PrintUserdataFunctions(getScriptManager():getRecipe("Base.Clean Bandage"))
    
    --result:
    getName
    isHidden
    getResult
    getSource
    getOriginalname
    needToBeLearn
    Load
    getFullType
    getSound
    getHeat
    getTooltip
    getCategory
    getLuaCreate
    setLuaCreate
    setOriginalname
    setNeedToBeLearn
    DoResult
    setCategory
    getRequiredSkills
    getTimeToMake
    addRequiredSkill
    FindIndexOf
    noBrokenItems
    findSource
    isKeep
    setNearItem
    isDestroy
    setSound
    getRequiredSkill
    DoSource
    isAllowFrozenItem
    setLuaGrab
    setAnimNode
    getProp1
    setStopOnWalk
    setAllowFrozenItem
    getProp2
    isRemoveResultItem
    setStopOnRun
    getLuaGrab
    isStopOnWalk
    getLuaTest
    getLuaGiveXP
    setProp2
    getAnimNode
    setIsHidden
    isStopOnRun
    setLuaTest
    setLuaGiveXP
    getCanPerform
    getNearItem
    setProp1
    setCanPerform
    getRequiredSkillCount
    clearRequiredSkills
    setAllowDestroyedItem
    getNumberOfNeededItem
    getWaterAmountNeeded
    setRemoveResultItem
    setCanBeDoneFromFloor
    isCanBeDoneFromFloor
    isAllowDestroyedItem
    getModule
    wait
    equals
    toString
    hashCode
    getClass
    notify
    notifyAll
  5. Intended or not, currently the magazine does not unlock medicinal herbs. Lemon Grass is an exception, which can be found by anyone.

     

    This is because medicinal herbs require the trait to be visible. Also confirmed in 41.66 (unstable).

    Plantain = {
    		type = "Base.Plantain",
    		minCount = 2,
    		maxCount = 8,
    		xp = 15,
    		traits = { "Herbalist" },
    function forageSystem.hasNeededTraits(_character, _itemDef)
    	local knownTraits = 0;
    	for _, trait in ipairs(_itemDef.traits) do
    		if _character:HasTrait(trait) then
    			knownTraits = knownTraits + 1;
    		end;
    	end;
    	return #_itemDef.traits == knownTraits;
    end
  6. Here's an example how you can modify specifically one of "Open Umbrella" recipes.

    There's probably a way to directly modify recipes with the recipe:Load function, but I haven't figured out the arguments.

    local recipes = getScriptManager():getAllRecipes()
    for i = 1, recipes:size() do
    	local recipe = recipes:get(i - 1)
    	if recipe:getName() == "Open Umbrella" then
    		local result = recipe:getResult()
    		if result:getType() == "UmbrellaRed" then
    			result:setType("Pie")
    			return
    		end
    	end
    end

    screenshot_09-02-2022_19-57-54.png.1772b58b7020ac186af3b9a91b668826.png

  7. There's a temporary solution in singleplayer, is using the Claustrophobic trait. You gain panic in smallish rooms on Fast Forward x1, unlike on any other speed, where it is overpowered by passive panic reduction (starting from 4-5 months). Basically turns Fast Forward x1 into a "wipe all my boredom" button.

  8. A few years ago preview image for Steam Workshop items was increased from 256x256 to 268x268 pixels. The in-game requirement was never updated, so it results in PZ items having previews with black borders. So once it's fixed, newly updated mods should have up to date previews.

     

    screenshot_05-02-2022_22-04-21.png.7f6fe006318375602016e7613b04dde2.png

     

    (Click to open workshop pages in your browser)

    2.png.f14b36bbfa26d3d0ff7a420f2aa718d4.png 1.png.0e6b50fe2a166f1b0e5fc3cfb660e9fd.png

  9. Here's an example for your script:

    function Recipe.OnCreate.hezhuangqichea(items, result, player)
    	if getWorld():getGameMode() ~= "Multiplayer" then
    	for i=0,items:size() - 1 do
    		local item = items:get(i)
    		if item:getType() == "carboxmustangpolice" then
    			if not player:isOutside() or player:getZ() > 0 then
    				player:Say(getText("IGUI_zuzhuangshibai"))
    				player:getInventory():AddItem("carboxmustangpolice")
    			else
    				--first we tell the server to spawn a vehicle for us
    				sendClientCommand(player, "eroge", "SpawnVehicle", { type = "Base.ATAMustangPolice" })
    			end
    Events.OnClientCommand.Add(function(module, name, player, params)
        if module == "eroge" and name == "SpawnVehicle" then
    		--server got the request and spawns the desired vehicle
    		local vehicle = addVehicleDebug(params.type, randomdir[ZombRand(4) + 1], -1, getSquare(player:getX(), player:getY(), player:getZ()))
    			
    		--should repair properly as this code is run server-side
    		vehicle:repair()
    		
    		--tell back to the player to do their client-side stuff
    		sendServerCommand(player, "eroge", "ClaimVehicle", { vehicle = vehicle:getId() })		
    	end
    end)
    Events.OnServerCommand.Add(function(module, name, params)
    	if module == "eroge" and name == "ClaimVehicle" then
    		local vehicle = getVehicleById(params.vehicle)
    		if vehicle ~= nil then
    			--now client can get some keys in peace
    			player:getInventory():AddItem(vehicle:getCurrentKey() or vehicle:createVehicleKey())
    			player:Say(getText("IGUI_zuzhuangchenggong"))
    		end
    	end
    end)
  10. 44 minutes ago, Axezombie said:

    "Added ability to use sheet ropes to create log stacks"

    Finally! but ropes would be come almost useless now, no?

    Ropes weight less so they're still better? And if that's not enough, sheet ropes can have a lesser weight reduction or something.

  11. I think you can resolve all three with client-server commands, using functions sendClientCommand, sendServerCommand, and events OnClientCommand, OnServerCommand. There are plenty of examples in the code! For example, this built-in command should repair vehicles properly (see VehicleCommands.lua):

    sendClientCommand(player, "vehicle", "repair", { vehicle = vehicle:getId() })
  12. On 1/20/2022 at 10:22 PM, MadDan2013 said:

    For this one, if you hold 'F', (or whatever your toggle light key is set to) it should bring up a radial menu like guns/melee for you to insert/remove batteries etc... without any of this happening. I remember that was added not too long ago.

    It doesn't seem to be working (vanilla SP). I always have to re-equip the flashlight after inserting a battery:

     

    88538851_GIF31-Jan-2212-24-26.gif.038812086e01625b5a168e607eae5822.gif

    • 41.65
    • Singleplayer
    • No mods

    Currently Cage Traps drop pristine wire when broken, allowing you to infinitely recycle them.

     

    screenshot_29-01-2022_09-55-44.png.592d213c1dd0c3235ed987bc6e1b00f5.png

     

    Considering that there's a special case for Twine, maybe the same logic should be applied to Wire?

    function STrapGlobalObject.SpawnDestroyItems(trapType, square, object)
        if square then
            local item = "Base.UnusableWood";
    
            --traptype might be nil, in that case check isoobject
            if (not trapType) and object and object:hasModData() then
                trapType = object:getModData()["trapType"];
            end
    
            if trapType then
                for i,v in ipairs(Traps) do
                    if v.type == trapType and v.destroyItem then
                        item = v.destroyItem;
                        break;
                    end
                end
            end
    
            if type(item)=="table" then
                for i,v in ipairs(item) do
                    local spawnItem = square:AddWorldInventoryItem(v, ZombRand(0.1, 0.5), ZombRand(0.1, 0.5), 0);
                    if v=="Base.Twine" then
                        spawnItem:setUsedDelta(spawnItem:getUseDelta());
                    end
                end
            else
                local spawnItem = square:AddWorldInventoryItem(item, ZombRand(0.1, 0.5), ZombRand(0.1, 0.5), 0);
                if item=="Base.Twine" then
                    spawnItem:setUsedDelta(spawnItem:getUseDelta());
                end
            end
        else
            print("no square for spawnDestroyItems");
        end
    end

    I'm not sure which one of these is correct, but in theory it should drain any drainables spawned by broken traps:

    if spawnItem:IsDrainable() then
    	spawnItem:setUsedDelta(spawnItem:getUseDelta())
    end
    if instanceof(spawnItem, "Drainable") then
    	spawnItem:setUsedDelta(spawnItem:getUseDelta())
    end
    • 41.65
    • SP/MP
    • No mods

    Watched a handful of Home VHSes early in my save, and every new tape I found after that (survived for 9 months) had no data assigned to them.

    This seems like a generation issue instead of it being unusable on purpose, as there are 3 types of them: VHS (VHS), VHS_Home (VHS - Home), and VHS_Retail (VHS - Retail).

     

    screenshot_28-01-2022_10-21-26.png.8f0dc95a2aa1f4a554d57cfac3c48620.png

×
×
  • Create New...