How to make a mob only hostile at night.

Started by Inusitatus on

Topic category: Help with Minecraft modding (Java Edition)

Active 1 year ago
Joined Dec 2023
Points:
149

User statistics:

  • Modifications: 0
  • Forum topics: 1
  • Wiki pages: 0
  • MCreator plugins: 0
  • Comments: 7
How to make a mob only hostile at night.
Wed, 12/13/2023 - 21:35 (edited)

Ive been trying so hard to make a mob that attacks only at night.

package net.mcreator.scpmod.procedures;

/* imports omitted */

public class IsNotDayProcedure {
	public static boolean execute(LevelAccessor world) {
		if (world.dayTime() > 12500 && world.dayTime() < 23000) {
			return true;
		}
		return false;
	}
}

This code (actually code blocks, but i just copied the code in the generated code viewer) is referenced in the attack player ai task condition. It will never attack. Please help, this was my last resort.

Edited by Inusitatus on Wed, 12/13/2023 - 21:35
Active 7 months ago
Joined Oct 2023
Points:
315

User statistics:

  • Modifications: 1
  • Forum topics: 1
  • Wiki pages: 0
  • MCreator plugins: 0
  • Comments: 274
Make two mobs, one that…
Wed, 12/13/2023 - 21:39

Make two mobs, one that attacks, and one that doesn't. Make the none attacking one spawn, and check if it is night. If it is, get rid of the first one, and spawn the attacking one. 

Active 1 year ago
Joined Dec 2023
Points:
149

User statistics:

  • Modifications: 0
  • Forum topics: 1
  • Wiki pages: 0
  • MCreator plugins: 0
  • Comments: 7
OOOOhhh, i like that idea. I…
Thu, 12/14/2023 - 00:05

OOOOhhh, i like that idea. I am trying to make a scp 3008 type deal (using the create mod and valkyrian skyes so i can move stuff around) , and that will work great, since i couldnt figure out ow to make him be quiet, this will work so well(i hope), thanks!!!

Active 1 year ago
Joined Dec 2023
Points:
149

User statistics:

  • Modifications: 0
  • Forum topics: 1
  • Wiki pages: 0
  • MCreator plugins: 0
  • Comments: 7
Well, ive messed aroound a…
Thu, 12/14/2023 - 00:36

Well, ive messed aroound a bit, and i cant seem to get it to work. can you please provide more details?

Active 7 months ago
Joined Oct 2023
Points:
315

User statistics:

  • Modifications: 1
  • Forum topics: 1
  • Wiki pages: 0
  • MCreator plugins: 0
  • Comments: 274
Sure! What doesn't work?
Thu, 12/14/2023 - 09:20

Sure! What doesn't work?

Active 1 year ago
Joined Dec 2023
Points:
149

User statistics:

  • Modifications: 0
  • Forum topics: 1
  • Wiki pages: 0
  • MCreator plugins: 0
  • Comments: 7
ok, so, i got it to work,…
Thu, 12/14/2023 - 13:37

ok, so, i got it to work, almost. unfortunately it spawns around twenty of its counterpart, and i cant find anything to make it only trigger once.

Active 7 months ago
Joined Oct 2023
Points:
315

User statistics:

  • Modifications: 1
  • Forum topics: 1
  • Wiki pages: 0
  • MCreator plugins: 0
  • Comments: 274
Could you show me the…
Thu, 12/14/2023 - 14:58

Could you show me the procedure for switching? I could help you use a variable for it.

Active 1 year ago
Joined Dec 2023
Points:
149

User statistics:

  • Modifications: 0
  • Forum topics: 1
  • Wiki pages: 0
  • MCreator plugins: 0
  • Comments: 7
Yeah, i tried some variable…
Thu, 12/14/2023 - 15:50

Yeah, i tried some variable stuff, to no avail. 

https://app.gemoo.com/share/image-annotation/593950251567693824?codeId=vJROajZEYojB9&origin=imageurlgenerator&card=593950250431037440

I am used to game development using gdevelop, and pretty new at this, so please excuse anything that makes me look like an idiot, lol.

Active 7 months ago
Joined Oct 2023
Points:
315

User statistics:

  • Modifications: 1
  • Forum topics: 1
  • Wiki pages: 0
  • MCreator plugins: 0
  • Comments: 274
I think I know a way to fix…
Thu, 12/14/2023 - 16:53

I think I know a way to fix it, give me like a day and I'll send a screenshot.

Active 1 year ago
Joined Dec 2023
Points:
149

User statistics:

  • Modifications: 0
  • Forum topics: 1
  • Wiki pages: 0
  • MCreator plugins: 0
  • Comments: 7
Any luck so far?
Fri, 12/15/2023 - 21:46

Any luck so far?