Custom weapons help

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

Gameeer

Member
Jan 2, 2022
17
1
3
23
Hello, this is my skript:

JavaScript:
on right click:
    if player's tool is iron sword named "&6Hyperion":
        set {explosion} to true
        create a fake explosion 1 meter above the player
        damage all entities in radius 7 of player by 50
        wait 1 tick
        set {explosion} to false

on damage of a player:
    if {explosion} is true:
        cancel event

What im trying to do:
Is there any way i can make the person using this ability the attacker for the mobs killed?
For example:
If you use the ability and kill a mob u can still get the rare drops or custom drops.
Thanks!
 
Hello, this is my skript:

JavaScript:
on right click:
    if player's tool is iron sword named "&6Hyperion":
        set {explosion} to true
        create a fake explosion 1 meter above the player
        damage all entities in radius 7 of player by 50
        wait 1 tick
        set {explosion} to false

on damage of a player:
    if {explosion} is true:
        cancel event

What im trying to do:
Is there any way i can make the person using this ability the attacker for the mobs killed?
For example:
If you use the ability and kill a mob u can still get the rare drops or custom drops.
Thanks!
Code:
function givedrop(p: player, n: text, i: item, chance: number):
   set {_u} to {_p}'s uuid
   clear {damage::%{_u}%}
   chance of {_chance}%:
      give {_p} 1 of {_i} named "%{_n}%"

if player's tool is iron sword named "&6Hyperion":
   set {explosion::%player's uuid%} to true
   if {damage::%player's uuid%} isn't 2:
      add 1 to {damage::%player's uuid%}
   else:
      givedrop(player, "&bExample", diamond, 50)
This would be an idea of how to get it to work. The damage variable checks to see how much damage a player does to a mob (Make sure to add another piece of code to make sure it only adds to that var when a entity is damaged). Also make sure to attach ::%player's uuid%} to variables like explosion!!!! This is because for instance:
Two players damage a different mob, {explosion} is set to true by one player then set to true later by another making it so that both player's are practically immortal for longer than 2 seconds. By adding the player's uuid part, it makes sure that only the player who has that variable attached to them set to true is rendered immortal and doesn't get affected by other players.