lmyalmy
本帖最后由 lmyalmy 于 2019-9-10 09:45 编辑

on leftclick holding sword or axe:
  set {_attackcd} to 20

  #攻击冷却
  if line 1 of lore of tool of player exists:
  set {_temp::*} to lore of player's tool
  loop {_temp::*}:
    set {_lore} to loop-value
    if {_lore} contains "攻击速度":
      set {_first} to 9
      set {_lore} to subtext of {_lore} from character {_first} to the length of {_lore}
      set {_last} to the first index of " " in {_lore}
      set {_lore} to subtext of {_lore} from character 1 to character {_last}-1
      set {_attackcd} to {_lore} parsed as number
  #装备攻速加成
  clear {_toloop::*}
  set {_toloop::1} to helmet of player
  set {_toloop::2} to chestplate of player
  set {_toloop::3} to leggings of player
  set {_toloop::4} to boots of player
  loop {_toloop::*}:
    line 1 of lore of loop-value exists
    set {_temp::*} to lore of loop-value
    loop {_temp::*}:
      if loop-value-2 contains "攻击速度: + ":
        set {_first} to 11
        set {_lore} to subtext of loop-value-2 from character {_first} to the length of loop-value-2
        set {_last} to the first index of "%%" in {_lore}
        set {_lore} to subtext of {_lore} from character 1 to character {_last}-1
        set {_attackcd} to {_attackcd} * (1 - ({_lore} parsed as number)/100)

  if {attackcd::%player%} is set:
    if {attackcd::%player%} > 0:
      cancel event
      stop trigger
  set {attackcd::%player%} to {_attackcd}
  set {attackcooldown::%player%} to {_attackcd}


every 1 tick:
  loop all players:
    if {attackcd::%loop-player%} > 0:
      subtract 1 from {attackcd::%loop-player%}
      set level progress of loop-player to "%{attackcd::%loop-value%}/{attackcooldown::%loop-value%}%" parsed as number
    if {attackcd::%loop-player%} < 0:
      set {attackcd::%loop-player%} to 0
      set level progress of loop-player to "%{attackcd::%loop-value%}/{attackcooldown::%loop-value%}%" parsed as number
_________________________________________________________________________________________________________________________                  ↑:源代码      ↓:食用方法           
_________________________________________________________________________________________________________________________
食用方法:
第一步:请在服务器加入skript插件后在plugins/Skript/scripts/目录中新建一个文件并将扩展名改为.sk,复制进去上边的代码即可
第二步:在希望支持该脚本的武器(剑、斧头)上写上lore,格式为:&f攻击速度: <数字> (数字最好要大于0,20为一秒)
第三步(可选择):在希望支持该脚本的护甲上写入lore,格式为:&f攻击速度: + <数字> % (这个数字要在0和100之间,数字越大攻速提高越多)
注意事项:
1、上边写的格式中,标蓝的地方是lore(&f就是说把lore染成白色,当然你也可以用不同颜色来暗示玩家该武器攻击冷却的长短,这里的颜色无所谓)
2、上方标红的地方表示有一个空格,必须写入不然会出错误
3、这个只是我rpg服务器一大堆脚本中的一个,我的合成表都是自己定制的——所以说玩家接触的到的武器都有这些lore。大家在开服的过程中可以选择性的利用其他插件来支持该脚本。4、该脚本在编写的时候版本为2.2-dev37c,如果使用不同版本有可能会出现问题,请注意!

作用:原版的武器开连点也会有一点伤害,甚至rpgitem插件里,开连点和1.7.10一样,伤害都不会降低。但是加了这个插件,rpg武器(尤其是逆天的那种)可以加入一个冷却,冷却会显示在玩家的经验值栏中。未完成冷却的时候,玩家的攻击不会起作用,反而会重新设置冷却。这一点也很好的减少了玩家开连点的几率,因为如果开连点过快会无限冷却所以只能打出来第一刀,过慢的话还不如手点,反而增加了空刀概率。



最后,大家如果有对该插件的问题和建议,欢迎提出,谢谢!

2021.12 数据,可能有更多内容on leftclick holding sword or axe:
set {_attackcd} to 20


#攻击冷却
if line 1 of lore of tool of player exists:
set {_temp::*} to lore of player's tool
loop {_temp::*}:
    set {_lore} to loop-value
    if {_lore} contains &quot;攻击速度&quot;:
   set {_first} to 9
   set {_lore} to subtext of {_lore} from character {_first} to the length of {_lore}
   set {_last} to the first index of &quot; &quot; in {_lore}
   set {_lore} to subtext of {_lore} from character 1 to character {_last}-1
   set {_attackcd} to {_lore} parsed as number
#装备攻速加成
clear {_toloop::*}
set {_toloop::1} to helmet of player
set {_toloop::2} to chestplate of player
set {_toloop::3} to leggings of player
set {_toloop::4} to boots of player
loop {_toloop::*}:
    line 1 of lore of loop-value exists
    set {_temp::*} to lore of loop-value
    loop {_temp::*}:
   if loop-value-2 contains &quot;攻击速度: + &quot;:
  set {_first} to 11
  set {_lore} to subtext of loop-value-2 from character {_first} to the length of loop-value-2
  set {_last} to the first index of &quot;%%&quot; in {_lore}
  set {_lore} to subtext of {_lore} from character 1 to character {_last}-1
  set {_attackcd} to {_attackcd} * (1 - ({_lore} parsed as number)/100)


if {attackcd::%player%} is set:
    if {attackcd::%player%} &gt; 0:
   cancel event
   stop trigger
set {attackcd::%player%} to {_attackcd}
set {attackcooldown::%player%} to {_attackcd}


every 1 tick:
loop all players:
    if {attackcd::%loop-player%} &gt; 0:
   subtract 1 from {attackcd::%loop-player%}
   set level progress of loop-player to &quot;%{attackcd::%loop-value%}/{attackcooldown::%loop-value%}%&quot; parsed as number
    if {attackcd::%loop-player%} &lt; 0:
   set {attackcd::%loop-player%} to 0
   set level progress of loop-player to &quot;%{attackcd::%loop-value%}/{attackcooldown::%loop-value%}%&quot; parsed as number
_________________________________________________________________________________________________________________________   ↑:源代码   ↓:食用方法 
_________________________________________________________________________________________________________________________
食用方法:
第一步:请在服务器加入skript插件后在plugins/Skript/scripts/目录中新建一个文件并将扩展名改为.sk,复制进去上边的代码即可
第二步:在希望支持该脚本的武器(剑、斧头)上写上lore,格式为:&amp;f攻击速度: &lt;数字&gt; (数字最好要大于0,20为一秒)
第三步(可选择):在希望支持该脚本的护甲上写入lore,格式为:&amp;f攻击速度: + &lt;数字&gt; % (这个数字要在0和100之间,数字越大攻速提高越多)
注意事项:
1、上边写的格式中,标蓝的地方是lore(&amp;f就是说把lore染成白色,当然你也可以用不同颜色来暗示玩家该武器攻击冷却的长短,这里的颜色无所谓)
2、上方标红的地方表示有一个空格,必须写入不然会出错误
3、这个只是我rpg服务器一大堆脚本中的一个,我的合成表都是自己定制的——所以说玩家接触的到的武器都有这些lore。大家在开服的过程中可以选择性的利用其他插件来支持该脚本。4、该脚本在编写的时候版本为2.2-dev37c,如果使用不同版本有可能会出现问题,请注意!

作用:原版的武器开连点也会有一点伤害,甚至rpgitem插件里,开连点和1.7.10一样,伤害都不会降低。但是加了这个插件,rpg武器(尤其是逆天的那种)可以加入一个冷却,冷却会显示在玩家的经验值栏中。未完成冷却的时候,玩家的攻击不会起作用,反而会重新设置冷却。这一点也很好的减少了玩家开连点的几率,因为如果开连点过快会无限冷却所以只能打出来第一刀,过慢的话还不如手点,反而增加了空刀概率。




最后,大家如果有对该插件的问题和建议,欢迎提出,谢谢!

lmyalmy
各位如果有好的建议或者意见,欢迎回复~~

三列玖座丶
这个支持的版本是要多少

as296774889
这个是通用版本嘛?

Ghostar_Dragon
什么版本啥服务端

mc3124076548
every 1 tick: 大丈夫?

Alpha-∞
。。。灵魂排版!

lmyalmy
mc3124076548 发表于 2019-9-10 18:40
every 1 tick: 大丈夫?

可以改成3或者更高的
我服务器其实改成了5……因为我服务器的脚本备份就有三五个kb

王聪聪聪聪
表示看不懂,- -应该怎么操作呢

q794613
经测试没有效果 就多了个经验条的流动..

lmyalmy
q794613 发表于 2020-2-8 09:16
经测试没有效果 就多了个经验条的流动..

把on leftclick改成on attack,因为我的服务器是取消了attack事件按左键判定的,自己改了改忘了这茬了,抱歉

HackerRouter
感觉还挺有意思的ovo

mcKaiFuxia
怎么下载啊????

q794613
lmyalmy 发表于 2020-2-26 12:14
把on leftclick改成on attack,因为我的服务器是取消了attack事件按左键判定的,自己改了改忘了这茬了, ...

报错说并没有这个事件
understand the event 'on attack'

TUCAOEVER
every 1 tick 必然导致卡服 建议改变思路进行编写 例如使用 单独的 while 循环

北梦丶
除了食用教程,有没有使用图片啊 gif啥的

lmyalmy
TUCAOEVER 发表于 2020-3-7 23:06
every 1 tick 必然导致卡服 建议改变思路进行编写 例如使用 单独的 while 循环

我发现了,现在服务器已经不再使用这种卡主线程的办法了
当时是刚学skript,啥都不会弄

lmyalmy
q794613 发表于 2020-3-6 23:36
报错说并没有这个事件
understand the event 'on attack'

sorry, I said it wrong
on damage:
      if damager is a player:
然后这里放语句