Jump to content

theCrius

Member
  • Posts

    7
  • Joined

  • Last visited

Everything posted by theCrius

  1. Aaaaaand, apparently that doesn't work. Other stats work that way, I even tried the full shebang with: getSandboxOptions():set('ZombieLore.Cognition', MEMORY_LONG) zombie:makeInactive(true) zombie:makeInactive(false) zombie:DoZombieStats() getSandboxOptions():set('ZombieLore.Cognition', MEMORY_DEFAULT) That should force the zombie stats to be recalculated, but nothing. Unless I'm checking the wrong attribute. I'm running this to verify after the change: modData.speed = getClassFieldVal(zombie, speedType) modData.cognition = getClassFieldVal(zombie, cognition) modData.memory = getClassFieldVal(zombie, memory) modData.sight = getClassFieldVal(zombie, sight) modData.hearing = getClassFieldVal(zombie, hearing) modData.crawling = zombie:isCrawling() print("[RZF] Zombie ", zid, " updated with speed ", modData.speed, " cognition ", modData.cognition, " memory ", modData.memory, " sight ", modData.sight, " hearing ", modData.hearing) if (modData.crawling) then print("[RZF] | is crawling") end But the memory remains always 800 (which is the default value from proper zombies) even if the other values are indeed changed instead. Another weird thing is that cognition is always set to -1 apparently. No matter that according to the game settings it should be 1,2,3,4 and the default should be 2. But at least the mod is changing that to 1 as expected when a zombie should be updated to be "smart". I'm stumped at the moment. If anyone have any idea, maybe I'm checking the wrong attribute?
  2. Writing my thoughts in case others look for it. Further tests return this: | Sadbox Value | Zombie Attr | UI Label | |--------------|-------------|----------| | 1 | 1250 | Long | | 2 | 800 | Normal | | 3 | 500 | Short | | 4 | 25 | None | | 5 | one above | Random | Imho, the best way to apply a change with the memory is doing something like this. Image you want to change memory of a zombie from the default value (2) to long term memory (1). local MEMORY_DEFAULT = 2 local MEMORY_LONG = 1 getSandboxOptions():set('ZombieLore.Cognition', MEMORY_LONG) zombie:DoZombieStats() getSandboxOptions():set('ZombieLore.Cognition', MEMORY_DEFAULT) This will change momentarily the value of the sandbox variable value to what you want. Recalculate the stats for the zombie, then return them to the previous value. You can easily make this dynamic by firs reading the current values and store it.
  3. Alright so, further exploring brought this up: When a session start I can get the default values that for a regular zombie lore are: Memory 2 Sight 2 Hearing 2 Now I don't care much to store those values as I read them every time the server start before any modification can be done by my mod. It's just so I can store the "default" values. What I found weird is that if I try and retrieve the same attributes from the zombies in the active cells, I get these values: Memory 800 Sight 2 Hearing 2 The anomaly here seems to be the "memory" value as in the SandboxVars is 2 but on the Zombie itself is 800. Is there a relationship between the two values that I can translate in an algorithm? Are there only specific values accepted or I could use any integer between X - 800 - Y?
  4. Hello, I've made this mod: https://steamcommunity.com/sharedfiles/filedetails/?id=2888099799 And I'm trying to add this feature: Given a specific time of the day, assign a specific hearing/sight to a zombie (eventually to ALL zombies if not possible on a one-by-one basis) I've been looking at the documentation APIs but beside the name of properties or functions, they don't really explain how to use them. What I've found is this: - https://projectzomboid.com/modding/zombie/SandboxOptions.ZombieLore.html#Hearing - https://projectzomboid.com/modding/zombie/SandboxOptions.ZombieLore.html#Sight Which could work in changing the hearing and sight of all zombies I guess, which is good enough eventually. My question would be then: - How to I get/set this value (code example) - Do I need to have the game/server reload the sandbox values or is it automatically happening? If the former, how do I do that (code example again)? If there are attributes that can be set on the individual zombie level that would even be better but it's a "plus" that I'm willing to compromise with if it's not possible Thank you!
  5. Found the solution by digging left and right: https://steamcommunity.com/sharedfiles/filedetails/?id=2888099799 If there is an interest I can share the source repository as well
  6. I'm trying my hand at modding project zomboid with an expansion upon the idea of Random Zombies. I wanted to integrate Night Sprinters concept, paired with Random Zombies and I was really happy when I noticed that there has been some collaboration between the two maintainers. Unfortunately the collaboration simply means that during the day "Random Zombies" logic is applied, and during the night, all zombies are sprinters, as per title of the other mod. The maintainer of the latter is not interested in adding new features and the code of Random Zombies is way too convoluted (imho) to allow to easily integrate the two mods into each other. So, thanks to also a couple days of sick leave I've got from work, I decided to try and write something from scratch, using the two mentioned mods as guidance for some of the interaction with the game APIs and some logic. No reason to reinvent the wheel. So, now, I'm at the point in which I've this logic down: - Via options the user can set the distributions for the zombies during the day and during the night, it can also choose when the night start/end for each season. - OnGameStart() will validate the configuration and load it up - EveryHours() it will check if it's time to update the preset loaded between the one for the night and the one for the day What I need to understand now, is how actually change the behaviour, according to the percentages I have, for each zombie. As far as I understood, Random Zombies assign/determine an ID for every Zombie and assign a configuration (speed, health, smartness), based on the distribution, for that zombie. That way it prevents having a zombie first running, for example, then starting to walk at the next function run. Questions that comes to my mind: - How should I determine / assign the Zombie ID? - When should I do that? On zombie in sight is what I was thinking but don't know if there is a better trigger. I want the mod to be as lightweight as possible in terms of resources consumed - How do I actually override the regular "lore" preset assigned by the game? I'm asking for specific APIs for the zombies speed, health, sight, hearing and ability to open doors Ideally I'd love some input from the developers of the aforementioned mods, but whoever has experience tinkering with it or the zombies in general is more than welcome pitching in. I'm writing the mod with plenty of comments explaining the process and hopefully enough source material/reference in the readme so that it can also help others mess with it, so any discussions that brings insight is welcome.
×
×
  • Create New...