- Joined
- Sep 4, 2019
- Messages
- 148
- Reaction score
- 40
- First Language
- English
- Primarily Uses
- RMMV
.
Last edited:
Every now and then I'm using a plugin and it doesn't work quite the way I want it to, so I put in a little tweak to do what I want. Sometimes it's a bugfix, sometimes it's just changing things to be easier for me to work with. Since I'm not the only person using these plugins, I figured I'd put up a thread for these so other people can try them if they want.
I'll be sporadically updating this whenever I have something I think other people might find useful.
These are not optimized or cleaned up in any way, so it's almost certain there are better ways to do all of these things.
Terms of Use: Do whatever you like.
YEP_X_ExtDoodadPack1: Switching Doodads 'on' puts them at the beginning of their animation cycle.
Yanfly's extended doodad plugin with switches is great to use, but when you switch an animated doodad on, it's at essentially random part of its animation cycle. That's because the doodads are silently going through each frame while transparent.
I wanted animated doodads to be at the start of their animation cycle when switched on. This tweak does that by resetting the frame to 0 whenever the plugin refreshes a hidden doodad.
Code://from YEP_X_ExtDoodadPack1 // Sprite_Doodad.prototype.updateCustomEDP1Z = function() { if ($gameTemp._modeGFD) return; // Party var length = this.partyHave.length; for (var i = 0; i < length; ++i) { var actorId = this.partyHave[i]; if (!$gameParty._actors.contains(actorId)) { this.opacity = 0; this._index = 0;//reset the animation state so long as opacity is off, thus allowing for us to play doodad animations once. return; } } var length = this.partyMiss.length; for (var i = 0; i < length; ++i) { var actorId = this.partyMiss[i]; if ($gameParty._actors.contains(actorId)) { this.opacity = 0; this._index = 0;//reset the animation state so long as opacity is off, thus allowing for us to play doodad animations once. return; } } // Switches var length = this.switchOn.length; for (var i = 0; i < length; ++i) { var switchId = this.switchOn[i]; if (!$gameSwitches.value(switchId)) { this.opacity = 0; this._index = 0;//reset the animation state so long as opacity is off, thus allowing for us to play doodad animations once. return; } } var length = this.switchOff.length; for (var i = 0; i < length; ++i) { var switchId = this.switchOff[i]; if ($gameSwitches.value(switchId)) { this.opacity = 0; this._index = 0;//reset the animation state so long as opacity is off, thus allowing for us to play doodad animations once. return; } } };
MOG_ChronoEngine Item Core Compatibilty
Chrono Engine is not compatible with yanfly's item core by default. This fixes that.
Code:var _mog_toolSys_gmap_setup = Game_Map.prototype.setup; Game_Map.prototype.setup = function(mapId) { //console.log("Game_Map.prototype.setup"); _mog_toolSys_gmap_setup.call(this,mapId); this._treasureEvents = []; this._battlersOnScreen = []; this._enemiesOnScreen = []; this._actorsOnScreen = []; $gameSystem._toolsOnMap = []; $gameTemp.clearToolCursor(); //console.log($gameSystem._toolsData);// with itemcore, this always returns an empty array [] //without itemcore, it returns 'null', then an the proper item list, so clearly _toolsdata isn't getting set right //I assume the 'null' gets overridden by one of yanfly's blanket definitions, and since I can't find that // I'm just testing to see if the list is empty. If it is, grab the tools again // it seems to work! //if (!$gameSystem._toolsData) {this.dataMapToolClear()}; if (!$gameSystem._toolsData) {this.dataMapToolClear() }else{ if ($gameSystem._toolsData.length == 0) {this.dataMapToolClear()}; } for (var i = 0; i < $gameParty.members().length; i++) { var actor = $gameParty.members()[i]; actor.clearActing(); $gameSystem._toolHookshotSprite = [null,null,0]; }; };
MOG_ActorHud Meter Angle Fix
Mog's actorhud converts from radians to degrees twice by default, which means if you set an angled bar the background
won't be at the same angle as the filled bar. This typo is in all the different meters, but once you see the hp meter fix you can change whatever other ones you want.
Code://============================== // * Create HP Meter //============================== Actor_Hud.prototype.create_hp_meter = function() { if (String(Moghunter.ahud_hp_meter_visible) != "true") {return}; this.removeChild(this._hp_meter_blue); this.removeChild(this._hp_meter_red); if (!this._battler) {return}; this._hp_meter_red = new Sprite(this._hp_meter_img); this._hp_meter_red.x = this._pos_x + Moghunter.ahud_hp_meter_pos_x; this._hp_meter_red.y = this._pos_y + Moghunter.ahud_hp_meter_pos_y; this._hp_meter_red.rotation = Moghunter.ahud_hp_meter_rotation * Math.PI / 180; this._hp_meter_red.setFrame(0,0,0,0); this.addChild(this._hp_meter_red); this._hp_meter_blue = new Sprite(this._hp_meter_img); this._hp_meter_blue.x = this._hp_meter_red.x; this._hp_meter_blue.y = this._hp_meter_red.y; this._hp_meter_blue.rotation = this._hp_meter_red.rotation; //this was incorrectly converting to radians twice this._hp_meter_blue.setFrame(0,0,0,0); this.addChild(this._hp_meter_blue); this._hp_old_ani[0] = this._battler.hp - 1; if (String(Moghunter.ahud_hp_meter_flow) === "true") {this._hp_flow[0] = true; this._hp_flow[2] = this._hp_meter_img.width / 3; this._hp_flow[3] = this._hp_flow[2] * 2; this._hp_flow[1] = Math.floor(Math.random() * this._hp_flow[2]); }; };
MOG_CharacterPoses+Mog_ChronoEngine Rotation Around Center + Set Sprite Rotations
By default in rpgmaker, sprite rotation is around the base of a sprite. That's bad if you're rotating projectiles, since you end up with your hitbox being displaced off from where the sprite actually is.
This function uses trig to identify where the sprite needs to be displaced so that it's rotated around the hitbox. (This requires that you center your sprite using mog's displacement tools to start with).
![]()
Above: My Version (approximate hitbox in blue)
Below: Default version
In addition, I have added a few functions for rotating character sprites smoothly. Set a target angle and a rotation rate, and it will update each frame until it reaches the target angle.
If you don't set a target angle, it will rotate at that speed forever.
You can also set it to go in whichever direction is closer, ignoring the sign on the angle speed.
Code:Game_CharacterBase.prototype.setTargetAngle = function(targetAngle) { var ag = targetAngle * Math.PI / 180; this._user.targetAngle = [ag,targetAngle]; }; Game_CharacterBase.prototype.setRotationRate = function(rotationSpeed) { var ag = rotationSpeed * Math.PI / 180; this._user.rotationSpeed = [ag,rotationSpeed]; }; Game_CharacterBase.prototype.setRotationFlexible = function() { //flag to say we can go clockwise OR counterclockwise, whichever is closer this._user.rotationFlexible= true; }; Game_CharacterBase.prototype.clearRotationRate = function() { this._user.targetAngle =null; this._user.rotationSpeed = null; this._user.rotationFlexible= false; }; Sprite_Character.prototype.updateCharPosesPosition = function() { //honestly I don't understand what this is supposed to be doing, and a //constant offset for the x displacement fits what I want to do, //I've removed the x-offset shifting, to make way for my stuff //sorry if this breaks stuff for you! //if (this._character.direction() === 4 || this._character.direction() === 6) { // var ex = this._character.direction() === 6 ? this._character._frames.x : -this._character._frames.x; //} else { // var ex = 0; //}; var ex = this._character._frames.x; var ey = this._character._frames.y; // add on additional rotation specified in tool if (this._character._tool) { if(this._character._tool.offsetX) { ex+=this._character._tool.offsetX; } if(this._character._tool.offsetY) { ey+=this._character._tool.offsetY; } if(this._character._tool.diagonalAngle) { this._character._user.rotation = [this._character._tool.diagonalAngle,Math.degrees(this._character._tool.diagonalAngle)]; } } ag=0; angle=0; thisHasRotationUser=false; thisHasRotationChar=false; //technically this isn't the 'correct' way of checking to see //if we have this trait, but there shouldn't be any edge cases that matter //since if rotation has a value but it resolves as 'false' we don't want to //rotate after all if (this._character._user.rotation) { thisHasRotationChar=true; [ag,angle] = this._character._user.rotation; }else{ if ($gameMap.event(3)._user.rotation[0] =undefined) { $gameMap.event(3)._user.rotation[0]=0; $gameMap.event(3)._user.rotation[1]=0; } } if (thisHasRotationChar) { var isSpinning=false; var hasTargetAngle=false; if(thisHasRotationChar) { if (this._character._user.rotationSpeed) { [agSpeed,angleSpeed] = this._character._user.rotationSpeed; isSpinning=true; } if (this._character._user.targetAngle || this._character._user.targetAngle ==0 ) { [agTarget,angleTarget] = this._character._user.targetAngle; hasTargetAngle=true; } if (isSpinning){ if(hasTargetAngle){ //if our target angle is within a single step, snap to it. if(Math.abs(((((angleTarget+360) % 360)-((angle+360) % 360))/angleSpeed))<1){ this._character.setAngle(angleTarget); }else{ //if we are allowed to go in either direction, pick the shorter distance if(this._character._user.rotationFlexible) { if (((((angleTarget+360) % 360)-((angle+360) % 360) +360) % 360)>180) this._character.setAngle(angle-Math.abs(angleSpeed)); else this._character.setAngle(angle+Math.abs(angleSpeed)); }else{ this._character.setAngle(angle+angleSpeed); } } }else{ //if we don't have a target angle, but do have a rotation speed, keep spinning without limit! this._character.setAngle(angle+angleSpeed); } } }else if(thisHasRotationUser){ if (this._user.rotationSpeed) { [agSpeed,angleSpeed] = this._user.rotationSpeed; isSpinning=true; } if (this._user.targetAngle) { [agTarget,angleTarget] = this._user.targetAngle; hasTargetAngle=true; } if (isSpinning){ if(hasTargetAngle){ //if our target angle is within a single step, snap to it. if(Math.abs(((((angleTarget+360) % 360)-((angle+360) % 360))/angleSpeed))<1){ this.setAngle(angleTarget); }else{ if(this._user.rotationFlexible) { if (((((angleTarget+360) % 360)-((angle+360) % 360) +360) % 360)>180) this.setAngle(angle-Math.abs(angleSpeed)); else this.setAngle(angle+Math.abs(angleSpeed)); }else{ this.setAngle(angle+angleSpeed); } } }else{ //if we don't have a target angle, but do have a rotation speed, keep spinning without limit! this.setAngle(angle+angleSpeed); } } } //update ag and angle if (this._character._user.rotation || (this._character._user.rotation==0)) { [ag,angle] = this._character._user.rotation; } } if (ag==0) { this.x += ex; this.y += ey; }else{ //I have altered this code to //rotate events around the displacement point by default, //instead of the base of the sprite //technically this rotation is only off by a pixel or two, but w/e, close enough. baselength=Math.sqrt(ex*ex + ey*ey); this.x += ex*Math.cos(ag) - ey * Math.sin(ag); this.y += ex*Math.sin(ag) + ey * Math.cos(ag); } }; //one problem with the above is that animations end up vertically displaced //from their targets! And animations are attached to a single point on the //sprite, which means if it spins, they spin! //this restores normal animation location on rotating objects _cross_sprite_animation_update_position=Sprite_Animation.prototype.updatePosition; Sprite_Animation.prototype.updatePosition = function() { _cross_sprite_animation_update_position.call(this); if (this._target._character) { //if we're targeting a sprite on a character //then var ex =0; var ey =0; if (this._target._character._frames.x) { ex+=this._target._character._frames.x; } if (this._target._character._frames.y) { ey+=this._target._character._frames.y; } if (this._target._character._tool) { if(this._target._character._tool.offsetX) { ex+=this._target._character._tool.offsetX; } if(this._target._character._tool.offsetY) { ey+=this._target._character._tool.offsetY; } } var ag=0; var angle=0; if (this._target._character._user.rotation || (this._target._character._user.rotation==0)) { [ag,angle] = this._target._character._user.rotation; } this.x -= ex*Math.cos(ag) - ey * Math.sin(ag) -ex; this.y -= ex*Math.sin(ag) + ey * Math.cos(ag) -ey*1.5; } }
IIRC mog puts the collision box sitting on the center bottom of the tile the event is on (the same way that RPGM defines where a large sprite). So basicallyDo you think this would fix the issue I am having with projectiles not properly functioning when I add a body-sized based offset;
View attachment 150260
I've messed with the body size and tool range but thats not the problem it seems. Projectile dosent hit enemy properly facing certain directions.
Any suggestions to make the projectiles function properly after adding that bit of code?
I want to use it but change its costGo to MOG_ChronoCT
You will see dash cost, if you want to use it, make it true. If not, then make false
make it like any other tool or skill. there is a skill in the chrono engine demo called plasma wave which is a lot like a kamehameha. you could try tweaking that skill to work for ABS mode instead of Chrono mode.Does anyone know how I can use beam like Dragon ball Z (Kamehameha, Masenko, etc).
Just like that
Did you solve it?I'm having a issue with the unlock poses plugin. It works great except it doesn't seem to want to work at the main file. What I mean is that if I want my Actor to have something like !$Hero01 (F6) (S1) for their walking around sprite (which would be the base file name) it causes a lot of issues. Is there a way around this?
var fs = require ("fs");
//yanfly's doodads have a solution for path name changing when deployed
//which I am using!
var path = require('path');
var base = path.dirname(process.mainModule.filename);
//let dir = fs.readdirSync( './img/characters/' );
let dir = fs.readdirSync( path.join(base, '/img/characters/'));
$gameSystem.crossEngine.characterNameList = dir.filter( elm => elm.match(new RegExp(`.*\.(png)`, 'ig')));
$gameSystem.crossEngine.characterNameListLC=['hello world'];//this should never appear in game.
//slice off the .png extension
for (var index =0; index<this.crossEngine.characterNameList.length;index++)
{
$gameSystem.crossEngine.characterNameList[index]=this.crossEngine.characterNameList[index].slice(0, -4);
//create a lower case version of it so that we can do case matching for poses
$gameSystem.crossEngine.characterNameListLC[index]=this.crossEngine.characterNameList[index].toLowerCase();
}
Yea but its been so long I forgot what i did... lolDid you solve it?
just as in original chrono engine, you can put "Dead Switch Id : 7" (or whatever the switch number you want) in a boss's note box. That will flip a switch when the boss gets killed.How I can make a boss battle death explosion?
When I play the original demo version, boss battle death vanished after I beat them.
I want to make boss battle death explosion, burning, and etc...