Arrow spread?

  • Welcome to skUnity!

    Welcome to skUnity! This is a forum where members of the Skript community can communicate and interact. Skript Resource Creators can post their Resources for all to see and use.

    If you haven't done so already, feel free to join our official Discord server to expand your level of interaction with the comminuty!

    Now, what are you waiting for? Join the community now!

  • LOOKING FOR A VERSION OF SKRIPT?

    You can always check out skUnity Downloads for downloads and any other information about Skript!

Status
Not open for further replies.

Gunst_

Member
Sep 27, 2020
2
0
1
23
Hey i have a question how do i make arrows spread just like a shotgun (i am a starter skripter)

this is my code:

on leftclick:
player is holding stone hoe named "&2Shotgun"
player has a ghast tear named "&bShotgun ammo"
remove 1 ghast tear named "&bShotgun ammo" from player's inventory
wait 0.1 second
shoot an arrow at speed 2
shoot an arrow at speed 2
shoot an arrow at speed 2
play angry villager above player
wait 3 second
give player ghast tear named "&bShotgun ammo"
[doublepost=1601745736,1601724428][/doublepost]nvm i fixed it
 
Hey i have a question how do i make arrows spread just like a shotgun (i am a starter skripter)

this is my code:

on leftclick:
player is holding stone hoe named "&2Shotgun"
player has a ghast tear named "&bShotgun ammo"
remove 1 ghast tear named "&bShotgun ammo" from player's inventory
wait 0.1 second
shoot an arrow at speed 2
shoot an arrow at speed 2
shoot an arrow at speed 2
play angry villager above player
wait 3 second
give player ghast tear named "&bShotgun ammo"
[doublepost=1601745736,1601724428][/doublepost]nvm i fixed it
I guess its not possible because limitation of shoot effect args, direction instead of location. If was possible shoot at yaw and pitch would be easy. If location was the arg instead of direction, it was just do variatons of targeted block location
[doublepost=1601847178][/doublepost]
Hey i have a question how do i make arrows spread just like a shotgun (i am a starter skripter)

this is my code:

on leftclick:
player is holding stone hoe named "&2Shotgun"
player has a ghast tear named "&bShotgun ammo"
remove 1 ghast tear named "&bShotgun ammo" from player's inventory
wait 0.1 second
shoot an arrow at speed 2
shoot an arrow at speed 2
shoot an arrow at speed 2
play angry villager above player
wait 3 second
give player ghast tear named "&bShotgun ammo"
[doublepost=1601745736,1601724428][/doublepost]nvm i fixed it
Code:
on left click:
    if player's tool is a stone hoe named "&2Shotgun":
        if player has a ghast tear named "&bShotgun ammo":
           
            remove 1 ghast tear named "&bShotgun ammo" from event-player
            set {_v} to vector from player to location of targeted block
            shoot an arrow from player at speed 2 {_v}
            set {_v} to vector from player to block below targeted block
            shoot an arrow from player at speed 2 {_v}
            set {_v} to vector from player to block above targeted block
            shoot an arrow from player at speed 2 {_v}
            set {_v} to vector from player to block to the right targeted block
            shoot an arrow from player at speed 2 {_v}
            set {_v} to vector from player to block to the left targeted block
            shoot an arrow from player at speed 2 {_v}
            give 1 ghast tear named "&bShotgun ammo" to event-player
            delete {_spread::%event-player%::*}
command shotgun:
    trigger:
        give 1 ghast tear named "&bShotgun ammo" to player
        give 1 stone hoe named "&2Shotgun" to player

I was wrong, it's possible, using vectors.
Credits for TPGamesNL https://forums.skunity.com/threads/shoot-arrow-from-loc-at-nearest-player.8696/

Its possible too make shoot in a cone, and make spread variation, but, check if this code suits you.
[doublepost=1601849634][/doublepost]I tried to do a function to short this code, but fails, so, receive this code as it is. It's working with a pattern variation

Code:
on left click:
    if player's tool is a stone hoe named "&2Shotgun":
        if player has a ghast tear named "&bShotgun ammo":
            remove 1 ghast tear named "&bShotgun ammo" from event-player
            set {_v} to vector from player to location of block below targeted block
            add random number between 0.5 and 2.0 to x of {_v}
            add random number between 0.1 and 0.5 to y of {_v}
            #add random number between 0.5 and 2.0 to z of {_v}
            shoot an arrow from player at speed 2 {_v}
            set {_v} to vector from player to location of block below block below targeted block
            add random number between 0.5 and 1.0 to x of {_v}
            add random number between 0.1 and 0.5 to y of {_v}
            #add random number between 0.5 and 2.0 to z of {_v}
            shoot an arrow from player at speed 2 {_v}
            set {_v} to vector from player to location of block below block below targeted block
            add random number between 0.5 and 2.0 to x of {_v}
            add random number between 0.1 and 0.5 to y of {_v}
            #add random number between 0.5 and 2.0 to z of {_v}
            shoot an arrow from player at speed 2 {_v}
            set {_v} to vector from player to location of block below block below targeted block
            add random number between 0.5 and 1.0 to x of {_v}
            add random number between 0.1 and 0.5 to y of {_v}
            #add random number between 0.5 and 2.0 to z of {_v}
            shoot an arrow from player at speed 2 {_v}
            set {_v} to vector from player to location of block below block below targeted block
            add random number between 0.5 and 2.0 to x of {_v}
            add random number between 0.1 and 0.5 to y of {_v}
            #add random number between 0.5 and 2.0 to z of {_v}
            shoot an arrow from player at speed 2 {_v}
            set {_v} to vector from player to location of block below block below targeted block
            add random number between 0.5 and 1.0 to x of {_v}
            add random number between 0.1 and 0.5 to y of {_v}
            #add random number between 0.5 and 2.0 to z of {_v}
            shoot an arrow from player at speed 2 {_v}
            set {_v} to vector from player to location of block below block below targeted block
            add random number between 0.5 and 2.0 to x of {_v}
            add random number between 0.1 and 0.5 to y of {_v}
            #add random number between 0.5 and 2.0 to z of {_v}
            shoot an arrow from player at speed 2 {_v}
            set {_v} to vector from player to location of block below block below targeted block
            add random number between 0.5 and 1.0 to x of {_v}
            add random number between 0.1 and 0.5 to y of {_v}
            #add random number between 0.5 and 2.0 to z of {_v}
            shoot an arrow from player at speed 2 {_v}

            give 1 ghast tear named "&bShotgun ammo" to event-player
command shotgun:
    trigger:
        give 1 ghast tear named "&bShotgun ammo" to player
        give 1 stone hoe named "&2Shotgun" to player
 
Last edited:
Status
Not open for further replies.