Jump to content

Trying to stop entity from moving while a player is looking at it


jillbugg

Recommended Posts

I am trying to make it so that if an entity tries to move but a player is looking at it then it will not be able to move, but it isn't working for some reason, can someone help me?

on rightclick on zombie:
	if tool is heart of the sea named "&e&lMob Transformer: &5Zombie → SCP-173":
		set clicked entity's helmet to skull of "scp173" parsed as offline player named "scp173"
		make clicked entity invulnerable
		set clicked entity's name to "&6SCP-173"
		send "%{@prefix}% &aTransformed &6Zombie &ainto &6SCP-173&a!" to player
		set clicked entity's attack damage attribute to 1000
		silence clicked entity

on entity walk:
	if entity's helmet is skull of "scp173" parsed as offline player named "scp173":
		if entity's target is set:
			if player's target is not entity:
				teleport entity to entity's target
				kill the entity's target
			else:
				cancel event
		else:
			if player's target is not entity:
				apply swiftness 3 without particles to entity
				play sound "block.deepslate_tiles.place" at volume 0.5 at entity
				wait 3000 ticks
			else:
				cancel event

if you can help me thanks

Link to comment
Share on other sites

nevermind i figured it out if you want to know what i did its this:
 

on entity walk:
	if entity's helmet is skull of "scp173" parsed as offline player named "scp173":
		if target of "%all players%" parsed as a player is entity:
			cancel event
		else:
			if entity's target is set:
				teleport entity to entity's target
				kill the entity's target
			else:
				apply swiftness 3 without particles to entity
				play sound "block.deepslate_tiles.place" at volume 0.5 at entity
				wait 3000 ticks

all i did was i got rid of all the places that said cancel event and added this at the start:

if target of "%all players%" parsed as a player is entity:
	cancel event

for some reason i guess i didnt know that you can use "all players" to check for any player in the server but i figured that out now which is cool

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...