#(saga7075) Figuring out EnchantmentScriptContainers (Beginner)

126 messages · Page 1 of 1 (latest)

river gyro
#

hey, new to coding

trying to make an enchantment that has a chance of striking lightning on a hit mob, before figuring out how to add the chance element I wanted to just create the enchant and see if I could get it to work.

when I type /enchant @p my enchant doesn't pop up, here's my simple script:

    type: enchantment
    id: thunder
    slots:
    - mainhand
    rarity: common
    category: weapon
    full_name: Thunder <context.level>
    min_level: 1
    max_level: 1
    min_cost: 1
    max_cost: 5 <context.level.mul[1.5].round>
    is_discoverable: false
    treasure_only: true
    after attack:
    - spawn lightning_bolt <context.victim>```
wraith spadeBOT
#

(saga7075) Figuring out EnchantmentScriptContainers (Beginner)

wraith spadeBOT
#

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.

haughty moss
#

I don't think vanilla enchant can recognize denizen enchantments.

#

You may need to make your own.

#

Enchant command*

#

Also I know custom enchantments are a little problematic.

#

Can you

#

!logs

bright echoBOT
# haughty moss !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.

river gyro
haughty moss
#

I'd like to see a log of you trying.

river gyro
#

yeah lemme get it

haughty moss
#

Better readability.

river gyro
haughty moss
bright echoBOT
haughty moss
#

Custom enchantments have been kind of broken since 1.20.6

river gyro
#

well ty for the help

haughty moss
river gyro
haughty moss
#

But for now uh.

prisma ruinBOT
#
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.)

#

@river gyro

#
Resolved

Thread closed as resolved.

#
Thread Reopened

Thread was manually reopened by @river gyro.

#
Resolved

Thread closed as resolved.

feral stone
#

@river gyro what's being worked on is back-support for the container, if you're looking to add new custom enchantments that should be done using Mojang's new official system in data packs

prisma ruinBOT
#
Thread Reopened

Thread was manually reopened by @feral stone.

feral stone
#

Which can then be fully integrated with from Denizen

#

But while the container will eventually be fixed, it's still a deprecated feature now that Mojang has an official way of doing it

prisma ruinBOT
#
Changed to Help/Support

Thread is now a Help/Support thread. A helper will check your thread when available.

river gyro
#

major thanks

feral stone
#

Can check that out as well

#

And then if you don't want to use Mojang's way of adding functionality, you can obviously make it do whatever you want via Denizen scripts

river gyro
#

I've tried several variations of stuff in the meta docs, here they all are

#
AquamanScepter:
    type: item
    material: trident
    display name: Aquaman's Scepter
    flags:
     thunder: strike

AquamanScepterThunder:
    type: world
    events:
        on entity damages entity with:trident:
        - define thedamntridentman <context.projectile>
        - if <definition[thedamntridentman].has_flag[thunder]>:
            - spawn lightning_bolt <context.entity.location>
#
AquamanScepterThunder:
    type: world
    events:
        on entity damages entity with:trident:
        - if <context.projectile.has_flag[thunder]>:
            - spawn lightning_bolt <context.entity.location>
#
AquamanScepterThunder:
    type: world
    events:
        on entity damages entity with:trident type:projectile:
        - if <context.projectile.has_flag[thunder]>:
            - spawn lightning_bolt <context.entity.location>
#
AquamanScepterThunder:
    type: world
    events:
        on entity damages entity with:trident type:projectile:
        - if <context.entity.type.is_projectile.has_flag[thunder]>:
            - spawn lightning_bolt <context.entity.location>
#
AquamanScepterThunder:
    type: world
    events:
        on entity damages entity with:trident:
        - if <context.entity.type.is_projectile.has_flag[thunder]>:
            - spawn lightning_bolt <context.entity.location>
bright echoBOT
# haughty moss !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!

haughty moss
#

It may not be counting with:trident potentially due to it missing in the players item in hand upon being struck.

#

Also

#

<definition[thedamntridentman]> overconstruction. <[thedamntridentman]> is fine.

haughty moss
river gyro
haughty moss
#

If the damage event can't catch the right thing, you may want to consider

#

!e projectile hits

bright echoBOT
# haughty moss !e projectile hits
Group

Entity

Event Lines

<projectile> hits

Switches

entity:<entity> to only process the event if an entity got hit, and it matches the specified EntityTag matcher.
block:<block> to only process the event if a block got hit, and it matches the specified LocationTag matcher.
shooter:<entity> to only process the event if the projectile was shot by an entity, and it matches the specified EntityTag matcher.

Triggers

When a projectile hits a block or an entity.

Has Player

when the entity that was hit is a player, or when the shooter is a player if no entity was hit. - this adds switches flagged:<flag name> + permission:<node>, in addition to the <player> link.

Has NPC

when the entity that was hit is a npc, or when the shooter is a npc if no entity was hit.

Context

<context.projectile> returns an EntityTag of the projectile.
<context.hit_entity> returns an EntityTag of the entity that was hit, if any.
<context.hit_block> returns a LocationTag of the block that was hit, if any.
<context.hit_face> returns a LocationTag vector of the hit normal (like '0,1,0' if the projectile hit the top of a block).
<context.shooter> returns an EntityTag of the entity that shot the projectile, if any.

Has Known Location

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

Cancellable

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

haughty moss
#

Problem is I don't know if theres a trident throwing event.

river gyro
#

yeah I checked out projectile hits in the metadocs and couldn't find anything

haughty moss
#

Projectile hit might be what you're looking for. If shooter exists and is player and the projectile.item is a trident and has the flag, can run your logic.

#

!t entitytag.item

bright echoBOT
# haughty moss !t entitytag.item

(Property) An entity's item, which can be:

  • the item represented and displayed by a dropped item.
  • the item represented by a thrown trident.
  • a throwable projectile's display item.
  • an eye-of-ender's item, which is both displayed and dropped.
  • a fireball's display item.
  • an item display's display item.
Group

Properties

Returns

ItemTag

Mechanism

EntityTag.item

haughty moss
#

But damage event might work just the same.

#

Tbh.

#

player damaged entity and checking the projectile for all of this.

river gyro
#

hold on, I'm trying to see if I can get the if statement to stop if the mainhand item has the tag[thunder] and then run otherwise

haughty moss
#

Do you mean flag?

river gyro
haughty moss
#

Also.

#

!c strike

bright echoBOT
# haughty moss !c strike
Group

world

Syntax

strike [<location>] (no_damage) (silent)

Short Description

Strikes lightning down upon the location.

Description

Causes lightning to strike at the specified location, which can optionally have damage disabled.

The lightning will still cause fires to start, even without the 'no_damage' argument.

Lightning caused by this command will cause creepers to activate. Using the no_damage argument makes the
lightning do no damage to the player or any other entities, and means creepers struck will not activate.

Use 'silent' to remove the sound of the lightning strike.
NOTE: The 'silent' option appears to have been removed in a Minecraft update and thus lightning will be audible until/unless Mojang re-adds it.

river gyro
#
AquamanScepterThunder:
    type: world
    events:
        on projectile hits entity:
            - spawn lightning_bolt <context.entity.location>
#

I took out all the if statement nonsense to see what would happen and it didn't strike lightning when I shot a small fireball, trident and arrow

#

and yes I made sure to /ex reload

#
on trident hits entity

doesn't work either

bright echoBOT
# haughty moss !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!

haughty moss
#

Even if it says nothing I'd like to see a debug.

river gyro
haughty moss
bright echoBOT
river gyro
#

the <context.entity.location> I think is the issue cos it doesn't work anymore since the event is different

haughty moss
#

!c spawn

bright echoBOT
# haughty moss !c spawn
Group

entity

Syntax

spawn [<entity>|...] (<location>) (target:<entity>) (persistent) (reason:<reason>)

Short Description

Spawns a list of entities at a certain location.

Description

Spawn an entity or list of entities at the specified location.

Accepts the 'target:<entity>' argument which will cause all spawned entities to follow and attack the targeted entity.

If the persistent argument is present, the entity will not despawn when no players are within range, causing the entity to remain until killed.

Optionally specify 'reason:<reason>' (Paper only) to specify the reason an entity is spawning for the 'entity spawns' event,
using any reason from <@link url https://hub.s...

haughty moss
#

Hmm

river gyro
#

oh shit how do I update

#

just download most recent jar file and replace the old one?

haughty moss
#

context.entity doesn't exist in the projectile event. You want context.hit_entity

#

!update denizen

bright echoBOT
haughty moss
#

Grab a dev build yes.

river gyro
#

what's the comand to check for if I'm properly updated

river gyro
#
        on trident hits entity:
            - strike <context.hit_entity.location>
#

works

#

but for some reason the game is saying the that the projectile doesn't have the flag[thunder]

haughty moss
#

This makes sense.

#

When you throw the trident the entity made is not the item.

#

You need to check the projectiles item.

#

!t entitytag.item

bright echoBOT
# haughty moss !t entitytag.item

(Property) An entity's item, which can be:

  • the item represented and displayed by a dropped item.
  • the item represented by a thrown trident.
  • a throwable projectile's display item.
  • an eye-of-ender's item, which is both displayed and dropped.
  • a fireball's display item.
  • an item display's display item.
Group

Properties

Returns

ItemTag

Mechanism

EntityTag.item

river gyro
haughty moss
#

entitytag is not a real tag. It's a uh.. Whats the word? ObjectTag, it represents what it's to be. So if something is an entity such as <context.hit_entity> then you assume that is an EntityTag.

#

!t entitytag.health

bright echoBOT
jaunty iceBOT
river gyro
haughty moss
#

I'm a bit bad at explaining this.

river gyro
#

nono, the word itself having tag in it is confusing

#

dw about it ur helping me a lot

#

I was sitting on this shit for hours and it was tilting me

haughty moss
bright echoBOT
river gyro
#

thank you for your help

torn glacier
#

entitytag indicates that you should replace it with a -tag that returns an entity-

#

<context.entity> is one such tag (in certian contexts)

prisma ruinBOT
#
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.)

#

@river gyro