Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Some entities cannot be spawned from variables. #3753

Open
Moosfet opened this issue Feb 14, 2021 · 2 comments
Open

Some entities cannot be spawned from variables. #3753

Moosfet opened this issue Feb 14, 2021 · 2 comments
Assignees
Labels
bug An issue that needs to be fixed. Alternatively, a PR fixing an issue. PR available Issues which have a yet-to-be merged PR resolving it priority: low Issues that are not harmful to the experience but are related to useful changes or additions.

Comments

@Moosfet
Copy link

Moosfet commented Feb 14, 2021

Description

Attempting to spawn entities from variables does not work for some entities. Where it does work, failing to prefix the entity's name with "a" causes a failure to set the variable.

Steps to Reproduce

Use this code:

command /test:
    trigger:
        set {_test} to a chicken
        if {_test} is an entity:
            message "%{_test}% is an entity"
        else:
            message "%{_test}% is not an entity"
        spawn {_test} at player's location

If you use "cow" or "pig" or "zombie" or "creeper" or "wither skull", the code will say "____ is an entity" and then spawn one at your location. However, if you use "chicken" or "armor stand" or "egg" or "arrow" or "snowball" the code will say "____ is not an entity" and then fail to spawn one at your location.

The entities for which this code does work do not work if the word "a" is removed. Without it, the script displays "<none> is not an entity" despite generating no errors when the script is loaded. However, if I set it to something that does not exist in the game, such as "set {_test} to a goat" then with or without the "a" it will generate an error when the script is loaded. Thus it seems to realize that "pig" is a valid thing in the statement "set {_test} to pig" but when the script is run it fails to set {_test} to anything. I don't know if this is a related bug or a separate one.

Expected Behavior

If I can do this...

spawn ____ at player's location

...then I expect that I should be able to do this...

set {_test} to ____
spawn {_test} at player's location

...and have an identical outcome.

Also, I've come to expect that "a" is an optional word in Skript, so I expect it to be optional in this statement as well, or at least an error should be generated when the script is loaded due to the unrecognized syntax of the statement.

Errors / Screenshots

There are no error messages.

Server Information

  • Server version/platform: Paper version git-Paper-427 (MC: 1.16.5)
  • Skript version: Skript v2.5.3

Additional Context

This seems similar to #1631.

@AyhamAl-Ali AyhamAl-Ali added bug An issue that needs to be fixed. Alternatively, a PR fixing an issue. priority: low Issues that are not harmful to the experience but are related to useful changes or additions. labels Mar 7, 2022
@AyhamAl-Ali
Copy link
Member

AyhamAl-Ali commented Mar 7, 2022

Can confirm
image

Regarding prefixing an entity with a this was discussed before somewhere and it makes sense how it currently work however, parsing chicken and some other entities as item type even with prefix a is a bug

@TheLimeGlass
Copy link
Collaborator

Future potential fix for local variables #3864

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug An issue that needs to be fixed. Alternatively, a PR fixing an issue. PR available Issues which have a yet-to-be merged PR resolving it priority: low Issues that are not harmful to the experience but are related to useful changes or additions.
Projects
None yet
Development

No branches or pull requests

3 participants