Glitchy

  • 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.

JustADev

Well-Known Member
Apr 8, 2017
379
9
18
Question: Why does my code keep using 2 tnt when i place it down instead of 1?

CODE:
code_language.skript:
on place of TNT:
    if name of player's tool is "&cExplosive TNT &7(Right Click)":
        remove TNT from player's inventory
        cancel event
        create a safe explosion with force 2 at event-location
        set fuse time of the last spawned TNT to 0
    
on damage:
    damage cause is block explosion:
        increase the damage by 0.5
        wait 1 tick
        push the victim backwards at speed 1.7
        
command /TNT:
    trigger:
        give player 1 TNT named "&cExplosive TNT &7(Right Click)"
 
I guess you have 2 TNT when you are executing the thing, try with "remove 1 TNT from player's inventory"
 
try canceling the event before you execute the rest of the code maybe.
on place of tnt:
cancel event
if .....
 
I tried this, but still does the same thing, maybe adding ticks?

CODE:
code_language.skript:
on place of TNT:
    cancel event
    if name of player's held item is "&cExplosive TNT &7(Right Click)":
        remove 1 TNT from player's inventory
        create a safe explosion with force 2 at event-location
        set fuse time of the last spawned TNT to 0
    
on damage:
    damage cause is block explosion:
        increase the damage by 0.5
        wait 1 tick
        push the victim backwards at speed 1.7
        
command /TNT:
    trigger:
        give player 1 TNT named "&cExplosive TNT &7(Right Click)"
 
try
code_language.skript:
remove 1 tnt named "&cExplosive TNT &7(Right Click)" from player's inventory
 
I dont think this would work, but. - Remove 1 TNT named "&cExplosive TNT &7(Right Click)" from player's inventory
[doublepost=1501546577,1501546544][/doublepost]
I dont think this would work, but. - Remove 1 TNT named "&cExplosive TNT &7(Right Click)" from player's inventory
When im late at 0.1 Second xD
 
Nope, but now the tnt has a delay to it when it is removed, so we are getting somewhere
 
Fixed it, Just had to add a longer wait time:

CODE:
code_language.skript:
on place of TNT:
    wait 3 seconds
    remove 1 tnt from player's inventory
    create a safe explosion with force 2 at event-location
    set fuse time of the last spawned TNT to 0
    
on damage:
    damage cause is block explosion:
        increase the damage by 0.5
        wait 1 tick
        push the victim backwards at speed 1.7
        
command /TNT:
    trigger:
        give player 1 TNT named "&cExplosive TNT &7(Right Click)"
 
  • Like
Reactions: Wynnevir
I really don't think you would need to wait 3 seconds
 
Well, it works, i just tested it, thanks for the help guys
 
Status
Not open for further replies.