I am looking for some help making a weapons system with this script, I have reduced it to everything I believe would be helpful for this, The {ammo} variable is public so it would be the same on all items, I want each item to have it's own amount of ammo it can contain, any suggestions as to how?
Code:
on load:
set {zip-lore::*} to "&59mm - 2 DMG" and "The ol reliable" and "can hold 6 ammo" and "%randomDataForLoreUnstack()%"
on left click:
"%player's held item's lore%" contains "gun"
if lore of player's tool contains "9mm - 2 DMG gun":
if {ammo} is greater than 0:
fire(event-player, 17, 2)
set {ammo} to {ammo} -1
send action bar ">> %{ammo}%" to player
else if lore of player's tool contains "automatic":
if {ammo} is greater than 0:
loop 4 times:
fire(event-player, 17, 2)
set {ammo} to {ammo} -1
send action bar ">> %{ammo}%" to player
wait 1 tick
on right click:
if lore of player's tool contains "9mm - 2 DMG":
if player has 6 gold nugget with lore "handgun ammo":
set {_rmv} to 6 - {ammo}
loop {_rmv} times:
remove 1 gold nugget with lore "handgun ammo" from player
set {ammo} to 6
send action bar ">> %{ammo}%" to player
play sound "mob.blaze.hit" with volume 1 and pitch 1.5 to player
permission: skript.comptech.cheats
trigger:
if arg-1 is "zip":
give player magma cream named "&6Zip Gun" with lore {zip-lore::*}
give player gold nugget named "&69mm ammo" with lore "handgun ammo"
set {ammo} to 6