Hi everyone,
I've been playing around with QABS and I tried to modify the behavior of the selecttarget by myself to no avail.
I wanted to know if anybody who has had experience with modding Qabs could help me on this.
Here is the code that I want to modify (and that I think needs mod) in the QABS plugin - from line 3248 :
As it is, everytime a skill that has "selecttarget" in its <abssettings> is used, all the potential targets within the diameter set by the maker (say 500 pixels diameter) will be detected and the selection cursor will ALWAYS appear on the enemy that is at the top left of the currenter diameter (smallest X/Y within the diameter), then you have the ability to move from one target to the other using two keys (pageup/down).
It seems this behaviour of the selection cursor is dictated by skill.index = 0; as if you change it to 1, the selection cursor will FIRST appear on the next event in that same diameter, and so on.
The behaviour I would like to have instead of the current one is the following:
Within all the potential targets within the set diameter, the selection cursor appears FIRST on the NEAREST TARGET. Whether that target corresponds to index.skill = 0 or 3 or 8; after that, you'd still have the ability to move from one target to the other if you want to.
I had a few attempts at it myself, checking the distance between the skill.collider.center.x / y and the player FOR (var i = 0; i < skill.targets.length; i++); in order to get the index.skill number that corresponds to the nearest target and force that into the skill.index = nearest variable.
However not being a coder myself, I guess I reached the limits of my playing around with the existing code.
Don't hesitate to Let me know if my explanations make no sense at all.
Thanks in advance everyone!
I've been playing around with QABS and I tried to modify the behavior of the selecttarget by myself to no avail.
I wanted to know if anybody who has had experience with modding Qabs could help me on this.
Here is the code that I want to modify (and that I think needs mod) in the QABS plugin - from line 3248 :
Code:
Game_CharacterBase.prototype.makeTargetingSkill = function(skill) {
this._groundTargeting = skill;
this._selectTargeting = this.constructor === Game_Event ? true : skill.settings.selectTarget;
var collider = skill.collider;
var diameter = skill.settings.range * 2;
skill.targeting = new Circle_Collider(diameter, diameter);
skill.targeting.moveTo(this.cx() - diameter / 2, this.cy() - diameter / 2);
ColliderManager.draw(skill.targeting, -1);
skill.collider = skill.targeting;
skill.targets = QABSManager.getTargets(skill, this);
skill.collider = collider;
skill.picture = new Sprite_SkillCollider(skill.collider);
if (this._selectTargeting) {
if (skill.targets.length === 0) {
return this.onTargetingCancel();
}
skill.collider.color = '#00ff00';
skill.index = 0;
}
QABSManager.addPicture(skill.picture);
return skill;
};
As it is, everytime a skill that has "selecttarget" in its <abssettings> is used, all the potential targets within the diameter set by the maker (say 500 pixels diameter) will be detected and the selection cursor will ALWAYS appear on the enemy that is at the top left of the currenter diameter (smallest X/Y within the diameter), then you have the ability to move from one target to the other using two keys (pageup/down).
It seems this behaviour of the selection cursor is dictated by skill.index = 0; as if you change it to 1, the selection cursor will FIRST appear on the next event in that same diameter, and so on.
The behaviour I would like to have instead of the current one is the following:
Within all the potential targets within the set diameter, the selection cursor appears FIRST on the NEAREST TARGET. Whether that target corresponds to index.skill = 0 or 3 or 8; after that, you'd still have the ability to move from one target to the other if you want to.
I had a few attempts at it myself, checking the distance between the skill.collider.center.x / y and the player FOR (var i = 0; i < skill.targets.length; i++); in order to get the index.skill number that corresponds to the nearest target and force that into the skill.index = nearest variable.
However not being a coder myself, I guess I reached the limits of my playing around with the existing code.
Don't hesitate to Let me know if my explanations make no sense at all.
Thanks in advance everyone!