How to make a mob only hostile at night.

Started by Inusitatus on

Topic category: Help with modding (Java Edition)

Last seen on 23:48, 17. Dec 2023
Joined Dec 2023
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
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
Last seen on 20:18, 25. Jul 2024
Joined Oct 2023
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
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. 

Last seen on 23:48, 17. Dec 2023
Joined Dec 2023
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
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!!!

Last seen on 23:48, 17. Dec 2023
Joined Dec 2023
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
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?

Last seen on 20:18, 25. Jul 2024
Joined Oct 2023
Points:

User statistics:

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

Sure! What doesn't work?

Last seen on 23:48, 17. Dec 2023
Joined Dec 2023
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
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.

Last seen on 20:18, 25. Jul 2024
Joined Oct 2023
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
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.

Last seen on 23:48, 17. Dec 2023
Joined Dec 2023
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
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.

Last seen on 20:18, 25. Jul 2024
Joined Oct 2023
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
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.

Last seen on 23:48, 17. Dec 2023
Joined Dec 2023
Points:

User statistics:

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

Any luck so far?