查看: 3167|回复: 2

[已经解决] 请问这个随机生成人物的脚本怎么用?

[复制链接]
梦石
0
星屑
327
在线时间
187 小时
注册时间
2016-4-12
回帖
29
发表于 2016-7-12 18:19:37 | 显示全部楼层 |阅读模式

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

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

×
本帖最后由 余烬之中 于 2017-6-16 19:58 编辑
  1. //=============================================================================
  2. // SAN_ActorGenerator.js
  3. //=============================================================================
  4. // Copyright (c) 2015 Sanshiro
  5. // Released under the MIT license
  6. // [url]http://opensource.org/licenses/mit-license.php[/url]
  7. //=============================================================================

  8. /*:
  9. * @plugindesc SAN_ActorGenerator ver1.00
  10. * Generate actor by script command.
  11. * @author Sanshiro [url]https://twitter.com/rev2nym[/url]
  12. *
  13. * @help
  14. * This plugin generate actor that specified actor ID by script command.
  15. * To use each script command (function), show ActorGenerator class comment.
  16. * To use other that isn't implemented on this plugin, please make up
  17. * with event commands.
  18. *
  19. * There is no plugin parameters, no plugin commands.
  20. *
  21. * It's possible to commercial use, distribute, and modify under the MIT license.
  22. * But, don't eliminate and don't alter a comment of the beginning.
  23. * If it's good, please indicate an author name on credit.
  24. *
  25. * Author doesn't shoulder any responsibility in all kind of damage by using this.
  26. * And please don't expect support. X(
  27. */

  28. /*:ja
  29. * @plugindesc アクター生成 ver1.00
  30. * スクリプトコマンドによりアクターを生成します。
  31. * @author サンシロ [url]https://twitter.com/rev2nym[/url]
  32. * @version 1.00 2015/12/27 公開
  33. *
  34. * @help
  35. * スクリプトコマンドにより指定したアクターIDのアクターを生成します。
  36. * 各スクリプトコマンド(関数)はActorGeneratorクラスのコメントを参照してください。
  37. * このプラグインに実装されていない機能はイベントコマンドで補ってください。
  38. *
  39. * プラグインパラメータ、プラグインコマンドはありません。
  40. *
  41. * MITライセンスのもと、商用利用、改変、再配布が可能です。
  42. * ただし冒頭のコメントは削除や改変をしないでください。
  43. * よかったらクレジットに作者名を記載してください。
  44. *
  45. * これを利用したことによるいかなる損害にも作者は責任を負いません。
  46. * サポートは期待しないでください><。
  47. */

  48. var Imported = Imported || {};
  49. Imported.SAN_ActorGenerator = true;

  50. var Sanshiro = Sanshiro || {};
  51. Sanshiro.ActorGenerator = Sanshiro.ActorGenerator || {};

  52. //-----------------------------------------------------------------------------
  53. // ActorGenerator
  54. //
  55. // アクター生成クラス

  56. function ActorGenerator() {}

  57. ActorGenerator._actorIdLastGenerated = undefined;

  58. // Generate actor
  59. // アクター生成
  60. // baseActorId: Base actor's ID
  61. //              生成のベースになるアクターのアクターID
  62. // newActorId:  Generated actor's ID (can omission)
  63. //              生成されたアクターのアクターID(省略可)
  64. ActorGenerator.generateActor = function(baseActorId, newActorId) {
  65.         if(newActorId === undefined) {
  66.                 for (newActorId = $dataActors.length; !!$gameActors.data()[newActorId]; newActorId++);
  67.         }
  68.         if (!$gameActors.data()[newActorId]) {
  69.                 $gameActors.data()[newActorId] = new Game_Actor(baseActorId);
  70.                 $gameActors.data()[newActorId].setActorId(newActorId);
  71.                 this._actorIdLastGenerated = newActorId;
  72.         } else {
  73.                 this._actorIdLastGenerated = undefined;
  74.         }
  75. };

  76. // Last generated actor's ID
  77. // 最後に生成されたアクターのアクターID
  78. ActorGenerator.actorIdLastGenerated = function() {
  79.         return this._actorIdLastGenerated;
  80. };

  81. // Actor ID by party index
  82. // パーティ順番によるアクターIDの取得
  83. ActorGenerator.actorIdByPartyIndex = function(index) {
  84.         return $gameParty.allMembers()[index].actorId();
  85. };

  86. // Add actor to party
  87. // アクターのパーティ加入
  88. ActorGenerator.changePartyMemberAdd = function(actorId) {
  89.         $gameParty.addActor(actorId);
  90. };

  91. // Remove actor to party
  92. // アクターのパーティ除外
  93. ActorGenerator.changePartyMemberRemove = function(actorId) {
  94.         $gameParty.removeActor(actorId);
  95. };

  96. // Change actor's equipment
  97. // アクターの装備変更
  98. ActorGenerator.changeEquipment = function(actorId, etypeId, itemId) {
  99.         $gameActors[actorId].changeEquipById(etypeId, itemId);
  100. };

  101. // Change actor's name
  102. // アクターの名前変更
  103. ActorGenerator.changeName = function(actorId, name) {
  104.         $gameActors[actorId].setName(name);
  105. };

  106. // Change actor's class
  107. // アクターの職業変更
  108. ActorGenerator.changeClass = function(actorId, classId, keepExp) {
  109.         $gameActors[actorId].changeClass(classId, keepExp);
  110. };

  111. // Change actor's nickname
  112. // アクターのニックネーム変更
  113. ActorGenerator.changeNickname = function(actorId, nickname) {
  114.         $gameActors[actorId].setNickname(nickname);
  115. };

  116. // Change actor's profile
  117. // アクターのプロフィール変更
  118. ActorGenerator.changeProfile = function(actorId, profile) {
  119.         $gameActors[actorId].setProfile(profile);
  120. };

  121. // Change actor's face image
  122. // アクターの顔画像変更
  123. ActorGenerator.changeFaceImage = function(actorId, faceName, faceIndex) {
  124.         $gameActors[actorId].setFaceImage(faceName, faceIndex);
  125. };

  126. // Change actor's walking character image
  127. // アクターの歩行キャラ画像変更
  128. ActorGenerator.changeCharacterImage = function(actorId, characterName, characterIndex) {
  129.         $gameActors[actorId].setCharacterImage(characterName, characterIndex);
  130. };

  131. // Change actor's battler image
  132. // アクターの戦闘キャラ画像変更
  133. ActorGenerator.changeBattlerImage = function(actorId, battlerName) {
  134.         $gameActors[actorId].setBattlerImage(battlerName);
  135. };

  136. //-----------------------------------------------------------------------------
  137. // Game_Actors
  138. //
  139. // アクターズクラス

  140. // アクターズクラスのアクター(エイリアス元でアクターオブジェクト生成)
  141. Sanshiro.ActorGenerator.Game_Actors_actor = Game_Actors.prototype.actor;
  142. Game_Actors.prototype.actor = function(actorId) {
  143.         if (!!this._data[actorId]){
  144.                 return this._data[actorId];
  145.         }
  146.         return Sanshiro.ActorGenerator.Game_Actors_actor.call(this, actorId);
  147. };

  148. // アクターズクラスのアクターのリスト
  149. Game_Actors.prototype.data = function() {
  150.         return this._data;
  151. };

  152. //-----------------------------------------------------------------------------
  153. // Game_Actor
  154. //
  155. // アクタークラス

  156. // アクタークラスの初期化
  157. Sanshiro.ActorGenerator.Game_Actor_initialize = Game_Actor.prototype.initialize;
  158. Game_Actor.prototype.initialize = function(actorId) {
  159.     this._dataActorId = actorId;
  160.         Sanshiro.ActorGenerator.Game_Actor_initialize.call(this, actorId);
  161. };

  162. // アクタークラスのデータベースのデータ
  163. Game_Actor.prototype.actor = function() {
  164.     return $dataActors[this._dataActorId];
  165. };

  166. // アクタークラスのアクターIDの設定
  167. Game_Actor.prototype.setActorId = function(actorId) {
  168.         this._actorId = actorId;
  169. };
复制代码
梦石
0
星屑
1232
在线时间
1017 小时
注册时间
2011-4-30
回帖
1464
发表于 2016-7-12 23:24:46 | 显示全部楼层
使用这个就可以创建newactorid 的人物为 一个 基于 baseactorid 人物 的 人物
ActorGenerator.generateActor(baseActorId, newActorId)
回复

使用道具 举报

梦石
0
星屑
327
在线时间
187 小时
注册时间
2016-4-12
回帖
29
 楼主| 发表于 2016-7-13 00:15:39 | 显示全部楼层
汪汪 发表于 2016-7-12 23:24
使用这个就可以创建newactorid 的人物为 一个 基于 baseactorid 人物 的 人物
ActorGenerator.generateAct ...

{:2_263:} 为何用了没反应,复制baseactorid的角色完全没有复制,还是原本的数据
回复

使用道具 举报

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

本版积分规则

Powered by Discuz! X5.0 © 2001-2026 Discuz! Team.

在本版发帖返回顶部