Jump to content
RegularX

Insomnia

Recommended Posts

I was wondering how this worked, so I went through the lua. I noticed that you print all of the functions, but they only show up in the console, obviously. Do you have any plans to make an in-game message just for the "Night has fallen" "Day has risen" messages?

 

Also I looked at the other code after I realized that the Insomnia night starts at 9:00 or 9:30pm and runs until 9-10:30ish am, even though you've got a couple of dawn, dusk functions there. It's not much of an issue, in fact, at all, but it would make more sense if the Insomnia night started at dusk and ended at dawn, but that's just me.

 

One more thing, the Insomnia starter kit stacks with the sandbox starter kit, just to let you know. Again, not much of an issue but somewhat slightly makes the start unbalanced in my opinion.

 

Otherwise, this is absolutely the perfect mod I've been looking for, thanks for the great work!

Share this post


Link to post
Share on other sites

zombies during the day have normal hearing right? so why is it that every time i enter a building that 80+ zombies come from everywhere and start smashing the building i'm in to pieces in broad daylight. i can walk casually right by them yet when i'm nowhere near any of them and am sneaking around, the moment i set foot in a building i get swarmed. it makes everything hard as you can't loot any building for more than 20 seconds without getting swarmed. This even happens to the building i spawn in and i've tried so hard to be stealthy and sneaky.

Share this post


Link to post
Share on other sites

zombies during the day have normal hearing right? so why is it that every time i enter a building that 80+ zombies come from everywhere and start smashing the building i'm in to pieces in broad daylight. i can walk casually right by them yet when i'm nowhere near any of them and am sneaking around, the moment i set foot in a building i get swarmed. it makes everything hard as you can't loot any building for more than 20 seconds without getting swarmed. This even happens to the building i spawn in and i've tried so hard to be stealthy and sneaky.

 

That doesn't sound like correct behavior, being inside the building shouldn't change their awareness. In fact having more time to barricade was one of the original reasons for the mod. Might be a conflict with a recent code update to the core game, I haven't played in a while.  It might be some time before I can QA it but I'll try to find some time.

Share this post


Link to post
Share on other sites

 

zombies during the day have normal hearing right? so why is it that every time i enter a building that 80+ zombies come from everywhere and start smashing the building i'm in to pieces in broad daylight. i can walk casually right by them yet when i'm nowhere near any of them and am sneaking around, the moment i set foot in a building i get swarmed. it makes everything hard as you can't loot any building for more than 20 seconds without getting swarmed. This even happens to the building i spawn in and i've tried so hard to be stealthy and sneaky.

 

That doesn't sound like correct behavior, being inside the building shouldn't change their awareness. In fact having more time to barricade was one of the original reasons for the mod. Might be a conflict with a recent code update to the core game, I haven't played in a while.  It might be some time before I can QA it but I'll try to find some time.

 

I'm not sure if this is the case, but it is possible that this is from the new update to zombies.

 

Build 32 introduced some serious changes to zombie spawning/migration and has made them a far more serious threat.

 

On topic with the mod, I love the idea, it reminds me of the I Am Legend style creatures. 

 

I'll try it out when I can. Though I am cautious about not sleeping, I wonder how it will affect gameplay.

Share this post


Link to post
Share on other sites

Yeah, without looking under the cover that actually makes it sound like somehow being inside is being confused with night.  Because yes, 80 zombies swarming your house when the sun goes down is totally with the design.  But that's supposed to be offset with easier looting and barricading.

Share this post


Link to post
Share on other sites

Could you tweak the mod a bit (as a side project) to spawn empty as usual and the zombies to have super everything at night?

It's for my multiplayer server. Can't sleep anyway.

Share this post


Link to post
Share on other sites

Love the mod reminds me of I am legend. I'm seeing a few things that I don't know are intentional are not. 

 

1. Zombies attack me during the day sometimes you get that one zombie usually if I open a door while they're attacking it. 

 

2. Yet they are blind during the day the somehow know where I am going even if I'm at walking speed. Its not a big deal but I'm trying to play stealthy.

Share this post


Link to post
Share on other sites

Do you think you could create a version of Insomnia where you can sleep and zombies are just blind day and night?

 

Knowing that ruins the point of Insomnia, do you think you could perhaps create a separate mod where zombies are blind, but no other changes than that? I'd really like to do a playthrough where the zeds are completely blind, but even with the poor setting, they can still see well. I'd really like to have it so I have to still be careful, while still tensing up.

Share this post


Link to post
Share on other sites
7 hours ago, Lightning Flash said:

Do you think you could create a version of Insomnia where you can sleep and zombies are just blind day and night?

 

Knowing that ruins the point of Insomnia, do you think you could perhaps create a separate mod where zombies are blind, but no other changes than that? I'd really like to do a playthrough where the zeds are completely blind, but even with the poor setting, they can still see well. I'd really like to have it so I have to still be careful, while still tensing up.


Hey all - clearly I haven't had time to maintain my Zomboid mods as of late.  Had a lot of fun writing them but don't have time to even research what new changes would be required to keep them going.

Lightning, if you can unpack the mod the code to do that is super simple:

 

Insomnia.OnPlayerUpdate = function(player)
	player:getStats():setFatigue(0);	
	if getPlayer():getModData()["IsNight"] == 0 then
		gameTime = GameTime:getInstance();
		gameTime:setViewDist(1);
	else 
		gameTime = GameTime:getInstance();
		gameTime:setViewDist(75);
	end

end

You can pretty much just pull the code from the if and ignore the else, forcing the global vision to always be 1.

Assuming the game still uses that function :)

Share this post


Link to post
Share on other sites
14 hours ago, RegularX said:


Hey all - clearly I haven't had time to maintain my Zomboid mods as of late.  Had a lot of fun writing them but don't have time to even research what new changes would be required to keep them going.

Lightning, if you can unpack the mod the code to do that is super simple:

 


Insomnia.OnPlayerUpdate = function(player)
	player:getStats():setFatigue(0);	
	if getPlayer():getModData()["IsNight"] == 0 then
		gameTime = GameTime:getInstance();
		gameTime:setViewDist(1);
	else 
		gameTime = GameTime:getInstance();
		gameTime:setViewDist(75);
	end

end

You can pretty much just pull the code from the if and ignore the else, forcing the global vision to always be 1.

Assuming the game still uses that function :)

 

If I'm reading this correctly, do I have to delete the "else" from the code? And what happens if you set the global vision to 0? Or is that impossible/will cause the game to crash or the mod to not work right?

 

And about the Set Fatigue, if I set it to 1, does that mean I can get tired again?

Edited by Lightning Flash
Extra question.

Share this post


Link to post
Share on other sites
7 hours ago, Lightning Flash said:

 

If I'm reading this correctly, do I have to delete the "else" from the code? And what happens if you set the global vision to 0? Or is that impossible/will cause the game to crash or the mod to not work right?

 

And about the Set Fatigue, if I set it to 1, does that mean I can get tired again?


Right so with this code:


 

Insomnia.OnPlayerUpdate = function(player)
	gameTime = GameTime:getInstance();
	gameTime:setViewDist(1);
end


I think you would blind all the zombies, all the time, and be able to get tired normally.  If that's your kind of thing ;)

Again though, I don't have my setup where I can test this against the latest build so your mileage may vary.
 

Share this post


Link to post
Share on other sites
16 hours ago, RegularX said:


Right so with this code:


 


Insomnia.OnPlayerUpdate = function(player)
	gameTime = GameTime:getInstance();
	gameTime:setViewDist(1);
end


I think you would blind all the zombies, all the time, and be able to get tired normally.  If that's your kind of thing ;)

Again though, I don't have my setup where I can test this against the latest build so your mileage may vary.
 

 

Okay, so I've managed to set it properly so the zeds are blind day and night (not entirely perfect, as sometimes they'll see me and follow before the game realizes they can't actually see me, then they're blind again. Not a huge problem). I like it personally because it reminds me of Highschool Of The Dead, as the zombies in there are blind.

 

However, one problem I ran into was that my fatigue was still gone. But what I did after reading this comment was delete the setFatigue code and saved it as a copy of the original file. I'm going to try that out next, as the way I read yours, that seems like it's what I'm meant to do.

 

Sorry, I'm not a huge whiz of programming, haha. But I still appreciate the work you put into this! Thank you for helping me! I'll let you know if the setFatigue was my problem!

 

EDIT: Okay, I don't think deleting it was necessarily the problem, but it did cause the zombies to see again, but I was tired (I believe it actually broke the mod, so luckily I had the copy). From a quick search online the SetFatigue has to be at a certain number? 0 basically disables it, and setting it to 1 makes me always exhausted. I'm guessing it has to be set higher so it's normal?

Edited by Lightning Flash

Share this post


Link to post
Share on other sites
9 hours ago, Lightning Flash said:

EDIT: Okay, I don't think deleting it was necessarily the problem, but it did cause the zombies to see again, but I was tired (I believe it actually broke the mod, so luckily I had the copy). From a quick search online the SetFatigue has to be at a certain number? 0 basically disables it, and setting it to 1 makes me always exhausted. I'm guessing it has to be set higher so it's normal?

 

So Insomnia works by constantly setting your fatigue to zero in the PlayerUpdate (which is constantly getting run as the game runs).  Since you have no fatigue, the game won't let you sleep.  So if you remove that line I think fatigue should work as normal, but yeah if you made it one you would be constantly tired.

The day blindness works by setting the visible range to 1, which doesn't entirely make them blind - they will still attack if you get too close.  IIRC setting it to zero was effectively ignored by the game.

The night works by setting the visibility crazy high and then finding zombies and herding them to the player.  That's why it's not just a couple that show up at your door, but a decent mob.  The night stuff was easily the most complex part of writing it.

And hey - taking a mod and breaking it a few times is a great way to get started with modding :)

Share this post


Link to post
Share on other sites
4 hours ago, RegularX said:

Taking a mod and breaking it a few times is a great way to get started with modding :)

Good point. :)

 

I actually did delete that code, but what ended up happening was that the set vision code ended up not working, leading to the zombies seeing like normal. Does it depend on the amount of space between each line of code? (The way I see it, it's spread outword, though I think it's because I'm editing it in Notepad, rather than downward like typical code)

 

I'll edit it a few more times, see what I can do. But yeah, I'm thinking of getting into modding myself, though for some simple things (like a standalone blindness mod, haha). Mods like these are what make me want to mod for this game. :)

 

EDIT: Okay, I'm editing it in Wordpad this time, making the code go downward. I deleted it again, so I'm going to test it now.

 

EDIT 2: It seems to be working now, as I can sneak past the zombies. However, sometimes they will follow me for a few seconds as I am sneaking around like they can see me, but then I'll stand aside and they'll be moving in the direction they were. I think this is an issue with the Restless Zombies mod (variant of the Nocturnal Zombies). I'm going to disable that mod and see if that fixes the problem.

 

EDIT 3: I disabled Restless Zombies, and now the zombies are all blind, no longer following me, except for when I open doors initially (that's not a huge problem, anyway :P). I also realized what my problem was, I didn't transfer over the edited copy from my desktop. So this whole time, I hadn't even been testing the right variant of the LUA, haha. Gonna fix that.

 

EDIT 3: Yes, I got it working! Thank you RegularX for helping me out! :) 

Edited by Lightning Flash
Solved the issue I was attempting to fix.

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...

×
×
  • Create New...