#(flazockt) Server crashes when attacking an sentinel npc

217 messages · Page 1 of 1 (latest)

wary canopy
feral terraceBOT
#

(flazockt) Server crashes when attacking an sentinel npc

feral terraceBOT
#

Hi I'm AutoThreadBot! Don't mind me, I'll just be adding the helper team to this thread so they can see it. A human will get to you soon.

wary canopy
#

mostly happens after joining the server and when attacking while being in creative

static escarp
#

!spark

white patioBOT
# static escarp !spark
Info: spark

The "timings" system within Spigot/Paper is incredibly inaccurate for use with Citizens, and cannot be used to diagnose any issues related to Citizens. It notably blames Citizens for a significant amount of entity-related lag (that isn't in any way caused by Citizens).

For accurate timings, you need a Java profiler. There are a variety of profiler options (WarmRoast, YourKit, VisualVM, ...), but the simplest to use on a Spigot server is a plugin named "Spark" that embeds WarmRoast, which you can find here: https://www.spigotmc.org/resources/spark.57242/.

To get a spark report, type /spark profiler start, then replicate lag issues (for no more than about a minute), then /spark profiler stop, and post the link it gives you.

wary canopy
#

i already have spark

static escarp
#

run a profiler

#

Maybe provide a debug too

#

!debug

white patioBOT
# static escarp !debug
Info: debug

If you need help with a script issue, one of the most powerful tools Denizen has to offer is full debug output. This is displaying in your console whenever scripts are running until you turn debug off. To share a debug log quickly and easily with helpers, simply run the command /denizen debug -r in-game to begin recording, then run through the part of the script you need help with, then run the command /denizen submit. This will give you a link to a paste of the debug log, which you can then copy/paste back to us!

wary canopy
#

cant do debug

static escarp
#

how help

wary canopy
#

in the second where i hit the mob the server freezes

static escarp
#

!logs

white patioBOT
# static escarp !logs
Info: logs

Please post your full latest log file.

Background Info: One of the most helpful tools to identifying the source of a problem is your server logs file! Logs contain all sorts of important information like server and plugin versions, any error messages, and a lot more important information (More Info).

How To: Your log can be found in the logs folder within your server folder. The most recent log is a text file labeled latest.log. To get help using these logs, please open that file in a text editor and copy all of the text, then open https://paste.denizenscript.com/New/Log and paste the text into the box on the page. Then click "Submit" and copy the URL and paste that back into this channel.

Please do not upload the file to Discord or to other pastebin services, use the log pastebin linked above.

static escarp
#

post loggies then

wary canopy
#

there is nothing the the log

static escarp
#

then no help worki

wary canopy
#

cant you look at my script?

static escarp
#

Are you still on 1.21.0?

wary canopy
#

maybe there is something

wary canopy
#

the alt server is on 1.21.3

static escarp
#

I've looked at it. There is nothing in it where I would say you'll get unlimited armor_stands

wary canopy
#

hmm

static escarp
#

When your server crashes, you usually get a crash report

wary canopy
#

no crash report

static escarp
#

Or when your server freezes, you get fancy messages in logs

wary canopy
#

bc the server freezes

#

i have to stop it througth task manager

static escarp
#

They're usually bloody red and say something like "THIS IS NOT A CRASH" followed by a stacktrace

wary canopy
#

nop

static escarp
#

If you can not provide such info, I dont think I will be able to help you

wary canopy
#

i have an idea

#

you cant hurt sentinel npc in creative right?

#

maybe thats the problem

static escarp
#

¯_(ツ)_/¯

wary canopy
#

.-.

static escarp
#

If the Sentinel NPC is invulnerable, then you can hurt it right.

wary canopy
#

what do you mean

static escarp
#

It depends on the vulnerable state of the NPC if you can hit it or not

#

Creative mode has nothing to do with it

wary canopy
#

hmm

#

is there anyway so that my script doesnt shoot when the npc is in his invulnerable state?

static escarp
#

Oh I found something

#

You're using hurt in the damage event that probably creates an infinite loop

wary canopy
#

hmm

static escarp
#

!e damages entity

white patioBOT
wary canopy
#

how would you fix it

static escarp
#

!e entity damaged by entity

white patioBOT
# static escarp !e entity damaged by entity
Group

Entity

Event Lines

<entity> damaged by <entity> <entity> damaged (by <cause>) <entity> damages <entity>

Switches

with:<item> to only process the event when the item used to cause damage (in the damager's hand) is a specified item.
type:<entity> to only run if the entity damaged matches the entity input.
block:<block-matcher> to only run if the damage came from a block that matches the given material or location matcher.

Triggers

when an entity is damaged.

Has Player

when the damager or damaged entity is a player. Cannot be both. - this adds switches flagged:<flag name> + permission:<node>, in addition to the <player> link.

Has NPC

when the damager or damaged entity is an NPC. Cannot be both.

Context

<context.entity> returns the EntityTag that was damaged.
<context.damager> returns the EntityTag damaging the other entity, if any.
<context.damager_block> returns the LocationTag of a block that damaged the entity, if any.
<context.cause> returns an ElementTag of reason the entity was damaged - see !language damage cause for causes.
<context.damage> returns an ElementTag(Decimal) of the amount of damage dealt.
<context.final_damage> returns an ElementTag(Decimal) of the amount of damage dealt, after armor is calculated.
<context.projectile> returns a EntityTag of the projectile, if one caused the event.
<context.damage_type_map> returns a MapTag the damage dealt by a specific damage type with keys: B...
<context.was_critical> returns 'true' if the damage was a critical hit. (Warning: this value is ca...

Determine

ElementTag(Decimal) to set the amount of damage the entity receives.
"CLEAR_MODIFIERS" to zero out all damage modifiers other than "BASE", effectively making damage == final_damage.

Has Known Location

True - this adds switches in:<area> + location_flagged:<flag name>.

Examples

Examples too long to display... Check the website for more examples

static escarp
#

Use the determine option instead ^

wary canopy
#

determine?

static escarp
#

yes

#

You can determine the outcome of an event

wary canopy
#

yes

static escarp
#

e.g. - determine 5 to set the amount the entity receives to 5

#

!guide first world

fallow basin
white patioBOT
wary canopy
#

idk what determine could help me there

fallow basin
#

Line 26 shouldn't even work, you're suppose to do == not = for checking a value.

fallow basin
#

Huh?

static escarp
#

It's technically a fallback option for if

fallow basin
#

That's..

#

Interesting to know.

#

Also.

static escarp
#

hurt will

wary canopy
#

AHHHHHHHHHHHHHHHHHHHHHHH

#

ty

static escarp
#

Also the hurt command on your left clicks block event, will likely run the damages entity event aswell

wary canopy
#

bruh

#

can i add a damage source in determine?

static escarp
wary canopy
#

but i need that so my xp system works ;/

#

any idea?

fallow basin
#

Question.

#

Why are you using an armor stand to find entities?

wary canopy
#

why not :)

#

it can be made invisble

fallow basin
#

This seems like over engineering if you're just spawning an armor stand to get it's location and get it's surrounding area, when you can just .forward and use that location?

wary canopy
#

.-.

#

hmm

#

i like the armor stand hitbox :)))

static escarp
#

after player damages entity:

#

PLAYER damages entity.

#

I have also absolutely no idea how your XP system works

wary canopy
#

but when i just hit blocks

dusk arrow
#

and causing a loop

#

?!

#

add a ratelimit of 1t

#

oh nvm

#

oops

#

sorryyy

fallow basin
wary canopy
#

wut

fallow basin
#

As ice points out, you're using - hurt in a damage event. This is unnecessary?

static escarp
wary canopy
#

i need the damage calc to be in denizen

static escarp
#

We already fixed that part

wary canopy
#

so my stat system can interger into it

static escarp
#

Yee, you need to find a way to damage entities without triggering things twice and redo the calculations

wary canopy
#

well

#

if i remove the damage2 it works

#

but i cant attack an entity directly

#

idk how ;/

fallow basin
#

I think both of your scripts can be used, but you'll need to change the second one.

#

!c hurt

white patioBOT
# fallow basin !c hurt
Group

entity

Syntax

hurt (<#.#>) ({player}/<entity>|...) (cause:<cause>) (source:<entity>/<location>)

Short Description

Hurts the player or a list of entities.

Description

Does damage to a list of entities, or to any single entity.

If no entities are specified: if there is a linked player, the command targets that. If there is no linked
player but there is a linked NPC, the command targets the NPC. If neither is available, the command will error.

Does a specified amount of damage usually, but, if no damage is specified, does precisely 1HP worth of damage (half a heart).

Optionally, specify (source:<entity>) to make the system treat that entity as the attacker.
...

fallow basin
#

In your second script, we don't need to loop again to find all of the entities because you've already found them and damaged them in the first script.

#

Instead, you should just determine the damage that you want with your own equation.

#

Obviously you're doing this in - hurt so just determine that.

#

As ice has recommended.

#

As per the meta for entity damaged by entity

wary canopy
#

is there a context.enemy.died?

fallow basin
#

Damage is only for damaging.

static escarp
#

He wants to look for other entities when he A: hit an entity and B: hit a block and damage them

fallow basin
#

There is an event for entity death, what do you need it for?

wary canopy
#

wait

#

i need the source by the hurt so that works

static escarp
#

When a player damages an entity, the source is the player. You dont need to specify that inside the entity damage event.

wary canopy
#

well

#

you are right

#

but how can i do area damage with determine?

#
  • determine damage:<player.item_in_hand.flag[melee].add[<player.flag[strength].add[<player.flag[tempstrength]>]>]>
#

is that right?

fallow basin
#

You're just determining what the damage should be in your damage event. You're already hurting all of the entities in your left click block script.

#

It just takes a decimal, there's no damage: prefix for the event.

wary canopy
#

.-.

fallow basin
#

So you could just - determine 5 or whatever number you provide.

#

Also.

#

Line 20: Unnecessary.

#

Flags can have a duration: argument.

#

And will auto expire.

#

!c flag

white patioBOT
# fallow basin !c flag
Group

core

Syntax

flag [<object>|...] [<name>([<#>])](:<action>)[:<value>] (expire:<time>)

Short Description

Sets or modifies a flag on any flaggable object.

Description

The flag command sets or modifies custom data values stored on any flaggable object (the server, a player/NPC/entity, a block location, ...).
See also !language flag system.

This command supports data actions, see !language data actions.

Flags by default are added permanently (or for the lifetime of the object they're attached to).
You can optionally specify a system time the flag will expire at, using either a DurationTag or a TimeTag.
If a DurationTag is used, it will be equivalent to: <util.time_now.add[<your_duration_here>]>

fallow basin
#

Although the argument is expire: I use duration. It's interchangable.

wary canopy
#

yea i made that bc something didnt work

versed juncoBOT
fallow basin
#

I'd recommend making some of this into a task btw. Your loop check for entities and trying to hurt them.

#

So you don't have to type it twice for clicking on an entity.

#

Oh wait there is no left click entity, hm.

#

I think I see the problem.

wary canopy
#

uhh whats the problem?

fallow basin
#

I see why you're trying to hurt others in the damage event now, this is getting tricky.

#

Okay so I think you need a way to check if they got hit by your sweep attack. I think you'll need to flag the entity temporarily to let the script know that they've been hit.

#

So that way you can ignore those entities in your sweep.

wary canopy
#

ahh

#

how long should the flag be there?

#

1t?

fallow basin
#

That'd probably be good.

#

Determining in your forloop is not ideal by the way, that'll immediately stop the entire script.

wary canopy
#

uhh

#

can i put hurt there again?

fallow basin
#

You'll want to determine the damage generally at the end.

wary canopy
#

ok

fallow basin
#

Yeah, but as suggested. Use flags and check if those flags exist on the entity, or else we'll end up with a infinite loop again.

wary canopy
#

yes

fallow basin
#

There might be another way that I'm unaware of?

wary canopy
#

ok

kindred sky
# wary canopy https://paste.denizenscript.com/View/129329

small nit, but the hurt command takes in a list of entities, so you don't even need that first for loop. you can just define the entities within the two block radius as something and put that through the hurt command, ie

- define monsters <list>
- hurt <[monsters]> <[amount]> source:<player>
wary canopy
#

uhm

#

idk what you mean

#

srry

#

well

#

i did the flag thing but still doesnt work

kindred sky
#

on line 11?

#

- flag attackedcoold:1 expire:1t

#

this right?

wary canopy
#

idk where to put monsters

#

and how

kindred sky
#

<[aaa].location.find_entities[npc].within[2]>

#

this returns your monsters, correct?

wary canopy
#

yes

kindred sky
#

okay so, that's a list of entities then right?

wary canopy
#

aaa?

kindred sky
#

no

wary canopy
#

yes

#

plz help

kindred sky
#

am typing ._.

#

okay so, we need to take this list of entities, and for each of them that appears, we need to damage them (which you're doing). are there any other conditions we need to be weary of?

wary canopy
#

ok .-.

#

nop

kindred sky
#

okay so

wary canopy
#

just the flag

kindred sky
#

- define monsters <[aaa].location.find_entities[npc].within[2]>

this would give you your list of monsters, you can then hurt them without needing the loop since the hurt command accepts a listtag of entities to damage

#

does that make sense? or did i not explain that right

wary canopy
#

so i just remove the foreach loop

kindred sky
#

or am i misunderstanding something about this whole thing 😭

#

hmmm okay so instead of flagging all of those monsters, why not put a ratelimit on the player before spawning the armor stand? it'd basically disallow the player from using that attack for however long you set it for

#

!c ratelimit

white patioBOT
# kindred sky !c ratelimit
Group

queue

Syntax

ratelimit [<object>] [<duration>]

Short Description

Limits the rate that queues may process a script at.

Description

Limits the rate that queues may process a script at.
If another queue tries to run the same script faster than the duration, that second queue will be stopped.

Note that the rate limiting is tracked based on two unique factors: the object input, and the specific script line.
That is to say: if you have a 'ratelimit <player> 10s', and then a few lines down a 'ratelimit <player> 10s',
those are two separate rate limiters.
Additionally, if you have a 'ratelimit <player> 10s' and two different play...

wary canopy
#

ok

#

FIXED

#

it was that easy

kindred sky
#

nice

wary canopy
#

ty

kindred sky
#

np

wary canopy
#

ill go sleep no

#

now

kindred sky
#

ok

undone yachtBOT
#
Thread Closing Reminder

Has your issue been resolved, or your question been answered?
If so, please use the </resolved:1028673926114594866> command to close your thread.
Or </invalid:1028673926898909185> if it's not possible to resolve.

If not yet resolved, please reply below to tell us what you still need.

(Note that if there is no reply for a few days, this thread will eventually close itself.)

#

@wary canopy