设为首页收藏本站|繁體中文

Project1

 找回密码
 注册会员
搜索
查看: 2110|回复: 2
打印 上一主题 下一主题

[已经解决] 1为什么这脚本我就是不能用呢?(十万个为什么脚本篇)谢谢00

[复制链接]

Lv3.寻梦者

梦石
0
星屑
1015
在线时间
423 小时
注册时间
2010-12-26
帖子
337
跳转到指定楼层
1
发表于 2012-8-6 11:37:58 | 只看该作者 |只看大图 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 358429534 于 2012-8-6 19:34 编辑

要怎么样才能正常使用呢?
魔王地图传送到城下地图操作如下








结果与NPC对话就这样了?







以下是范例脚本
  1. #==============================================================================
  2. #   XaiL System - Teleport
  3. #   Author: Nicke
  4. #   Created: 10/01/2012
  5. #   Edited: 11/01/2012
  6. #   Version: 1.0
  7. #==============================================================================
  8. # Instructions
  9. # -----------------------------------------------------------------------------
  10. # To install this script, open up your script editor and copy/paste this script
  11. # to an open slot below ▼ Materials but above ▼ Main. Remember to save.
  12. #
  13. # To call this scene in a menu or on the map simply use the following code:
  14. # SceneManager.call(Scene_Teleport)
  15. #
  16. # To add/del a teleport from the TP_LIST, do this in a script call:
  17. # tp(id, type, enabled = true)
  18. # Examples:
  19. # tp(2, :add)  # This will add id 2.
  20. # tp(2, :del)  # This will delete id 1.
  21. #
  22. # To check if id is added or enabled/disabled do the following, preferably in a
  23. # conditional branch:
  24. # tp_added?(id)
  25. # tp_enable?(id)
  26. # Examples:
  27. # tp_added?(2)  # Is id 2 added?
  28. # tp_enabled?(1)  # Is id 1 enabled?
  29. # !tp_enabled?(3) # Same method used but returns true if it is disabled.
  30. #
  31. # To enable/disabling an id do like this:
  32. # tp_enable(1, true)  # Enable id 1.
  33. # tp_enable(2, false) # Disable id 2.
  34. #
  35. # If you want to add/delete all the id's in the list use this method:
  36. # Note: This method uses the normal way of adding a tp. I created this method
  37. # to save some space when adding a large amount of id's.
  38. # tp_all(:add) # Add all id's.
  39. # tp_all(:del) # Remove all id's.
  40. #
  41. # Read the settings carefully when setting up new teleport location as well as
  42. # how to change certain settings. Make sure you change the settings as you
  43. # want them and hopefully you will be pleased. Enjoy!
  44. #
  45. # *** Only for RPG Maker VX Ace. ***
  46. #==============================================================================
  47. ($imported ||= {})["XS-TELEPORT-SCENE"] = true

  48. module XAIL
  49.   module TELEPORT
  50.         #--------------------------------------------------------------------------#
  51.         # * Settings
  52.         #--------------------------------------------------------------------------#
  53.         # TP_FONT = [ name, size, color, bold, italic, shadow ]
  54.         # Bare in mind that if italic is on, it might look weird depending on font
  55.         # choice as well as the size.
  56.         TP_CMD_FONT = [["Verdana"], 16, Color.new(255,255,255), true, false, false]
  57.         TP_INFO_FONT = [["Verdana"], 14, Color.new(155,205,205), true, false, true]

  58.         # The windowskin to use for the windows. Set to nil to disable.
  59.         # SKIN = string
  60.         SKIN = nil

  61.         # Use this template when adding a long string to the map details.
  62.         # Use \n to get to a new line.
  63.         # TP_INFO_ID = LONG_STRING
  64.         TP_INFO_1 = "这是王城的街区"
  65.         TP_INFO_2 = "位于魔王城堡下的著名地带"
  66.         TP_INFO_3 = "充满魔力的神奇地方"

  67.         # How many lines the info window should display.
  68.         # If you do have long strings in the info I suggest change this.
  69.         # TP_INFO_LINES = number
  70.         TP_INFO_LINES = 3

  71.         # Sets the padding of the text in the info window.
  72.         TP_INFO_PADDING = 10 # Default: 12.

  73.         # TELEPORT_LIST:
  74.         # ID = [ 'Title', :symbol, map_id, x & y, map_image(nil), map_info(nil), enabled ]
  75.         TP_LIST = [] # Don't remove!
  76.         TP_LIST[0] = ['城下小镇', :kris_map,  69, [93,113], "城下小镇", TP_INFO_1, true]
  77.         TP_LIST[1] = ['市场',  :market_map,  69, [68,124],"市场", TP_INFO_2, true]
  78.         TP_LIST[2] = ['神奇小镇', :disabled, 69, [53,93],"神奇小镇", TP_INFO_3, true]

  79.         # Display texts. Should be easy enough to understand what they are for.
  80.         TEXT_NO_TELEPORTS = "You haven't found a location to teleport to."
  81.         OK_NAME = "传送" # Dialog box ok.
  82.         OK_CANCEL = "取消" # Dialog box cancel.

  83.         # Transition, nil to use default.
  84.         # TRANSITION [ SPEED, TRANSITION, OPACITY ]
  85.         # TRANSITION = [20, "Graphics/Transitions/1", 50]
  86.         TRANSITION = nil

  87.         # Menu background image (System folder)
  88.         # Note: You might want to decrease the opacity as well as arrange
  89.         # the windows so that you can properly see the background.
  90.         # Set to nil to use default.
  91.         BACK = nil

  92.         # Should a animation be used when teleporting to a new map.
  93.         # Set it to nil to disable it.
  94.         ANIM_ID = 81

  95.         # Fade out time when teleporting to a new map.
  96.         # 1000 (1 second)
  97.         # ANIM_SCENE_FADE/ANIM_AUDIO_FADE = number
  98.         ANIM_SCENE_FADE = 500  # Fade out time for scene.
  99.         ANIM_AUDIO_FADE = 500  # Fade out time for audio.

  100.   end
  101. end
  102. # *** Don't edit below unless you know what you are doing. ***
  103. #==============================================================================#
  104. # ** Game_System
  105. #------------------------------------------------------------------------------
  106. #  Method for checking the teleport list.
  107. #==============================================================================#
  108. class Game_System

  109.   attr_accessor :tp_list

  110.   alias xail_teleport_sys_initialize initialize
  111.   def initialize(*args, &block)
  112.         xail_teleport_sys_initialize(*args, &block)
  113.         @tp_list = []
  114.   end

  115. end
  116. #==============================================================================#
  117. # ** Game_Interpreter
  118. #------------------------------------------------------------------------------
  119. #  Method for adding and deleting a teleport.
  120. #==============================================================================#
  121. class Game_Interpreter

  122.   def tp(id, type)  
  123.         # // Method to add a item to the list.  
  124.         case type
  125.           when :add # // Add teleport id.
  126.           unless $game_system.tp_list.include?(XAIL::TELEPORT::TP_LIST[id])
  127.                 $game_system.tp_list.push(XAIL::TELEPORT::TP_LIST[id])
  128.           end unless XAIL::TELEPORT::TP_LIST[id].nil?
  129.           when :del # // Remove teleport id.
  130.           unless XAIL::TELEPORT::TP_LIST[id].nil?
  131.                 $game_system.tp_list.delete(XAIL::MENU::TP_LIST[id])
  132.           end
  133.         end
  134.   end

  135.   def tp_enabled?(id)
  136.         # // Method to check if id is enabled.
  137.         # (Must be added in the list or else it returns nil).
  138.         return if $game_system.tp_list[id].nil?
  139.         return $game_system.tp_list[id][6]
  140.   end

  141.   def tp_added?(id)
  142.         # // Method to check if id is added.
  143.         return $game_system.tp_list[id]
  144.   end

  145.   def tp_enable(id, enabled)
  146.         # // Method to enable id.
  147.         $game_system.tp_list[id][6] = enabled
  148.   end

  149.   def tp_all(type = :add)
  150.         # // Method to add/delete all teleport id's.
  151.         id = 0
  152.         while id < XAIL::TELEPORT::TP_LIST.size
  153.           case type
  154.           when :add
  155.                 tp(id, :add)
  156.           else
  157.                 tp(id, :del)
  158.           end
  159.           id += 1
  160.         end
  161.   end

  162. end
  163. #==============================================================================#
  164. # ** Window_TeleportCommand
  165. #------------------------------------------------------------------------------
  166. #  New Window :: Window_TeleportCommand - A window for creating the commands.
  167. #==============================================================================#
  168. class Window_TeleportCommand < Window_Command

  169.   def window_width
  170.         # // Method to return the width.
  171.         return 140
  172.   end

  173.   def window_height
  174.         # // Method to return the height.
  175.         return Graphics.height
  176.   end

  177.   def menu_color(color, enabled = true)
  178.          # // Method to set the color and alpha if not enabled.
  179.         contents.font.color.set(color)
  180.         contents.font.color.alpha = 100 unless enabled
  181.   end

  182.   def draw_item(index)
  183.         # // Method to draw the command item.
  184.         contents.font.name = XAIL::TELEPORT::TP_CMD_FONT[0]
  185.         contents.font.size = XAIL::TELEPORT::TP_CMD_FONT[1]
  186.         menu_color(XAIL::TELEPORT::TP_CMD_FONT[2], menu_enabled?(index))
  187.         contents.font.bold = XAIL::TELEPORT::TP_CMD_FONT[3]
  188.         contents.font.italic = XAIL::TELEPORT::TP_CMD_FONT[4]
  189.         contents.font.shadow = XAIL::TELEPORT::TP_CMD_FONT[5]
  190.         draw_text(item_rect_for_text(index), command_name(index), alignment)
  191.         reset_font_settings
  192.   end

  193.   def menu_enabled?(index)
  194.         # // Method to check if item is enabled.
  195.         return @tp_list[index][6]
  196.   end

  197.   alias xail_mk_cmd_list_tp make_command_list
  198.   def make_command_list(*args, &block)
  199.         # // Method to add the commands.
  200.         xail_mk_cmd_list_tp(*args, &block)
  201.         @tp_list = $game_system.tp_list
  202.         for i in @tp_list
  203.           add_command(i[0], i[1], i[6])
  204.         end
  205.   end

  206. end
  207. #==============================================================================#
  208. # ** Window_tpInfo
  209. #==============================================================================#
  210. class Window_OK_Command < Window_Command

  211.   def window_width
  212.         # // Method to return the width.
  213.         return 120
  214.   end

  215.   def alignment
  216.         # // Method to return the alignment.
  217.         return 1
  218.   end

  219.   alias xail_mk_cmd_list_ok make_command_list
  220.   def make_command_list(*args, &block)
  221.         # // Method to add the commands.
  222.         xail_mk_cmd_list_ok(*args, &block)
  223.         add_command(XAIL::TELEPORT::OK_NAME, :ok)
  224.         add_command(XAIL::TELEPORT::OK_CANCEL, :cancel)
  225.   end

  226. end
  227. #==============================================================================#
  228. # ** Window_tpInfo
  229. #==============================================================================#
  230. class Window_tpInfo < Window_Base

  231.   def initialize(x, y, width, height)
  232.         # // Method to initialize the window.
  233.         super(0, 0, width, window_height)
  234.         @tp_list = $game_system.tp_list
  235.         refresh
  236.   end

  237.   def set_text(text, enabled)
  238.         # // Method to set a new the tp text to the window.
  239.         if text != @text
  240.           @text = text
  241.           menu_color(XAIL::TELEPORT::TP_INFO_FONT[2], enabled)
  242.           refresh
  243.         end
  244.   end

  245.   def window_height
  246.         # // Method to return the height.
  247.         return fitting_height(XAIL::TELEPORT::TP_INFO_LINES)
  248.   end

  249.   def standard_padding
  250.         # // Method to set the padding for text.
  251.         return XAIL::TELEPORT::TP_INFO_PADDING
  252.   end

  253.   def refresh
  254.         # // Method to refresh the window.
  255.         contents.clear
  256.         draw_tp_text
  257.   end

  258.   def menu_color(color, enabled = true)
  259.          # // Method to set the color and alpha if not enabled.
  260.         contents.font.color.set(color)
  261.         contents.font.color.alpha = 150 unless enabled
  262.   end

  263.   def draw_tp_ex(x, y, text)
  264.         # // Special method to draw a text.
  265.         text = convert_escape_characters(text)
  266.         pos = {:x => x, :y => y, :new_x => x, :height => calc_line_height(text)}
  267.         process_character(text.slice!(0, 1), text, pos) until text.empty?
  268.   end

  269.   def draw_tp_text
  270.         # // Method to draw the tp text to the window.
  271.         contents.font.name = XAIL::TELEPORT::TP_INFO_FONT[0]
  272.         contents.font.size = XAIL::TELEPORT::TP_INFO_FONT[1]
  273.         contents.font.bold = XAIL::TELEPORT::TP_INFO_FONT[3]
  274.         contents.font.italic = XAIL::TELEPORT::TP_INFO_FONT[4]
  275.         contents.font.shadow = XAIL::TELEPORT::TP_INFO_FONT[5]
  276.         draw_tp_ex(0, 0, @text)
  277.         reset_font_settings
  278.   end

  279. end
  280. #==============================================================================#
  281. # ** Window_tpImage
  282. #==============================================================================#
  283. class Window_tpImage < Window_Base

  284.   def initialize(x, y, width, height)
  285.         # // Method to initialize the window.
  286.         super(0, 0, width, height)
  287.         refresh
  288.   end

  289.   def refresh
  290.         # // Method to refresh the window.
  291.         contents.clear
  292.   end

  293.   def draw_tp_map(x, y, source, enabled = true)
  294.         # // Method to draw the teleport map.
  295.         rect = Rect.new(0, 0, Graphics.width, Graphics.height)
  296.         return clear_tp_map(rect) if source.nil?
  297.         clear_tp_map(rect)
  298.         tp_map = Cache.picture(source)
  299.         contents.blt(x, y, tp_map, rect, enabled ? 255 : 150)
  300.   end

  301.   def clear_tp_map(rect)
  302.         contents.clear_rect(rect)
  303.   end

  304. end
  305. #==============================================================================#
  306. # ** Scene_TeleportBase
  307. #------------------------------------------------------------------------------
  308. #  New Scene :: Scene_TeleportBase - The teleport scene.
  309. #==============================================================================#
  310. class Scene_TeleportBase < Scene_Base

  311.   alias xail_tpbase_start start
  312.   def start(*args, &block)
  313.         # // Method to start the scene
  314.         xail_tpbase_start(*args, &block)
  315.         @tp_list = $game_system.tp_list
  316.         create_background
  317.   end

  318.   def post_start
  319.         # // Method to post_start the scene.
  320.         perform_transition unless @tp_list.empty?
  321.   end

  322.   alias xail_tpbase_terminate terminate
  323.   def terminate(*args, &block)
  324.         # // Method to terminate the scene.
  325.         xail_tpbase_terminate(*args, &block)
  326.   end

  327.   def create_background
  328.         # // Method to create the background.
  329.         @background_sprite = Sprite.new
  330.         if XAIL::TELEPORT::BACK.nil?
  331.           @background_sprite.bitmap = SceneManager.background_bitmap
  332.           @background_sprite.color.set(16, 16, 16, 128)
  333.         else
  334.           @background_sprite.bitmap = Cache.system(XAIL::TELEPORT::BACK)
  335.         end
  336.   end

  337.   def perform_transition
  338.         # // Method to create the transition.
  339.         if XAIL::TELEPORT::TRANSITION.nil?
  340.           Graphics.transition(15)
  341.         else
  342.           Graphics.transition(XAIL::TELEPORT::TRANSITION[0],XAIL::TELEPORT::TRANSITION[1],XAIL::TELEPORT::TRANSITION[2])
  343.         end
  344.   end

  345. end
  346. #==============================================================================#
  347. # ** Scene_Teleport
  348. #------------------------------------------------------------------------------
  349. #  New Scene :: Scene_Teleport - The teleport scene.
  350. #==============================================================================#
  351. class Scene_Teleport < Scene_TeleportBase

  352.   alias xail_tpbase_init initialize
  353.   def initialize(*args, &block)
  354.         # // Method to initialize scene teleport.
  355.         xail_tpbase_init(*args, &block)
  356.         @tp_list = $game_system.tp_list
  357.   end

  358.   def start
  359.         # // Method to start scene teleport.
  360.         super
  361.         return command_map if @tp_list.empty?
  362.         create_tp_command_window
  363.         create_tp_info
  364.         create_tp_image
  365.         on_index_change(0) # // Draw id 0 when scene is loaded.
  366.   end

  367.   def create_tp_command_window
  368.         # // Method to create command list window.
  369.         @command_window = Window_TeleportCommand.new(0, 0)
  370.         @command_window.windowskin = Cache.system(XAIL::TELEPORT::SKIN) unless XAIL::TELEPORT::SKIN.nil?
  371.         @command_window.x = 0
  372.         @command_window.y = 0
  373.         for i in @tp_list
  374.           @command_window.set_handler(i[1], method(:command_ok_dialog))
  375.         end
  376.         @command_window.set_handler(:cancel, method(:return_scene))
  377.   end

  378.   def create_ok__window
  379.         # // Method to create ok command window.
  380.         @ok_window = Window_OK_Command.new(0, 0)
  381.         @ok_window.windowskin = Cache.system(XAIL::TELEPORT::SKIN) unless XAIL::TELEPORT::SKIN.nil?
  382.         @ok_window.x = (Graphics.width - @ok_window.width) / 2
  383.         @ok_window.y = (Graphics.height - @ok_window.height) / 2
  384.         @ok_window.set_handler(:ok, method(:command_teleport))
  385.         @ok_window.set_handler(:cancel, method(:command_cancel_dialog))
  386.   end

  387.   def create_tp_info
  388.         # // Method to create teleport info window.
  389.         width = Graphics.width - @command_window.width
  390.         height = 80
  391.         @tp_info = Window_tpInfo.new(0, 0, width, height)
  392.         @tp_info.windowskin = Cache.system(XAIL::TELEPORT::SKIN) unless XAIL::TELEPORT::SKIN.nil?
  393.         @tp_info.x = @command_window.width
  394.         @tp_info.y = 0
  395.   end

  396.   def create_tp_image
  397.         # // Method to create teleport image window.
  398.         width = Graphics.width - @command_window.width
  399.         height = Graphics.height - @tp_info.height
  400.         @tp_image_window = Window_tpImage.new(0, 0, width, height)
  401.         @tp_image_window.windowskin = Cache.system(XAIL::TELEPORT::SKIN) unless XAIL::TELEPORT::SKIN.nil?
  402.         @tp_image_window.x = @command_window.width
  403.         @tp_image_window.y = @tp_info.height
  404.   end

  405.   def create_tp_message_window
  406.         # // Method to create the message window.
  407.         @message_window = Window_Message.new
  408.   end

  409.   def command_ok_dialog
  410.         # // Method to open ok dialog.
  411.         create_ok__window
  412.   end

  413.   def command_cancel_dialog
  414.         # // Method to close ok dialog.
  415.         @ok_window.close
  416.         @command_window.active = true
  417.   end

  418.   def command_teleport
  419.         # // Method to teleport the player.
  420.         teleport_player(@command_window.index)
  421.   end

  422.   def command_map
  423.         # // command_map (Don't remove)
  424.         create_tp_message_window
  425.         $game_message.texts << XAIL::TELEPORT::TEXT_NO_TELEPORTS
  426.         SceneManager.call(Scene_Map)
  427.   end

  428.   def teleport_player(index)
  429.         # // Method for teleporting the player to the spawn event. (if exists)
  430.         $game_map.setup(@tp_list[index][2])
  431.         $game_player.moveto(@tp_list[index][3][0], @tp_list[index][3][1])
  432.         fadeout_scene
  433.         $game_map.autoplay
  434.         $game_map.refresh
  435.         $game_player.animation_id = XAIL::TELEPORT::ANIM_ID unless XAIL::TELEPORT::ANIM_ID.nil?
  436.         $game_switches[213] = true
  437.         SceneManager.call(Scene_Map)
  438.   end

  439.   def fadeout_scene
  440.         time = XAIL::TELEPORT::ANIM_AUDIO_FADE
  441.         # // Method to fade out the scene.
  442.         RPG::BGM.fade(time)
  443.         RPG::BGS.fade(time)
  444.         RPG::ME.fade(time)
  445.         Graphics.fadeout(XAIL::TELEPORT::ANIM_SCENE_FADE * Graphics.frame_rate / 1000)
  446.         RPG::BGM.stop
  447.         RPG::BGS.stop
  448.         RPG::ME.stop
  449.   end

  450.   def draw_tp_image(index)
  451.         # // Draw teleport image.
  452.         image = @tp_list[index][4]
  453.         enabled = @tp_list[index][6]
  454.         @tp_image_window.draw_tp_map(0, 0, image, enabled)
  455.   end

  456.   def draw_tp_info(index)
  457.         # // Draw teleport details.
  458.         title = @tp_list[index][0]
  459.         info = @tp_list[index][5]
  460.         enabled = @tp_list[index][6]
  461.         text = "#{title}\n#{info}" unless @tp_list[index][5].nil?
  462.         @tp_info.set_text(text, enabled)
  463.   end

  464.   alias update_new_index_check update
  465.   def update(*args, &block)
  466.         # // Method for updating the scene.
  467.         old_index = @command_window.index
  468.         update_new_index_check(*args, &block)
  469.         on_index_change(@command_window.index) if old_index != @command_window.index
  470.   end

  471.   def on_index_change(index)
  472.         # // If index changes redraw the image and info.
  473.         draw_tp_image(index)
  474.         draw_tp_info(index)
  475.   end

  476. end # END OF FILE

  477. #=*==========================================================================*=#
  478. # ** END OF FILE
  479. #=*==========================================================================*=#
复制代码
摘自《暗悲传》
某人
天啊!我无骂无打怎么这么多的狗,每天都要来咬我呢?......天理何在
某人
在路上看到了许多行人说道我眼前怎么全是无肺黑心肝在行走呢?
某人
有时被整的实在是受不了,很想杀狗,看看他们的心脏是黑的吗?
某人
我很喜欢黑夜与下雨,或许我只能在虚拟世界能过上一般人的生活......
某人
无论别人无良心骂我,诅咒死,刻意整蛊......希望能坚持活着!要永远记住那些人的奸诈嘴脸!
某人
又有谁能出来主持公道呢?谁能理解你,谁能站出来说句话.....他是无辜又悲苦......这真是无聊的故事吗?

Lv1.梦旅人

梦石
0
星屑
49
在线时间
491 小时
注册时间
2012-1-27
帖子
421

整合系统大赛RMVA达人

2
发表于 2012-8-6 19:16:24 | 只看该作者
tp(0, :add)
SceneManager.call(Scene_Teleport)

回复

使用道具 举报

Lv3.寻梦者

梦石
0
星屑
1015
在线时间
423 小时
注册时间
2010-12-26
帖子
337
3
 楼主| 发表于 2012-8-6 19:33:20 | 只看该作者
狱冥幻翼 发表于 2012-8-6 19:16
tp(0, :add)
SceneManager.call(Scene_Teleport)

你好,又见面了!谢谢!成功了!我虽然分不是很多,但是这次会追加到400(原来是300的给予上次的补偿)。希望大大有时间可以多帮帮我们这些苦B脚本盲,谢谢!其实上次的加点是没啥问题的要用事件调用分别可以加队伍的1到4人其他BUG还没仔细测试!还可以在问你点问题吗?
http://rpg.blue/forum.php?mod=vi ... D476%26typeid%3D476

点评

好好学英文吧……注释上有使用方法  发表于 2012-8-6 19:37
摘自《暗悲传》
某人
天啊!我无骂无打怎么这么多的狗,每天都要来咬我呢?......天理何在
某人
在路上看到了许多行人说道我眼前怎么全是无肺黑心肝在行走呢?
某人
有时被整的实在是受不了,很想杀狗,看看他们的心脏是黑的吗?
某人
我很喜欢黑夜与下雨,或许我只能在虚拟世界能过上一般人的生活......
某人
无论别人无良心骂我,诅咒死,刻意整蛊......希望能坚持活着!要永远记住那些人的奸诈嘴脸!
某人
又有谁能出来主持公道呢?谁能理解你,谁能站出来说句话.....他是无辜又悲苦......这真是无聊的故事吗?
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 注册会员

本版积分规则

拿上你的纸笔,建造一个属于你的梦想世界,加入吧。
 注册会员
找回密码

站长信箱:[email protected]|手机版|小黑屋|无图版|Project1游戏制作

GMT+8, 2024-4-30 08:04

Powered by Discuz! X3.1

© 2001-2013 Comsenz Inc.

快速回复 返回顶部 返回列表