Project1

标题: 公共事件中,怎么调取角色信息? [打印本页]

作者: aaaassss123    时间: 2016-1-13 17:03
标题: 公共事件中,怎么调取角色信息?
公共事件中,怎么调取角色信息?不是把角色信息界面调取出来,界面本身我是拿图画的,但是无法实时的调取角色的信息?请问有什么办法调取吗
作者: 汪汪    时间: 2016-1-14 09:04
实时的调取?

  1. var id = $gameParty.allMembers()[i]
  2. var actor = $gameActors.actor(id);

  3. Game_Actor.prototype.actorId = function() {
  4.     return this._actorId;
  5. };
  6. //角色
  7. Game_Actor.prototype.actor = function() {
  8.     return $dataActors[this._actorId];
  9. };
  10. //名称
  11. Game_Actor.prototype.name = function() {
  12.     return this._name;
  13. };
  14. //设置名称
  15. Game_Actor.prototype.setName = function(name) {
  16.     this._name = name;
  17. };
  18. //昵称
  19. Game_Actor.prototype.nickname = function() {
  20.     return this._nickname;
  21. };
  22. //设置昵称
  23. Game_Actor.prototype.setNickname = function(nickname) {
  24.     this._nickname = nickname;
  25. };
  26. //侧面图
  27. Game_Actor.prototype.profile = function() {
  28.     return this._profile;
  29. };
  30. //设置侧面图
  31. Game_Actor.prototype.setProfile = function(profile) {
  32.     this._profile = profile;
  33. };
  34. //人物名称
  35. Game_Actor.prototype.characterName = function() {
  36.     return this._characterName;
  37. };
  38. //人物索引
  39. Game_Actor.prototype.characterIndex = function() {
  40.     return this._characterIndex;
  41. };
  42. //脸名称
  43. Game_Actor.prototype.faceName = function() {
  44.     return this._faceName;
  45. };
  46. //脸索引
  47. Game_Actor.prototype.faceIndex = function() {
  48.     return this._faceIndex;
  49. };
  50. //战斗者名称
  51. Game_Actor.prototype.battlerName = function() {
  52.     return this._battlerName;
  53. };


  54. //当前经验
  55. Game_Actor.prototype.currentExp = function() {
  56.     return this._exp[this._classId];
  57. };
  58. //当前等级经验
  59. Game_Actor.prototype.currentLevelExp = function() {
  60.     return this.expForLevel(this._level);
  61. };
  62. //下一级经验
  63. Game_Actor.prototype.nextLevelExp = function() {
  64.     return this.expForLevel(this._level + 1);
  65. };
  66. //下一级需要经验
  67. Game_Actor.prototype.nextRequiredExp = function() {
  68.     return this.nextLevelExp() - this.currentExp();
  69. };
  70. //最大等级
  71. Game_Actor.prototype.maxLevel = function() {
  72.     return this.actor().maxLevel;
  73. };
  74. //是最大等级
  75. Game_Actor.prototype.isMaxLevel = function() {
  76.     return this._level >= this.maxLevel();
  77. };

  78. //装备槽
  79. Game_Actor.prototype.equipSlots = function() {
  80.     var slots = [];
  81.     for (var i = 1; i < $dataSystem.equipTypes.length; i++) {
  82.         slots.push(i);
  83.     }
  84.     if (slots.length >= 2 && this.isDualWield()) {
  85.         slots[1] = 1;
  86.     }
  87.     return slots;
  88. };
  89. //装备
  90. Game_Actor.prototype.equips = function() {
  91.     return this._equips.map(function(item) {
  92.         return item.object();
  93.     });
  94. };
  95. //武器
  96. Game_Actor.prototype.weapons = function() {
  97.     return this.equips().filter(function(item) {
  98.         return item && DataManager.isWeapon(item);
  99.     });
  100. };
  101. //防具
  102. Game_Actor.prototype.armors = function() {
  103.     return this.equips().filter(function(item) {
  104.         return item && DataManager.isArmor(item);
  105.     });
  106. };
  107. //有武器
  108. Game_Actor.prototype.hasWeapon = function(weapon) {
  109.     return this.weapons().contains(weapon);
  110. };
  111. //有防具
  112. Game_Actor.prototype.hasArmor = function(armor) {
  113.     return this.armors().contains(armor);
  114. };


  115. //是角色
  116. Game_Actor.prototype.isActor = function() {
  117.     return true;
  118. };
  119. //朋友小组
  120. Game_Actor.prototype.friendsUnit = function() {
  121.     return $gameParty;
  122. };
  123. //对手小组
  124. Game_Actor.prototype.opponentsUnit = function() {
  125.     return $gameTroop;
  126. };
  127. //索引
  128. Game_Actor.prototype.index = function() {
  129.     return $gameParty.members().indexOf(this);
  130. };
  131. //是战斗成员
  132. Game_Actor.prototype.isBattleMember = function() {
  133.     return $gameParty.battleMembers().contains(this);
  134. };
  135. //是编队改变可以
  136. Game_Actor.prototype.isFormationChangeOk = function() {
  137.     return true;
  138. };
  139. //当前职业
  140. Game_Actor.prototype.currentClass = function() {
  141.     return $dataClasses[this._classId];
  142. };
  143. //是职业
  144. Game_Actor.prototype.isClass = function(gameClass) {
  145.     return gameClass && this._classId === gameClass.id;
  146. };


  147. //技能
  148. Game_Actor.prototype.skills = function() {
  149.     var list = [];
  150.     this._skills.concat(this.addedSkills()).forEach(function(id) {
  151.         if (!list.contains($dataSkills[id])) {
  152.             list.push($dataSkills[id]);
  153.         }
  154.     });
  155.     return list;
  156. };
  157. //可用技能
  158. Game_Actor.prototype.usableSkills = function() {
  159.     return this.skills().filter(function(skill) {
  160.         return this.canUse(skill);
  161.     }, this);
  162. };

  163. //有无武器
  164. Game_Actor.prototype.hasNoWeapons = function() {
  165.     return this.weapons().length === 0;
  166. };
  167. //赤手元素id
  168. Game_Actor.prototype.bareHandsElementId = function() {
  169.     return 1;
  170. };

  171. //是学习了的技能
  172. Game_Actor.prototype.isLearnedSkill = function(skillId) {
  173.     return this._skills.contains(skillId);
  174. };
复制代码

作者: aaaassss123    时间: 2016-1-14 09:32
汪汪 发表于 2016-1-14 09:04
实时的调取?

我现在是用事件写的界面,脚本来写界面,自己没那么大的本事啦,就试着用公共事件来写界面。调取这些信息的话,能规定他们的坐标和长宽高吗?




欢迎光临 Project1 (https://rpg.blue/) Powered by Discuz! X3.1