Check skill notetag

Michael Caiola

The Stone Bull
Veteran
Joined
Sep 14, 2016
Messages
392
Reaction score
76
First Language
English
Primarily Uses
UPDATE: I solved the actor notetag issue, but I forgot I needed to check for skill notetags, too.


This is the code I currently have, courtesy of @Kino:


Window_BattleLog.prototype.initialize = function() {
var width = this.windowWidth();
var height = this.windowHeight();
Window_Selectable.prototype.initialize.call(this, 0, 0, width, height);
this.opacity = 0;
this._lines = [];
this._methods = [];
this._waitCount = 0;
this._waitMode = '';
this._baseLineStack = [];
this._actor = null; //Added new this._actor property to the prototype, but you still need to assign what actor is somewhere down the line
this._spriteset = null;
this.createBackBitmap();
this.createBackSprite();
this.refresh();
};



Window_BattleLog.prototype.startAction = function(subject, action, targets) {
var item = action.item();
//Check if subject is actor before assign this._actor
if(subject.isActor())
this._actor = subject;
if (this._actor && this._actor.actor().meta.TestTest) {
this.push('performActionStart', subject, action);
this.push('waitForMovement');
this.push('performAction', subject, action);
this.push('showAnimation', subject, targets.clone(), item.animationId);
this.displayAction(subject, item);
}
};

Window_BattleLog.prototype.endAction = function(subject) {
//Also checking is subject (one who is taking the action) is actor
if(subject.isActor())
this._actor = subject;
if (this._actor && this._actor.actor().meta.TestTest) {
this.push('waitForNewLine');
this.push('clear');
this.push('performActionEnd', subject);
}
};




Now I just need to do something similar, but check for a notetag on the skill being used and no the actor.


---


Previous post:


Pretty simple question. I'm trying to make this code check for a notetag. I got an error message saying "actor" is undefined. What do I need to add to make sure "actor" is defined properly?

Window_BattleLog.prototype.startAction = function(subject, action, targets) {
var item = action.item();
if (this._actor.actor().meta.TestTest) {
this.push('performActionStart', subject, action);
this.push('waitForMovement');
this.push('performAction', subject, action);
this.push('showAnimation', subject, targets.clone(), item.animationId);
this.displayAction(subject, item);
}
};

Window_BattleLog.prototype.endAction = function(subject) {
if (this._actor.actor().meta.TestTest) {
this.push('waitForNewLine');
this.push('clear');
this.push('performActionEnd', subject);
}
};



I adapted it from this code, which works fine.

Code:
Window_ActorCommand.prototype.makeCommandList = function() {
    if (this._actor) {
        this.addAttackCommand();
        if (this._actor.actor().meta.moveGuard) {
        	this.addGuardCommand();
         	this.addSkillCommands();
        } else {
        	this.addSkillCommands();
        	this.addGuardCommand();
        }
        this.addItemCommand();
    }
};
 
Last edited by a moderator:

Kino

EIS Game Dev
Veteran
Joined
Nov 27, 2015
Messages
556
Reaction score
794
First Language
English
Primarily Uses
RMMV
There is no this._actor property on the Window_BattleLog prototype; that' why the code does not work for the Window_BattleLog.


You would have to add a this._actor property to the Window_BattleLog, to use this._actor.


If you wanted to make sure something is defined and such, use the below. @Michael Caiola

Code:
Window_BattleLog.prototype.initialize = function() {
    var width = this.windowWidth();
    var height = this.windowHeight();
    Window_Selectable.prototype.initialize.call(this, 0, 0, width, height);
    this.opacity = 0;
    this._lines = [];
    this._methods = [];
    this._waitCount = 0;
    this._waitMode = '';
    this._baseLineStack = [];
  	this._actor = null; //Added new this._actor property to the prototype, but you still need to assign what actor is somewhere down the line
    this._spriteset = null;
    this.createBackBitmap();
    this.createBackSprite();
    this.refresh();
};



Window_BattleLog.prototype.startAction = function(subject, action, targets) {
    var item = action.item();
    //Check if subject is actor before assign this._actor
    if(subject.isActor())
      this._actor = subject;
	if (this._actor && this._actor.actor().meta.TestTest) {
        this.push('performActionStart', subject, action);
        this.push('waitForMovement');
        this.push('performAction', subject, action);
        this.push('showAnimation', subject, targets.clone(), item.animationId);
        this.displayAction(subject, item);
	}
};

Window_BattleLog.prototype.endAction = function(subject) {
    //Also checking is subject (one who is taking the action) is actor
    if(subject.isActor())
      this._actor = subject;
	if (this._actor && this._actor.actor().meta.TestTest) {
        this.push('waitForNewLine');
        this.push('clear');
        this.push('performActionEnd', subject);
	}
};
 
Last edited by a moderator:

Michael Caiola

The Stone Bull
Veteran
Joined
Sep 14, 2016
Messages
392
Reaction score
76
First Language
English
Primarily Uses
That's awesome! Thank you!


You said I'd need to assign what actor is. In the second code I referenced, it just checks the current actor. I'd like my new code to do the same.


And I forgot to mention in my OP that I also need this to check the current weapon and skill for the notetag, as well. I want to be able to use either an actor, weapon, or skill notetag. I'm sure that's asking a lot so if you can only help with the actor notetag that'll be fine for testing . 
 

Kino

EIS Game Dev
Veteran
Joined
Nov 27, 2015
Messages
556
Reaction score
794
First Language
English
Primarily Uses
RMMV
If you check my edit, I checked who the subject is. The subject being whoever takes the action,  etc. I then assign it to this._actor.


That should handle assignment and allow you to check the notetag.
 

Michael Caiola

The Stone Bull
Veteran
Joined
Sep 14, 2016
Messages
392
Reaction score
76
First Language
English
Primarily Uses
That worked spectacularly! Thank you!


Is it simple enough to also check weapon and skill notetags?
 

Kino

EIS Game Dev
Veteran
Joined
Nov 27, 2015
Messages
556
Reaction score
794
First Language
English
Primarily Uses
RMMV
@Michael Caiola Checking weapon and skill note tags would require you to look through the item data and skill data because I'm not sure if weapon and skill data is kept on the actor. So, it might be more complex; I would recommend checking the actor data in the console.
 

Andar

Veteran
Veteran
Joined
Mar 5, 2013
Messages
31,264
Reaction score
7,632
First Language
German
Primarily Uses
RMMV
or simply go to the help file and look up the meta method of reading notetags - that will require you to use a specific format for your notetags and is not as powerfull as reading your own notetag definition, but it will make the engine transfer the data without you doing anything for it...
 

Michael Caiola

The Stone Bull
Veteran
Joined
Sep 14, 2016
Messages
392
Reaction score
76
First Language
English
Primarily Uses
...Now I'm lost. Lol.


@Kino, I don't know how to do what you're saying. or even exactly what it is.


@Andar, I'll check the help file but it might be over my head.
 

Kino

EIS Game Dev
Veteran
Joined
Nov 27, 2015
Messages
556
Reaction score
794
First Language
English
Primarily Uses
RMMV
@Michael Caiola Sorry about that; I didn't communicate it well enough. Go with Andar's idea definitely; you can get more mileage out of it.
If you do have any other questions in the future, feel free to ask me.
 

Michael Caiola

The Stone Bull
Veteran
Joined
Sep 14, 2016
Messages
392
Reaction score
76
First Language
English
Primarily Uses
I have no idea where to look in the help file. I just realized I can save myself and players a lot of work by just checking for the skill notetag <throw item> instead of checking the actor notetag.


Is that something you could help me with?


EDIT: @Kino @Andar I just found this:


2016-11-13.png


Is that what I use? And if so, how?
 
Last edited by a moderator:

Andar

Veteran
Veteran
Joined
Mar 5, 2013
Messages
31,264
Reaction score
7,632
First Language
German
Primarily Uses
RMMV
If you write something in the notebox in that format, then you can later access that notetag with the given script command without any need for your own scripts for reading any analysing the notebox.
 

Michael Caiola

The Stone Bull
Veteran
Joined
Sep 14, 2016
Messages
392
Reaction score
76
First Language
English
Primarily Uses
Then that isn't what I'm looking for. I just want my code to check for a skill notetag. That's it.


@Kino @Andar Kind of desperate here...
 
Last edited by a moderator:

Andar

Veteran
Veteran
Joined
Mar 5, 2013
Messages
31,264
Reaction score
7,632
First Language
German
Primarily Uses
RMMV
The meta function IS to check if a notetag has been placed in the notebox in the editor - if it doesn't exist it can't return anything after all.


I suggest you take a step back and describe to us what you want to do, not how you want to do it.


All your questions so far go around "how" you want to do something using notetags, but never once you explained what that something is that you want to achieve by notetags - please describe what the results fvisible for the player should be.
 

Michael Caiola

The Stone Bull
Veteran
Joined
Sep 14, 2016
Messages
392
Reaction score
76
First Language
English
Primarily Uses
I'm sorry, @Andar. I've been digging through code trying to figure this out for a while now and I just got frustrated.


I usually ask for the how because I've figured everything else out and I want to make the question as simple as possible. Sometimes I end up doing the opposite.


I've been working on making Victor Sant's Throwable Objects plugin compatible with Yanfly's Battle Engine Core.


Victor's plugin inserts actions into this RMMV code:


Window_BattleLog.prototype.startAction = function(subject, action, targets) {
var item = action.item();
this.push('performActionStart', subject, action);
this.push('waitForMovement');
this.push('performAction', subject, action);
this.push('showAnimation', subject, targets.clone(), item.animationId);
this.displayAction(subject, item);
};

Window_BattleLog.prototype.endAction = function(subject) {
this.push('waitForNewLine');
this.push('clear');
this.push('performActionEnd', subject);
};




Yanfly's Battle Engine Core changes that code to:


Window_BattleLog.prototype.startAction = function(subject, action, targets) {
};

Window_BattleLog.prototype.endAction = function(subject) {
};




That causes compatibility issues. When both are installed, the game essentially executes two attack sequences. First is the game's default sequence, but *without* the pieces of code removed by Yanfly and *with* the pieces of code added by Victor. All it shows is the enemy being damaged. Second is Yanfly's attack sequence, whether it's the standard sequence or one modified with action sequences. I figured out that if you add the original code back via a separate plugin placed after Yanfly's BEC and before Victor's Throwable Objects, or by adding it to the top of throwable objects, the game will execute two full action sequences: the default sequence with properly functioning throwable object animations and Yanfly's sequence.


So, my goal has been to find a way to disable Victor's attack sequence for all instances except when throwable objects are needed. And for just those instances, to disable Yanfly's sequence. The second part is easily achieved by adding a blank action sequence. It's the first part I've been struggling with. It's not a perfect solution; you still can't actually combine throwable objects and action sequences. But it would at least make it so you can still use both separately.


When I made the original post, I wasn't thinking correctly and I asked for help with actor notetags. The code that Kino gave me worked perfectly:


Window_BattleLog.prototype.initialize = function() {
var width = this.windowWidth();
var height = this.windowHeight();
Window_Selectable.prototype.initialize.call(this, 0, 0, width, height);
this.opacity = 0;
this._lines = [];
this._methods = [];
this._waitCount = 0;
this._waitMode = '';
this._baseLineStack = [];
this._actor = null; //Added new this._actor property to the prototype, but you still need to assign what actor is somewhere down the line
this._spriteset = null;
this.createBackBitmap();
this.createBackSprite();
this.refresh();
};



Window_BattleLog.prototype.startAction = function(subject, action, targets) {
var item = action.item();
//Check if subject is actor before assign this._actor
if(subject.isActor())
this._actor = subject;
if (this._actor && this._actor.actor().meta.TestTest) {
this.push('performActionStart', subject, action);
this.push('waitForMovement');
this.push('performAction', subject, action);
this.push('showAnimation', subject, targets.clone(), item.animationId);
this.displayAction(subject, item);
}
};

Window_BattleLog.prototype.endAction = function(subject) {
//Also checking is subject (one who is taking the action) is actor
if(subject.isActor())
this._actor = subject;
if (this._actor && this._actor.actor().meta.TestTest) {
this.push('waitForNewLine');
this.push('clear');
this.push('performActionEnd', subject);
}
};


Which told me I had the right idea.


The problem with it being an actor notetag is that the patch will apply to everything the actor does instead of just the skills that use throwable objects.


So what I need is for that code the check if the skill that's being used has <TestTest> in it's notebox. I'll change "TestTest" to something else later. Probably something like <BECThrowable>.


I hope that's a better explanation. Again, sorry for the impatience.
 
Last edited by a moderator:

Andar

Veteran
Veteran
Joined
Mar 5, 2013
Messages
31,264
Reaction score
7,632
First Language
German
Primarily Uses
RMMV
yes, that is a better explanation - and in such a case, I suggest you completely ignore the notetags.


There is a different way that should be much easier to do this, although it is a bit tricky in another part.


You want only one of the plugins to function depending on the type of skill to be processed?


Check which plugin is executed first - that depends both on the order of your plugins and the way they alias the same function.


In that plugin, after it detects its own function, add a single line to turn on a game switch as a marker that that function is triggered.


Then in the other plugin (the one which is executed later), add an conditional check to only execute its part if that switch is NOT turned on and skip the section if the switch was turned on by the other plugin.


And add another line after both plugins to turn off the switch again, so that it is ready for the next use...


Absolutely no need to read notetags at all for this, just add your own marker instead of trying to identify notetags as markers...
 
Last edited by a moderator:

Michael Caiola

The Stone Bull
Veteran
Joined
Sep 14, 2016
Messages
392
Reaction score
76
First Language
English
Primarily Uses
I'm pretty sure Throwable Objects executes first. The user will be deciding which skills are Throwable Object skills, so how would turning on a switch in the code work?


By default, both plugins will always execute and in order to determine which attack sequence should be used, the skill has to be defined a certain way.
 

Andar

Veteran
Veteran
Joined
Mar 5, 2013
Messages
31,264
Reaction score
7,632
First Language
German
Primarily Uses
RMMV
the plugin themselves do not cause such errors - it's the functions inside the plugins that cause the problems.


If you place the condition around the critical part that conflicts, having only one of them execute and skipping the other, will solve the error.


However - and that is what I meant by the "tricky" part - you need to know what the conflicting part(s) are to make sure they are executed only alternatively.


And that is something I can't help with because I don't know those plugins good enough to identify the correct placements.
 

Michael Caiola

The Stone Bull
Veteran
Joined
Sep 14, 2016
Messages
392
Reaction score
76
First Language
English
Primarily Uses
That is exactly why I'm trying to do it with notetag. I don't know Yanfly's BEC at all. I know where the conflict is in Throwable Objects. That's where I'm trying to use the notetag. Since I don't know where the conflict in the BEC is, I'm using blank action sequences as a workaround the disable it when needed.


The skill notetag is to tell the game to execute the Throwable Objects code. I need to do it manually through notetags since I can't do it in the BEC plugin itself.


So, do you know how to switch my code from checking actor notetags to skill notetags?
 

Andar

Veteran
Veteran
Joined
Mar 5, 2013
Messages
31,264
Reaction score
7,632
First Language
German
Primarily Uses
RMMV
You didn't think it through


The short for of what you're trying to do is


"if this notetag is present, skip the following code"


I'm telling you to do instead


"if this switch is turned on, skip the following code"


Do you see the similiarities? Does your code function to the point that the error is gone if you turn a switch before calling the problematicthrowing skill?


That is the critical part - detecting the notetags will not help you if the other part "skip this" does not work.


And if that other part works, then you can make your own triggers for it.
 

Michael Caiola

The Stone Bull
Veteran
Joined
Sep 14, 2016
Messages
392
Reaction score
76
First Language
English
Primarily Uses
It's actually the opposite. I'm trying to say "If this notetag is present, execute the following code." How else would I be able to tell the game to execute the code when the user wants?


Believe me, I have thought this through. I've spent so much time trying to figure this out that I actually gave up at one point. I do not have the knowledge to fix this purely at the code level. That would involve studying the BEC code extensively. That's why I'm doing it this way.


Detecting the notetags will do exactly what I need because I'm not skipping the BEC sequence at the code level. I'm using an empty action sequence to skip it.


The method using the actor notetag does exactly what I need. It fixes the problem as close to perfectly as I'm going to get without intimately knowing the BEC's code. All I need to do is change it from an actor notetag to a skill notetag.
 
Last edited by a moderator:

Users Who Are Viewing This Thread (Users: 0, Guests: 1)

Latest Threads

Latest Posts

Latest Profile Posts

Been scratching away at my game and making progress, but just had a revelation. I'm working in full screen and adjusting all my pictures accordingly, but will they resize if someone's screen is smaller?? I hope this doesn't turn out to be a problem later.
Why is there so much month left at the end of money? D=
Hello humans! How goes your day in this journey of living? I hope it is good, for I am human like you, and I am feeling great! Worship the altar.

Forum statistics

Threads
105,625
Messages
1,015,041
Members
137,285
Latest member
AndrewRobertson
Top