Altimit Pixel Movement [0.50β]

● ARCHIVED · READ-ONLY
Started by xilefian 545 posts Page 23 of 28 View original ↗
  1. Restart said:
    What other plugins do you have?



    Rough stab at it

    Code:
    Game_CharacterBase.prototype.goTowardsPlayer = function (){
        var vx = $gamePlayer.x - this.x; 
        var vy = $gamePlayer.y - this.y; 
        var length = Math.sqrt( vx * vx + vy * vy ); 
        if ( length > this.stepDistance ) {
            this.setDirectionVector( vx, vy );
            vx *= 1/length;
            vy *= 1/length;
            this._moveTarget = true;
            this._moveTargetSkippable = true;
            this._moveTargetX = this.x + vx ;
            this._moveTargetY =  this.y + vy;
            }
    }
    
    Game_CharacterBase.prototype.setSelf = function(switchName,switchValue)
    {
    var key = [$gameMap._mapId, this._eventId, switchName];
    $gameSelfSwitches.setValue(key, switchValue);
    }
    
    //calculates the distance from an event to a given point.
    Game_CharacterBase.prototype.distanceToPoint = function(xcoord,ycoord)
    {
        var distance = Math.sqrt( (this.x-xcoord)*(this.x-xcoord) + (this.y-ycoord)*(this.y-ycoord) );
        return distance;
    }

    page one move route on repeat (can have 'wait' commands in the middle so it only scans occasionally)

    Code:
    if (this.distanceToPoint($gamePlayer.x,$gamePlayer.y)<5){setSelf('d',true)}
    page two with 'd' active

    Code:
    if (this.distanceToPoint($gamePlayer.x,$gamePlayer.y)>5){setSelf('d',false)}else{this.goTowardsPlayer()}


    for seeing it you'd have to include a 'cansee' function, which would be a lot more elaborate (since it needs to scan for walls)
    I dont think i understand where id have to put this code? cause this is the fix to the lag you get when having the yanfly event chase player plugin right?
  2. Sweetmayham said:
    I dont think i understand where id have to put this code? cause this is the fix to the lag you get when having the yanfly event chase player plugin right?
    The first block of code might fit in a script box but it's better if you put it in a javascript (.js) plugin file so any event can call it. You can stick it at the end of AltimitMovement.js or create your own MyScripts.js and put it in the plugins folder of your project, then import it in the plugin manager

    Then you call it in the event through its event pages
  3. AquaEcho said:
    The first block of code might fit in a script box but it's better if you put it in a javascript (.js) plugin file so any event can call it. You can stick it at the end of AltimitMovement.js or create your own MyScripts.js and put it in the plugins folder of your project, then import it in the plugin manager

    Then you call it in the event through its event pages
    So i did what you said and sticked the script at the end like this: 1677753885691.pngand the events like this:
    1677753928074.png 1677753964183.png
    Yet when i run the game literally nothing happens, i KNOW im doing something wrong but i dont know what
  4. Sweetmayham said:
    So i did what you said and sticked the script at the end like this: View attachment 254734
    Yet when i run the game literally nothing happens, i KNOW im doing something wrong but i dont know what
    Because you stuck that code inside the last function in AltimitMovement.js. Those curly braces close the function. You need to stick it after EVERYTHING at the very end of the file. This script isn't part of AltimitMovement.js but since you have AltimitMovement.js added as a plugin to your project your project can call any code that's placed in that file.

    You also changed the this.character(0) condition on the event pages. If you're going to run this script on the event page it needs to be this.character(0) and not just this
  5. AquaEcho said:
    Because you stuck that code inside the last function in AltimitMovement.js. Those curly braces close the function. You need to stick it after EVERYTHING at the very end of the file. This script isn't part of AltimitMovement.js but since you have AltimitMovement.js added as a plugin to your project your project can call any code that's placed in that file.

    You also changed the this.character(0) condition on the event pages. If you're going to run this script on the event page it needs to be this.character(0) and not just this
    So this.character(0) needs to be this.character(0) ? i dont get it its the same text right?
  6. Sweetmayham said:
    So this.character(0) needs to be this.character(0) ? i dont get it its the same text right?
    If the script is in a moveroute you can use this. If the script is on the event page itself it uses this.character(0)
  7. AquaEcho said:
    If the script is in a moveroute you can use this. If the script is on the event page itself it uses this.character(0)
    It still dosnt seem to work am i maybe missing something else in the events? i really dont seem to understand

    1677798306962.png
  8. In the first line change this to this.character(0)
    You're also telling it to do the same thing twice. You don't need everything in the curly braces on the first and second pages because that's what everything after the first line is telling the program to do.
  9. AquaEcho said:
    In the first line change this to this.character(0)
    You're also telling it to do the same thing twice. You don't need everything in the curly braces on the first and second pages because that's what everything after the first line is telling the program to do.
    Okay so it works now! but how do i make an event happen such as a touching the player turns to a battle or runs another event? also cant figure that out
  10. Sweetmayham said:
    Okay so it works now! but how do i make an event happen such as a touching the player turns to a battle or runs another event? also cant figure that out
    Tell it to trigger if the event is less than one square away from you
    Edit: Sorry, attached the wrong image at first
  11. AquaEcho said:
    Tell it to trigger if the event is less than one square away from you
    Edit: Sorry, attached the wrong image at first
    Yess its working properly now! thank you youve bin a huge help
  12. Snowcone said:
    It's been a while since I have tried using this plugin, but does it support being able to turn off the pixel movement with a script call? This would be insanely useful for our project.
    Because it's very difficult to turn off a plugin without breaking a lot of things, would it be enough to restrict everything's movement to 8 directions and set every event on the map to 1x1 square area collision?
  13. Snowcone said:
    Seems to be exactly what I need, *seems* anyway, not too sure.

    Shoot, writing this I just realized that this is the pixel movement plugin that heavily changes collision... so I am assuming this does not work with yanfly reigon restrictions? Because if not I don't think I could use this plugin at all D:

    But basically in a perfect scenario, I would need it to work with that plugin, be able to switch to tile based, 4 and 8 directions when needed (even with a re-load). Might be a tad too complicated of a feat, so I could always write a request about something like that later.
    Restart fixed Yanfly Region Restrictions compatibility in his Cross Engine. I'll see if I can find the relevant part in the code
  14. Snowcone said:
    And just to be clear I would need it to work with region restrictions for the pixel movement areas as well, otherwise I cannot use it for our project as we are going for a drawn out map type layouts rather than tiling system (except for things you walk under, etc.).
    Try this solution from Restart
  15. Afternoon all.

    Sorry if a similar question has come up but there's also like 20+ pages ^_^.

    I have a "bed" event where the Actor is meant to walk into the bed, rest, and then walk off the tile.

    Currently its set up like so

    1678300970617.png
    1678300983073.png

    However with this plugin enabled its a bit buggy since its player the collision detection kicks in the moment the player reaches that title. How would I work adjust so instead of:

    1678301093892.png

    I get this:

    1678301142593.png


    Thanks in advance
  16. Separate point: It appears oddly that this plugin is causing my "Show Choices" to repeat after selection. I only realized this is the cause because i disabled the plugin to show the screenshots. Anyone run into that before?
  17. Puppet Knight said:
    Afternoon all.

    Sorry if a similar question has come up but there's also like 20+ pages ^_^.

    I have a "bed" event where the Actor is meant to walk into the bed, rest, and then walk off the tile.

    Currently its set up like so

    View attachment 255456
    Set this top bedsheet event to Options>Through

    Puppet Knight said:
    Separate point: It appears oddly that this plugin is causing my "Show Choices" to repeat after selection. I only realized this is the cause because i disabled the plugin to show the screenshots. Anyone run into that before?
    Try telling it to wait 3 frames after selecting a choice because it's probably registering multiple button presses even if you just press it once. This happens if you hold the button for longer than it likes.