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

Project1

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

[转载] 【vx脚本】主角选择画面+获取技能物品作用对象

[复制链接]

Lv1.梦旅人

梦石
0
星屑
180
在线时间
829 小时
注册时间
2010-6-26
帖子
671
跳转到指定楼层
1
发表于 2010-11-9 21:17:38 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式

加入我们,或者,欢迎回来。

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

x
本帖最后由 企鹅达达 于 2010-11-14 20:43 编辑

两个扩展性很好的脚本。非常简单好用。
1. 队伍中的主角选择画面,选择结果(主角id及队伍序号)带入变量(默认19、20号变量,66、68行更改)。使用方法 $scene = Scene_ActorChoice.new
  1. #==============================================================================
  2. # ■ Scene_ActorChoice
  3. #------------------------------------------------------------------------------
  4. # アクターの選択後、選択したアクターのID、選択時のインデックスを變數に代入します。
  5. #
  6. #「使用方法」
  7. # イベントコマンドのスクリプトで、$scene = Scene_ActorChoice.new記入
  8. # 使用時のウィンドウは Window_MenuStatus を使用しました。
  9. # 變數にアクターIDや選択時のインデックスを代入した後には条件分岐で使用してください。
  10. # 注意:選択時のインデックスは実際選択したのが何番目とかには関係なく-1をしてください。
  11. # 例)選択時三番目のキャラを選択した時のインデックスは2になります。
  12. #
  13. #「カスタマイズ」
  14. # 66, 68行
  15. # $game_variables[n]の nに 代入する變數IDを記入してください。
  16. #
  17. # ※このスクリプトのベースは Scene_Menu です。
  18. #
  19. #==============================================================================

  20. class Scene_ActorChoice < Scene_Base
  21.   #--------------------------------------------------------------------------
  22.   # ● OBJECTの初期化
  23.   #     menu_index : カーソルの初期位置
  24.   #--------------------------------------------------------------------------
  25.   def initialize(menu_index = 0)
  26.     @status_window_index = menu_index
  27.   end
  28.   #--------------------------------------------------------------------------
  29.   # ● 開示處理
  30.   #--------------------------------------------------------------------------
  31.   def start
  32.     super
  33.     create_menu_background
  34.     @status_windows = Window_MenuStatus.new(0, 0)
  35.     @status_windows.active = true
  36.     @status_windows.index = @status_window_index
  37.   end
  38.   #--------------------------------------------------------------------------
  39.   # ● 終了處理
  40.   #--------------------------------------------------------------------------
  41.   def terminate
  42.     super
  43.     dispose_menu_background
  44.     @status_windows.dispose
  45.   end
  46.   #--------------------------------------------------------------------------
  47.   # ● Update
  48.   #--------------------------------------------------------------------------  
  49.   def update
  50.     super
  51.     update_menu_background
  52.     @status_windows.update
  53.     update_actor_selection_achoice
  54.   end
  55.   #--------------------------------------------------------------------------
  56.   # ● アクター選択の更新
  57.   #--------------------------------------------------------------------------
  58.   def update_actor_selection_achoice
  59.     if Input.trigger?(Input::B)
  60.       Sound.play_cancel
  61.       $scene = Scene_Map.new
  62.     elsif Input.trigger?(Input::C)
  63.       $game_party.last_actor_index = @status_windows.index
  64.       # 19番の變數に選択したキャラの選択時のインテックス(-1)を代入する。
  65.       $game_variables[19] = @status_windows.index
  66.       # 20番の變數に選択したキャラのアクターIDを代入する。
  67.       $game_variables[20] = $game_party.members[@status_windows.index].id
  68.       Sound.play_decision
  69.       $scene = Scene_Map.new
  70.     end
  71.   end
  72. end



  73. ########################################################
  74. # 制作 : dest21c (韓国)    [email protected]          #
  75. ########################################################
复制代码
2. 技能和物品对象获取,可以将作用的主角对象、作用的敌人队伍序号带入变量,用开关判定作用对象为主角还是敌人、技能对象是否成功击中(使用)。脚本中设定两个变量和开关。默认变量11、12,开关13、14
  1. #==============================================================================
  2. #    Record Target Variable
  3. #    Version: 1.0
  4. #    Author: modern algebra (rmrk.net)
  5. #    Date: August 24, 2009
  6. #++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
  7. #  Description:
  8. #
  9. #    This script allows you to save the ID of an actor or enemy targetted by a
  10. #   skill or item to a designated variable. It is perfect for use in
  11. #   Common Events that are called by using items or weapons, as you can add
  12. #   additional effects that effect the target through the common event.
  13. #
  14. #    Note that it only works for targetted items and skills - if the scope has
  15. #   multiple targets, than it will not update the values.
  16. #++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
  17. #  Instructions:
  18. #
  19. #    Place this script above Main and below Materials.
  20. #
  21. #    To choose which variables to use for this script, go down to lines 41 & 43
  22. #   and alter the values of SELECTED_ACTOR_VARIABLE & SELECTED_ENEMY_VARIABLE.
  23. #   Note that when selecting an actor, it saves the ID of the actor, but when
  24. #   selecting an enemy, it returns the INDEX of the enemy in the troop. This
  25. #   follows the lead of event commands in how actors are selected. There are
  26. #   also two switches you can set at lines 46 & 49; TARGET_CLASS_SWITCH_ID
  27. #   records whether the user of the skill is an actor or an enemy, while
  28. #   NOHIT_SWITCH_ID records whether the target was hit by the item or skill.
  29. #
  30. #    Using the script is fairly easy. Simply have the item or skill call a
  31. #   common event, and in that comment you can use the values of the variables
  32. #   and switches to determine the effect.
  33. #==============================================================================

  34. #==============================================================================
  35. # ** Global Constants
  36. #++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
  37. #  new constants - RTV_SELECTED_ACTOR_VARIABLE, RTV_SELECTED_ENEMY_VARIABLE
  38. #==============================================================================
  39. # The ID of the variable to which the selected actor ID will be saved.
  40. RTV_SELECTED_ACTOR_VARIABLE = 11
  41. # The ID of the variable to which the selected enemy INDEX will be saved.
  42. RTV_SELECTED_ENEMY_VARIABLE = 12
  43. # The ID of a switch which tells if the target of a skill is an actor or an enemy
  44. #  ON => Enemy is target; OFF => Actor is target(此处有误,MS是倒过来)
  45. RTV_TARGET_CLASS_SWITCH_ID = 13
  46. # The ID of a switch which records whether or not the skill or item hit its
  47. #  target. ON => Target missed; OFF => Target hit
  48. RTV_NOHIT_SWITCH_ID = 14

  49. #==============================================================================
  50. # ** Game_Battler
  51. #++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
  52. #  Summary of Changes:
  53. #    aliased method - item_effect, skill_effect
  54. #==============================================================================

  55. class Game_Battler
  56.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  57.   # * Item Effect
  58.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  59.   alias modnalgb_st_efctitm_actrvar_0bg3 item_effect
  60.   def item_effect (user, item, *args)
  61.     # Run Original Method
  62.     modnalgb_st_efctitm_actrvar_0bg3 (user, item, *args)
  63.     rtv_set_target_to_variable (item)
  64.   end
  65.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  66.   # * Skill Effect
  67.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  68.   alias algabramod_skleffect_rtv_3jc2 skill_effect
  69.   def skill_effect (user, skill, *args)
  70.     # Run Original Method
  71.     algabramod_skleffect_rtv_3jc2 (user, skill, *args)
  72.     rtv_set_target_to_variable (skill)
  73.   end
  74.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  75.   # Set Target to Variable
  76.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  77.   def rtv_set_target_to_variable (item)
  78.     if item.for_one?
  79.       if self.actor?
  80.         $game_variables[RTV_SELECTED_ACTOR_VARIABLE] = self.id
  81.         $game_switches[RTV_TARGET_CLASS_SWITCH_ID] = true
  82.       else
  83.         $game_variables[RTV_SELECTED_ENEMY_VARIABLE] = self.index
  84.         $game_switches[RTV_TARGET_CLASS_SWITCH_ID] = false
  85.       end
  86.       $game_switches[RTV_NOHIT_SWITCH_ID] = @missed || @evaded
  87.     end
  88.   end
  89. end
复制代码
Project1.rar (240.75 KB, 下载次数: 401)
新手们!不要被看扁了!我们也会用论坛搜索,我们也会自己找脚本,我们也会自己点击关闭按钮旁边的小问号!

Lv4.逐梦者

醉啸 长风万里

梦石
0
星屑
6057
在线时间
6586 小时
注册时间
2007-12-16
帖子
4501

贵宾

2
发表于 2010-11-14 18:37:33 | 只看该作者
建议咱发个工程

点评

发上来了,如果看了的人想不到怎么扩展,那我也懒得说了。=.=  发表于 2010-11-14 20:44

还在龟速填坑中
回复 支持 反对

使用道具 举报

Lv1.梦旅人

梦石
0
星屑
180
在线时间
829 小时
注册时间
2010-6-26
帖子
671
3
 楼主| 发表于 2010-11-14 19:42:18 | 只看该作者
回复 仲秋启明 的帖子

既然你用的是“咱”,那就麻烦你了;P

点评

我都没看明白这个脚本  发表于 2010-11-14 20:09
新手们!不要被看扁了!我们也会用论坛搜索,我们也会自己找脚本,我们也会自己点击关闭按钮旁边的小问号!
回复 支持 反对

使用道具 举报

Lv1.梦旅人

风雪夜不归人

梦石
0
星屑
50
在线时间
276 小时
注册时间
2006-3-7
帖子
6721

贵宾

4
发表于 2010-11-16 12:02:23 | 只看该作者
有奇妙作用的脚本……
有些人,到了七八月份就会诈尸。
宫斗,是女生永远的爱。
冷门,是本人不变的欲。
作弊,是玩家自由的痛。
练级,是橙光割舍的情。
回复 支持 反对

使用道具 举报

Lv1.梦旅人

小小的百鬼夜行<

梦石
0
星屑
54
在线时间
579 小时
注册时间
2010-7-29
帖子
2682

贵宾

5
发表于 2010-11-16 20:12:13 | 只看该作者
是的呀是的呀..
原来以为地球村是个没内涵的地方- - 看来我错了= =
某只PHP/HTML小白鼠→退屈の间


Cause I knew you were trouble when you walked in
So shame is on me now
I flow me to place i ve never been
till you put me down oh
Now Im lying on the cold hard ground
回复 支持 反对

使用道具 举报

Lv2.观梦者

花开堪折直须折

梦石
0
星屑
631
在线时间
943 小时
注册时间
2010-7-17
帖子
4963

贵宾

6
发表于 2010-12-5 22:04:13 | 只看该作者
看帖不回是罪人。。阿门!
大家好,我叫节操,有一天,我被吃了。
http://forever-dream.5d6d.com
永恒の梦制作组论坛

129993099
永恒の梦制作组QQ群
回复 支持 反对

使用道具 举报

Lv1.梦旅人

梦石
0
星屑
239
在线时间
2399 小时
注册时间
2008-4-11
帖子
12326

贵宾第6届短篇游戏比赛季军

7
发表于 2010-12-12 07:29:47 | 只看该作者
看不太懂,怎么用?用在哪?

点评

要配合其他的脚本或者事件使用,单独用是没有用的,我发的4个脚本都是这样  发表于 2010-12-12 13:18
回复 支持 反对

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2024-4-29 12:03

Powered by Discuz! X3.1

© 2001-2013 Comsenz Inc.

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