#(sparkwave) "cast" doesn't seem to work on hit target

71 messages · Page 1 of 1 (latest)

icy shard
#

I wrote the following code in a script:

on player tries to attack entity:
        - if <player.item_in_hand.custom_model_data> == 702 and <player.item_in_hand.material> == m@diamond_sword:
            - narrate whoop
            - cast poison duration:10s amplifier:1 <context.entity.as[list]>
dense shellBOT
#

(sparkwave) "cast" doesn't seem to work on hit target

dense shellBOT
#

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.

icy shard
#

This doesn't do anything

#

The "whoop" shows up in chat correctly, so the if statement works

#

But the cast doesn't

#

even if I remove the .as[list]

cyan berry
#

!e tries to

near moonBOT
# cyan berry !e tries to
Cannot Specify Searched Event

Multiple possible events: block tries to dispense item, player tries to attack entity.

cyan berry
#

!e player tries to attack entity

near moonBOT
# cyan berry !e player tries to attack entity
Required Plugins or Platforms

Paper

Group

Paper

Event Lines

player tries to attack <entity>

Switches

with:<item> to only process the event if the player attacks the entity with the specified item.

Triggers

when the player tries to attack an entity. This occurs before any of the damage logic, so cancelling this event will prevent any sort of sounds from being played when attacking.

Has Player

Always. - this adds switches flagged:<flag name> + permission:<node>, in addition to the <player> link.

Context

<context.entity> returns the entity that was attacked in this event.
<context.will_attack> returns whether this entity would be attacked normally.
Entities like falling sand will return false because their entity type does not allow them to be attacked.
Note: there may be other factors (invulnerability, etc.) that will prevent this entity from being at...

Cancellable

True - this adds <context.cancelled> and determines cancelled + cancelled:false.

cyan berry
#

This is a thing?

#

!c cast

near moonBOT
# cyan berry !c cast
Group

entity

Syntax

cast [<effect>] (remove) (duration:<value>) (amplifier:<#>) (<entity>|...) (no_ambient) (hide_particles) (no_icon) (no_clear)

Short Description

Casts a potion effect to a list of entities.

Description

Casts or removes a potion effect to or from a list of entities.

The effect type must be from https://hub.spigotmc.org/javadocs/spigot/org/bukkit/potion/PotionEffectType.html.

If you don't specify a duration, it defaults to 60 seconds.
An infinite duration will apply an infinite duration potion effect, refer to !objecttype DurationTag for more details.

The amplifier is how many levels to *add* over the normal level 1.
If you don't specify an amplifier level, it defaults to 1...

cyan berry
#

Hmm.

near moonBOT
# cyan berry !t objecttag.as

Returns the object, automatically converted to the named object type.
Type names can be of the long form, like "ListTag", "MapTag", "ElementTag", ... or the short form, like "List", "Map", "Element", ...
Type name input is not case-sensitive, so "List" or "list" are the same.

Returns

ObjectTag

Examples
my_example:
    type: task
    # Some input can be any raw object type, but will be forced to a list using 'as[list]' below
    definitions: some_input
    script:
    - narrate "Input list has size <[some_input].as[list].size>"
cyan berry
#

However can you..

#

!debug

near moonBOT
# cyan berry !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!

cyan berry
#

I'd like to see what the script is saying.

icy shard
#

Well, there's a lot of extra log spam

#

This specific code is on lines 90-92

#

I'd have to implement checks for whether custom_model_data is valid everywhere for this to not error constantly and idk how to do that here

#

But that's not the issue, the issue is that the log doesn't seem to say anything useful and the cast thing doesn't work

near moonBOT
# cyan berry !t objecttag.exists

Returns true if the object exists (is non-null). Returns false if the object doesn't exist, is null, or the tag errored.
This functions as a fallback - meaning, if the tag up to this point errors, that error will be hidden.

Returns

ElementTag(Boolean)

cyan berry
#

Or uh

#

!t itemtag.has_custom_model

near moonBOT
icy shard
#

Well, okay, I'll do another one with this

#

Even if this makes my code waaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaay longer

cyan berry
#

This may be unnecessary.

#

What item has the custom model data? I don't see any provided in the script.

#

Only a selleritem

#

Oh sorry.

#

I didn't see you put down a haste.

#

But I'd still like to know what item has the custom model data.

#

Also

icy shard
#

I can't not compare raw

#

It doesn't work if I just do <player.item_in_hand.material> == iron_sword

#

It just doesn't check correctly

#

Only if I do m@iron_sword

cyan berry
#

Correct.

#

That is because it's a material tag.

#

There is a slew of solutions on that page that I linked you.

#

There is never any reason to compare raw objects of any kind.

icy shard
#

ooooooooh okay

#

I'll take another record with debug enabled and with those fixes applied

cyan berry
#

Oh right.

#

And let's...

near moonBOT
# cyan berry !logcheck https://paste.denizenscript.com/View/127468
Server Version

Purpur version 1.21.1-2311-0fa9a50 (MC: 1.21.1)

Plugin Version(s)

Citizens: 2.0.35-SNAPSHOT (build 3494) -- (:warning:Outdated build, behind by 104)
Denizen: 1.3.1-SNAPSHOT (build 7059-DEV) -- (:warning:Outdated build, behind by 21)
Depenizen: 2.1.1 (build 864) -- (Current build :white_check_mark:)
Sentinel: 2.9.1-SNAPSHOT (build 523) -- (Outdated build, behind by 2)

Checked For

@cyan berry

Online/Offline

:triangular_flag_on_post: Offline.

UUID Version

3 (:triangular_flag_on_post: Offline)

Java Version

21.0.3 :white_check_mark:

Other Noteworthy Plugin(s)

WorldGuard: 7.0.11-beta1+a801a9d, MythicMobs: 5.6.2-3e052553, ProtocolLib: 5.3.0-SNAPSHOT-723, Quests: 5.1.4-b507

Suspicious Plugin(s)

AuthMe: 5.6.0-bCUSTOM :triangular_flag_on_post: (Offline login authenticator plugin)
FastLogin: 1.12-SNAPSHOT-4dd6b9a
SkinsRestorer: 15.4.3 :triangular_flag_on_post: (Offline skins fixer plugin)

Problematic Plugin(s)

PvPManager: 3.18.26 - :warning: PvPManager is known to cause issues related to Citizens and Sentinel.
Geyser-Spigot: 2.4.3-SNAPSHOT - Bedrock clients are unsupportable. Please do all testing with a Java Edition client.
floodgate: 2.2.3-SNAPSHOT (b109-49bd564)

Possibly Relevant Plugin(s)

TAB: 4.1.6 - This plugin adds Below_Name scoreboards to NPCs.
ViaVersion: 5.0.5 - Mixed client vs server versions can sometimes cause packet-related issues.
Multiverse-Core: 4.3.12 - Multi-world configuration plugins may affect NPCs in unexpected ways.
FastAsyncWorldEdit: 2.11.3-SNAPSHOT-937;91bdd15 - This plugin has been known to break the plugin load order on many servers, due to usage of the 'loadbefore' directive in its 'plugin.yml'.
GSit: 1.10.0 - 'Sit on other players' or 'sit on mobs' plugins sometimes allow players to sit on NPCs.

icy shard
cyan berry
#

Oof. Exceptions.

#

And a slew of other problems.

#

There's something here that is beyond me and only a helper must address.

icy shard
#

Alright

#

The exceptions are from a separate thing that's supposed to create chat sounds

icy shard
#

Extra question, how do I create a cuboid tag from two locations? Because that doesn't seem to work for me either

cyan berry
#

Unfortunately, there is a problem that only a helper must address before continuing further with support.

icy shard
#

Turns out I was applying poison to a zombie which heals it instead

quasi basinBOT
#
Resolved

Thread closed as resolved.

dense umbra
#

@covert compass cracked @icy shard

quasi basinBOT
#
Thread Reopened

Thread was manually reopened by @dense umbra.

covert compassBOT