切换风格

默认晚霞 雪山 粉色心情 伦敦 花卉 绿野仙踪 加州 白云 星空 薰衣草 城市 简约黑色 龙珠
回复 0

2

主题

4

帖子

80

积分

论坛萌新

Rank: 1

积分
80
人气
2 点
钻石粒
130 粒
贡献
0 点
论坛币
15 个
爱心
0 点

论坛注册会员

[1.12.2/1.7.10]快速使用的经验材料——全部使用![复制链接]
发表于 2019-7-13 13:17:56 | 显示全部楼层 |阅读模式
脚本例子
脚本版本: 1.1
适用版本: 1.12.2 1.7.10 
编写语言: ECMA(JS)
最后更新: 2019-07-13
代码版权: 弱版权

请注册论坛会员,已便查看高清图片!

您需要 登录 才可以下载或查看,没有帐号?立即注册

x
本帖最后由 赫尔 于 2019-7-13 13:44 编辑

不多废话直接上代码下面是1.12.2的(点npc使用)
  1. //1.12.2
  2. function interact(e){
  3. var player=e.player;
  4. if(player.getMainhandItem() !== null){
  5. var wp = player.getMainhandItem().getDisplayName();
  6. var count=player.getMainhandItem().getStackSize();
  7. if(wp == "§8§l5经验"){
  8.         var exp = count*5;
  9. npc.executeCommand("xp "+ exp +" "+player.getName());
  10. player.removeItem(player.getMainhandItem().getName(),count);
  11. player.message("兑换成功"+ exp +"经验");
  12. }
  13. if(wp == "§8§l20经验"){
  14.         var exp = count*20;
  15. npc.executeCommand("xp "+ exp +" "+player.getName());
  16. player.removeItem(player.getMainhandItem().getName(),count);
  17. player.message("兑换成功"+ exp +"经验");
  18. }
  19. if(wp == "§8§l80经验"){
  20.         var exp = count*80;
  21. npc.executeCommand("xp "+ exp +" "+player.getName());
  22. player.removeItem(player.getMainhandItem().getName(),count);
  23. player.message("兑换成功"+ exp +"经验");
  24. }
  25. if(wp == "§8§l250经验"){
  26.         var exp = count*250;
  27. npc.executeCommand("xp "+ exp +" "+player.getName());
  28. player.removeItem(player.getMainhandItem().getName(),count);
  29. player.message("兑换成功"+ exp +"经验");
  30. }
  31. if(wp == "§8§l400经验"){
  32.         var exp = count*400;
  33. npc.executeCommand("xp "+ exp +" "+player.getName());
  34. player.removeItem(player.getMainhandItem().getName(),count);
  35. player.message("兑换成功"+ exp +"经验");
  36. }
  37. if(wp == "§7§l800经验"){
  38.         var exp = count*800;
  39. npc.executeCommand("xp "+ exp +" "+player.getName());
  40. player.removeItem(player.getMainhandItem().getName(),count);
  41. player.message("兑换成功"+ exp +"经验");
  42. }
  43. if(wp == "§7§l1000经验"){
  44.         var exp = count*1000;
  45. npc.executeCommand("xp "+ exp +" "+player.getName());
  46. player.removeItem(player.getMainhandItem().getName(),count);
  47. player.message("兑换成功"+ exp +"经验");
  48. }
  49. if(wp == "§71800经验"){
  50.         var exp = count*1800;
  51. npc.executeCommand("xp "+ exp +" "+player.getName());
  52. player.removeItem(player.getMainhandItem().getName(),count);
  53. player.message("兑换成功"+ exp +"经验");
  54. }
  55. if(wp == "§718000经验"){
  56.         var exp = count*18000;
  57. npc.executeCommand("xp "+ exp +" "+player.getName());
  58. player.removeItem(player.getMainhandItem().getName(),count);
  59. player.message("兑换成功"+ exp +"经验");
  60. }
  61. if(wp == "§d180000经验"){
  62.         var exp = count*180000;
  63. npc.executeCommand("xp "+ exp +" "+player.getName());
  64. player.removeItem(player.getMainhandItem().getName(),count);
  65. player.message("兑换成功"+ exp +"经验");
  66. }else{
  67.        
  68. }
  69. }else{player.message("您的手中没有物品");}
  70. }
复制代码


1.7.10(点npc使用):
  1. //1.7.10放在对话里
  2. if(player.getHeldItem() !== null){
  3. var wp = player.getHeldItem().getDisplayName();
  4. var count=player.getHeldItem().getStackSize();
  5. if(wp == "§8§l5经验"){
  6.         var exp = count*5;
  7. npc.executeCommand("xp "+ exp +" "+player.getName());
  8. player.removeItem(player.getHeldItem().getName(),0,count);
  9. player.sendMessage("兑换成功"+ exp +"经验");
  10. }
  11. if(wp == "§8§l20经验"){
  12.         var exp = count*20;
  13. npc.executeCommand("xp "+ exp +" "+player.getName());
  14. player.removeItem(player.getHeldItem().getName(),0,count);
  15. player.sendMessage("兑换成功"+ exp +"经验");
  16. }
  17. if(wp == "§8§l80经验"){
  18.         var exp = count*80;
  19. npc.executeCommand("xp "+ exp +" "+player.getName());
  20. player.removeItem(player.getHeldItem().getName(),0,count);
  21. player.sendMessage("兑换成功"+ exp +"经验");
  22. }
  23. if(wp == "§8§l250经验"){
  24.         var exp = count*250;
  25. npc.executeCommand("xp "+ exp +" "+player.getName());
  26. player.removeItem(player.getHeldItem().getName(),0,count);
  27. player.sendMessage("兑换成功"+ exp +"经验");
  28. }
  29. if(wp == "§8§l400经验"){
  30.         var exp = count*400;
  31. npc.executeCommand("xp "+ exp +" "+player.getName());
  32. player.removeItem(player.getHeldItem().getName(),0,count);
  33. player.sendMessage("兑换成功"+ exp +"经验");
  34. }
  35. if(wp == "§7§l800经验"){
  36.         var exp = count*800;
  37. npc.executeCommand("xp "+ exp +" "+player.getName());
  38. player.removeItem(player.getHeldItem().getName(),0,count);
  39. player.sendMessage("兑换成功"+ exp +"经验");
  40. }
  41. if(wp == "§7§l1000经验"){
  42.         var exp = count*1000;
  43. npc.executeCommand("xp "+ exp +" "+player.getName());
  44. player.removeItem(player.getHeldItem().getName(),0,count);
  45. player.sendMessage("兑换成功"+ exp +"经验");
  46. }
  47. if(wp == "§71800经验"){
  48.         var exp = count*1800;
  49. npc.executeCommand("xp "+ exp +" "+player.getName());
  50. player.removeItem(player.getHeldItem().getName(),0,count);
  51. player.sendMessage("兑换成功"+ exp +"经验");
  52. }
  53. if(wp == "§718000经验"){
  54.         var exp = count*18000;
  55. npc.executeCommand("xp "+ exp +" "+player.getName());
  56. player.removeItem(player.getHeldItem().getName(),0,count);
  57. player.sendMessage("兑换成功"+ exp +"经验");
  58. }
  59. if(wp == "§d180000经验"){
  60.         var exp = count*180000;
  61. npc.executeCommand("xp "+ exp +" "+player.getName());
  62. player.removeItem(player.getHeldItem().getName(),0,count);
  63. player.sendMessage("兑换成功"+ exp +"经验");
  64. }else{
  65.        
  66. }
  67. }else{player.sendMessage("您的手中没有物品");}
复制代码



1.12.2(脚本物品):
  1. 没好
复制代码



评分

参与人数 1人气 -1 收起 理由
Hueihuea -1 版权声明

查看全部评分

null
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

QQ|Archiver|手机版|小黑屋|自定义NPC脚本中文论坛 ( 蜀ICP备17005795号-3 )

GMT+8, 2020-7-3 02:52 , Processed in 0.112378 second(s), 37 queries .

Powered by Discuz! X3.4

© 2001-2013 Comsenz Inc.

返回顶部