Notes to Self: Little tweaks, mostly chrono engine

● ARCHIVED · READ-ONLY
Started by Restart 79 posts Page 2 of 4 View original ↗
  1. .
  2. 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?
  3. Restart said:
    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.
    Spoiler
    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.
    Spoiler
    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.
    Spoiler
    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).
    06KeDGA.png

    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.

    Spoiler
    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;
            }
           
    }

    Do you think this would fix the issue I am having with projectiles not properly functioning when I add a body-sized based offset;
    1593991691099.png

    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?
  4. Uranium said:
    Do 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?
    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 basically

    HIdKjTN.png

    I could be wrong though, it's entirely possible that's just how I changed it for cross engine and mog's version is more discrete on a tile-by-tile basis or something.
  5. Wow!!
    How nice to have this topic and how much you are interested in solving the problems generated between Mog vs Yanfly.
    Thank you!
    My case is as follows: I mainly use the Mog Chrono Engine Plugins in ABS mode and some Yanfly plugins.
    When I changed the Event page, adding new events, deleting others and exceeding 100 events in the Event Map, a terrible error started where Ids stopped synchronizing with Ids of their respective skills, weapons and items. I checked all the Ids and they are all synchronized with their respective database Ids, but in the gameplay test, everything is a mess. When I use a weapon, instead of calling the event the weapon, it calls the event a spell. When using an item, it invokes an event map Id completely different from the one the Item is linked to.
    Another problem is related to the Shortcut Screen when pressing the "Q" and "W" keys, which are used to equip Items and Spells, it happens that in some Items MP value (???) and TP and in some Spells some do not the cost of MP appears or there is some crossover between the Skills that instead of appearing the MP value of Magic appears the value of TP of another Skill (???)!
    What I did to fix part of this mess, was to return all Events to their original locations which solved part of the problem which left the Ids connected again, however I was unable to solve the problem of showing MP, TP and cost of Items in some Skills!
    Here are two videos of this problem.

    Error 1:
    Spoiler
    =""


    Error 2:
    Spoiler
    =""
  6. I went to check this Error directly in the Demo of the Chrono Engine and add all the Skills at once for the Characters. And the same problem happened in my project. There is a generalized exchange in the presentation of the costs of Skills and Items. Could you or someone you are familiar with, take a look at this?

    Spoiler
    Error
  7. Just a quick question, maybe someone knows it on here since this is all on the chrono engine, When doing fireball (different attack but very similar) in chrono and not abs, is there a way delay when the projectile fires? My characters attack animation is still going when her "fireball" takes off. Sorry if this isn't the place for that.
  8. Thank you so much for sharing these tweaks! You're awesome! I was so excited to see the patch you made to make Chrono and Itemcore compatible. I am, however, receiving the error: "rangeerror maximum call stack size exceeded" when I try to run the game with all three plugins on. Is there an order I should put them in?

    Edit: I found your fix in another thread and realized it was supposed to be added into the Chrono script and not put in by itself. I feel silly, but at least it's all working now! Thanks a ton!
  9. Hi
    I want to know how to make boss battle death collapse like an explosion, burning, and more death collapse.
    So I can do that? Because I am not good at this.
  10. Hi,

    Would it be possible to add some plugin parameter for the CT plugin? I would like to change the cost of dash and make the charge bar fill slower, please.
  11. Go to MOG_ChronoCT
    You will see dash cost, if you want to use it, make it true. If not, then make false
  12. Killerslash said:
    Go to MOG_ChronoCT
    You will see dash cost, if you want to use it, make it true. If not, then make false
    I want to use it but change its cost :rswt
  13. I have a problem.

    Why do the new skills and weapons I create for chrono mode only work if I start a new game?

    (They don't work on saves that I've already started the project on. They only work if I start a new game.)
  14. Does anyone know how I can use beam like Dragon ball Z (Kamehameha, Masenko, etc).
    Just like that
  15. Killerslash said:
    Does anyone know how I can use beam like Dragon ball Z (Kamehameha, Masenko, etc).
    Just like that
    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.
  16. KillerPixEEL said:
    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?
    Did you solve it?
  17. the unfortunate thing is that you have to redefine your poses if they have a different frame number

    so if you have a six frame walk cycle for a guy
    J1dZvuE.png
    Your file name is gonna be $Hero01(f6)

    The original filename was $Hero01, but we need the f6 to show it's a 6 frame walk cycle

    But let's say he has to jump. Here's the jump sheet. If we were just using the default mog resources, this would be "$Hero01_jump"
    mjB0Piy.png

    However, we upgraded our base sprite to be six frame. If we put in a plain "$Hero01(f6)_jump", it would still see it as being 6 frame, and cut our poor hero in half.

    PGB37me.png

    Instead, we need to specify that our jump is three frames again. So we name it

    "$Hero01(f6)_jump(f3)"

    And it works. Because I have the intelligent pose matching code, it will automatically check for something that matches the beginning of a pose name. If it was looking for _jump before, it will say 'well, I don't have $Hero01(f6)_jump, I'd better see if there's a longer version', and go through the list, and find "$Hero01(f6)_jump(f3)".



    Now, the one quirk that might trip people up is that the list runs at initialization, and is saved to the game system, so it persists through save files. If you need to refresh it, just run the script for building the file path again.

    Code:
    	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();
    	}


    It's inconvenient if you're doing a lot of iterative testing using the same savefile; this thread is detritus from when I have time to do gamedev on my own project so since I don't do that it hasn't come up for me.
  18. 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...
  19. FirelordMaria said:
    Did you solve it?
    Yea but its been so long I forgot what i did... lol
  20. Killerslash said:
    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...
    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.

    Then just have a parallel/autorun event page that requires the dead boss switch, which queues up with whatever SFX you want.