Saving, changing and recoveryng blocks

  • 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 community!

    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.

MusicManSK

Active Member
Nov 30, 2017
230
11
18
hello!
im need to do something like paintball gun

Firing:
code_language.skript:
on click:
    if player's tool is a gold horse armor:
        spawn ender pearl at position 1 above and 1.5 in front of the player
        push last spawned ender pearl in direction of player with force 2
        play sound "entity.chicken.egg" with volume 10 and pitch 2 at player for players in radius 5 of player

Hitting:
code_language.skript:
on projectile hit:
    if projectile is ender pearl:
        play sound "block.metal.break" with volume 10 and pitch 2 at projectile for players in radius 8 of projectile
        loop blocks in radius 2 of projectile:
            if loop-block is not air:
                set {_pblock} to a random integer between 1 and 8
                set {_paintblock} to "159:%{_pblock}%"
                set the loop-block to {_paintblock} parsed as item
but im need it to get back replaced blocks after 3 seconds...
how to save every block, than set it into random colored clay and than after 3 seconds replace clay with saved block...
plzz help
[doublepost=1515948650,1515946670][/doublepost]I made it like this:

code_language.skript:
on projectile hit:
    if projectile is ender pearl:
        play sound "block.metal.break" with volume 10 and pitch 2 at projectile for players in radius 8 of projectile
        loop blocks in radius 2 of projectile:
            if loop-block is not air:
                set {_paintball::%location of loop-block%} to loop-block
                broadcast "1: %location of loop-block% | %{_paintball::%location of loop-block%}%"
                wait 1 seconds
                set {_pblock} to a random integer between 1 and 8
                set {_paintblock} to "159:%{_pblock}%"
                set the loop-block to {_paintblock} parsed as item
                broadcast "2: %location of loop-block% | %{_paintball::%location of loop-block%}%"
        broadcast "fffff"
        wait 3 seconds
        broadcast "------------------"
        loop blocks in radius 2 of projectile:
            if loop-block is not air:
                broadcast "%location of loop-block% | %{_paintball::%location of loop-block%}%"
                set loop-block to {_paintball::%location of loop-block%}
but the block variable was changed when "set the loop-block to {_paintblock} parsed as item" is run
idk what is this.. its unreal.. WTF? there is no command to change variable.. it shuldnt do that.. its insane!
sorry for my english but.. wtf?? :emoji_grinning:
plzzzz help me!
 
Last edited:
I don't know, maybe i just am dumb, or there is no ways. Just wait, maybe other people know what its wrong.
 
but it must be possible .. we know plugin like Ultra Cosmetics and there is a paintball gun ... but it does not use skript:
or i was thinking about it and i thought that i can use particles .. but problem is that ender pearl dont die when hit the block but inside of that ..and particle shows inside of blocks and i cant see it.. or maybe if you know solution of this particle problem.. i thinking that i must calculate nearest block from loop blocks to player.. but i think its extremlly harder because minecraft has +x; +z and -x; -z and im need to do many thing with it.. i told my dad about it and we was thinking about it together.. and some ppl who was in my house bcs i have birthday today and i had a party.. but.. nobody couldnt help, nobody found solution :emoji_frowning:
 
Some types are saved by reference rather than by value (such as entities, slots or blocks in this case), and such as the variable is a reference, the data saved in it changes with the real object. Said that, the solution here is save the type of the looped block and not the actual block so it gets saved as a value.
 
Status
Not open for further replies.