• Hey! Register here to create your account, engage with the community, and talk about what is new!

Code being weird and I can't figure out why

EarthMonkeyii

New member
Joined
Feb 27, 2022
Messages
10
Reaction score
1
Code:
PLAYER EVENT: RIGHT CLICK
If player is holding (Lightning Strike) { //Lightning Strike is a golden axe
    %defaultLightningDirection = Eye Location (default)
    Select players by condition: name equals (%default)
    Filter selection by raycast, endpoint (%defaultLightningRaycast), start loc (Eye Location (default)), colliding with solid blocks
    Play sound (pling)
    Give items (cave spider spawn egg) to the selection //This is a debug feature to show who the selection is
    Send message (%defaultLightningRaycast) to all players
    %defaultLightningCloudLoc = Set location (%defaultLightningRaycast) y coordinate to (100)
    Set location (%defaultLightningCloudLoc) direction to (0, -1, 0)
    Send message (Eye Location (default)) to all players
    Send message (%defaultLightningCloudLoc) to all players
    Launch game projectile (riptide trident) at location (%defaultLightningCloudLoc) with speed (0) inaccuracy (0)
    Display particle (flash) at location (%defaultLightningCloudLoc) to all players
}

I had no idea how to phase this besides as if it were code, so sorry about any potential readability issues.

Output: It gives the user (me) the cave spider egg, which may be that when there is no selection it defaults to %default. It then sends in the chat: "0", the user's eye location, "[13.5, 100, 13.5, 90, 0]". It also spawns a trident and displays a flash particle at the location [13.5, 100, 13.5, 90, 0].

The intended result is that the trident and the flash particle appear at the location the player is looking at, with the Y coordinate set to 100. As the title of the thread says, I can't figure out why the code is acting up, so help is much appreciated!
 
Top Bottom