Project1

标题: 如何将游戏角色的TP值设置成变量? [打印本页]

作者: 潇月之雨    时间: 2016-7-23 13:11
标题: 如何将游戏角色的TP值设置成变量?
我设计了一个技能,只要满足一定TP就会自动使用。不足则不使用。
但是变量里面貌似无法设置成TP值,求解

作者: 汪汪    时间: 2016-7-24 11:02
var actor = $gameActors.actor(param1)  
if (actor) {actor.tp}
作者: 潇月之雨    时间: 2016-7-25 12:38
汪汪 发表于 2016-7-24 11:02
var actor = $gameActors.actor(param1)  
if (actor) {actor.tp}

能详细说明下吗?
不是太懂....
谢谢了
作者: 汪汪    时间: 2016-7-25 16:36
潇月之雨 发表于 2016-7-25 12:38
能详细说明下吗?
不是太懂....
谢谢了

在变量操作 脚本那里用
$gameActors.actor(param1)  ? $gameActors.actor(param1).tp  : 0
作者: 潇月之雨    时间: 2016-7-26 11:01
汪汪 发表于 2016-7-25 16:36
在变量操作 脚本那里用
$gameActors.actor(param1)  ? $gameActors.actor(param1).tp  : 0

设置过了,但是貌似不行啊。
作者: 潇月之雨    时间: 2016-8-3 20:28
汪汪 发表于 2016-7-25 16:36
在变量操作 脚本那里用
$gameActors.actor(param1)  ? $gameActors.actor(param1).tp  : 0

这几天有点忙,就没回复了。
还是不行,
param 那里,不管是填1,还是角色名字。都没用。
作者: 汪汪    时间: 2016-8-5 09:14
$gameActors.actor(1)  ? $gameActors.actor(1).tp  : 0
作者: tseyik    时间: 2016-8-5 09:24
参考
TP100skill
[fold=TP100skill.js][pre lang="javascript"]//=============================================================================
//
// TP100skill.js
//
// Copyright (c) kotonoha*
// This software is released under the MIT License.
// http://opensource.org/licenses/mit-license.php
//
// 2016/01/12 ver1.0 プラグイン公開
//
//=============================================================================

/*:
* @plugindesc TPが100になるまでTP技を使用不可にするプラグイン
* @author kotonoha*(http://ktnh5108.pw/)
*
* @help TPが100ポイントたまるまで、TP技のコマンドを選べない様にします。
* TPを100消費する必殺技が使える様になった時にコマンドが使用可能となり、欄には「必殺技★」と表示されます。
*
* @param TP_stypeID
* @desc 必殺技に使用するスキルID(データベース>タイプ>スキルタイプ の左側の数値)を指定
* @default 02
*
* @param TP_mark
* @desc TP100になったらTP技のコマンドの横に表示するマーク
* @default ★
*
*/

(function() {

    var parameters = PluginManager.parameters('TP100skill');
        var TP_stypeID = String(parameters['TP_stypeID']);
        var TP_mark = String(parameters['TP_mark']);

        Window_ActorCommand.prototype.addSkillCommands = function() {

            var skillTypes = this._actor.addedSkillTypes();

                skillTypes.forEach(function(stypeId) {

                var name = $dataSystem.skillTypes[stypeId];
               
                if (stypeId == TP_stypeID && this._actor.tp == 100) {
                        var name = name + TP_mark;
                        this.addCommand(name, 'skill', true, stypeId);
                }
                else if (stypeId == TP_stypeID && this._actor.tp != 100) {
                        this.addCommand(name, 'skill', false, stypeId);
                }
                else {
                        this.addCommand(name, 'skill', true, stypeId);
                }

        }, this);

        };

})();[/pre][/fold]
作者: 潇月之雨    时间: 2016-8-5 11:10
汪汪 发表于 2016-8-5 09:14
$gameActors.actor(1)  ? $gameActors.actor(1).tp  : 0

多谢,已解决!




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