Altimit Pixel Movement [0.50β]

Restart

Veteran
Veteran
Joined
Mar 15, 2019
Messages
523
Reaction score
410
First Language
English
Primarily Uses
RMMV
doesn't work, even when i clone a new js file to turn the param on. Creating a new map let i run around in the first time on that map, but not the second
What other plugins do you have?

This plugin is not compatible with Yanfly Event Chase (http://www.yanfly.moe/wiki/Event_Chase_Player_(YEP) ). As soon as the "chase" is initiated there is massive lag. Anyone know why this happens? Any potential hack or workaround to fix it? If not, any alternative plugins compatible with Altimit that achieve a similar effect (making events that will chase the player or flee from the player when the player enters within range of the event or when the event sees the player)?
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)
 

Barbbugg

Bug fanatic
Member
Joined
Jun 16, 2020
Messages
8
Reaction score
1
First Language
English
Primarily Uses
RMMV
It would seem that the '$gamePlayer.isMoving()' check has been rendered non-functional as a side-effect with this. Would anyone be willing to look into why that could be?

Edit: on my second look, I noticed that someone already brought this up. My bad. I will see if the solution provided still works.
 
Last edited:

Restart

Veteran
Veteran
Joined
Mar 15, 2019
Messages
523
Reaction score
410
First Language
English
Primarily Uses
RMMV
It would seem that the '$gamePlayer.isMoving()' check has been rendered non-functional as a side-effect with this. Would anyone be willing to look into why that could be?

Edit: on my second look, I noticed that someone already brought this up. My bad. I will see if the solution provided still works.
yeah sorry that my workaround for that is kind of slapdash, if anyone understands the plugin better I'd appreciate it if they made it work properly
 

Barbbugg

Bug fanatic
Member
Joined
Jun 16, 2020
Messages
8
Reaction score
1
First Language
English
Primarily Uses
RMMV
yeah sorry that my workaround for that is kind of slapdash, if anyone understands the plugin better I'd appreciate it if they made it work properly
I've been messing around with your workaround for a bit and I just can't seem to get it to work. What exactly was I supposed to do to utilize your fix? I'm afraid I'm not the most familiar with javascript, and even less familiar with how MV's engine is really set up on terms of character functions and such.
 
Last edited:

Restart

Veteran
Veteran
Joined
Mar 15, 2019
Messages
523
Reaction score
410
First Language
English
Primarily Uses
RMMV
I've been messing around with your workaround for a bit and I just can't seem to get it to work. What exactly was I supposed to do to utilize your fix? I'm afraid I'm not the most familiar with javascript, and even less familiar with how MV's engine is really set up on terms of character functions and such.
basically instead of using .isMoving(), which is broken in a way that I don't understand, just replace that command entirely with ._inMotion

It means you still have to patch scripts but at least it's an easy find and replace




Another bugfix: the random movement character setting goes 1-8, so characters have a 12% chance of staying in the middle (roll of 5), and a 0% chance of going to the top right

Code:
      Game_Character.prototype.moveRandom = function() {
        if ( this._moveTarget ) {
          return;
        }

        var d = 1 + Math.randomInt( 8 );
To fix

Code:
     Game_Character.prototype.moveRandom = function() {
        if ( this._moveTarget ) {
          return;
        }
var d = [1,2,3,4,6,7,8,9][Math.randomInt(8)]
There's another one elsewhere, replace it the same way
Code:
      Game_Interpreter.prototype.altMovementCommandToDirection = function( command ) {
        var gc = Game_Character;
        switch ( command ) {
        case gc.ROUTE_MOVE_DOWN:
          return 2;
        case gc.ROUTE_MOVE_LEFT:
          return 4;
        case gc.ROUTE_MOVE_RIGHT:
          return 6;
        case gc.ROUTE_MOVE_UP:
          return 8;
        case gc.ROUTE_MOVE_LOWER_L:
          return 1;
        case gc.ROUTE_MOVE_LOWER_R:
          return 3;
        case gc.ROUTE_MOVE_UPPER_L:
          return 7;
        case gc.ROUTE_MOVE_UPPER_R:
          return 9;
        case gc.ROUTE_MOVE_RANDOM:
          return 1 + Math.randomInt( 8 );
 
Last edited:

Barbbugg

Bug fanatic
Member
Joined
Jun 16, 2020
Messages
8
Reaction score
1
First Language
English
Primarily Uses
RMMV
basically instead of using .isMoving(), which is broken in a way that I don't understand, just replace that command entirely with ._inMotion

It means you still have to patch scripts but at least it's an easy find and replace
I've tried sticking the code various places (such as it's own plugin, and I even tried tucking it right under isMoving itself in rpg_objects itself.. both those, and other miscellaneous attempts were letter-for-letter what you posted.), but no matter where I put it the output gives me the TypeError "$gamePlayer.inMotion is not a function". I'm using isMoving in just the same way as you would inMotion, by calling "$gamePlayer.inMotion()". I get the same problem if I turn off all other plugins, as well. It's highly likely that I'm still doing this wrong somehow. I apologize for being this stupid, but could you walk me through exactly how you implemented this workaround? I feel really bad for having to ask you this, I have tried asking other people to help me with it but they didn't understand it either.
 
Last edited:

Restart

Veteran
Veteran
Joined
Mar 15, 2019
Messages
523
Reaction score
410
First Language
English
Primarily Uses
RMMV
instead of calling it as a function, use it as a property - replace ".isMoving()" with "._inMotion"

as an example, turn

Code:
if (!this.isMoving()) {return false};
into

Code:
	if (!this._inMotion) {return false};
 

Barbbugg

Bug fanatic
Member
Joined
Jun 16, 2020
Messages
8
Reaction score
1
First Language
English
Primarily Uses
RMMV
instead of calling it as a function, use it as a property - replace ".isMoving()" with "._inMotion"

as an example, turn

Code:
if (!this.isMoving()) {return false};
into

Code:
    if (!this._inMotion) {return false};
Hm.. how do I call this property in the context of a conditional branch, though? "$gamePlayer._inMotion" in the script field does nothing at all. And, assumedly, 'this' does not work in this context since I need to access this player property from an event. I tried it anyway, and plugged "this._inMotion" into the conditional branch, and it did nothing either.
 

Restart

Veteran
Veteran
Joined
Mar 15, 2019
Messages
523
Reaction score
410
First Language
English
Primarily Uses
RMMV
Okay... I'm not sure what's going on, then, because if you added the code block from my earlier post every character/event object should have an ._inMotion property, with a value of either true or false. #worksforme

The only thing I can think is that whatever .js file you stuck it in has a syntax error and is getting rejected by RMMV.
 

Barbbugg

Bug fanatic
Member
Joined
Jun 16, 2020
Messages
8
Reaction score
1
First Language
English
Primarily Uses
RMMV
Okay... I'm not sure what's going on, then, because if you added the code block from my earlier post every character/event object should have an ._inMotion property, with a value of either true or false. #worksforme

The only thing I can think is that whatever .js file you stuck it in has a syntax error and is getting rejected by RMMV.
I've currently got it in rpg_objects. If that file were to be rejected, the whole game just wouldn't work, right? The console is not firing any errors while I am trying to call '$gamePlayer._inMotion' either.. I'm going to attach a screenshot of where I have it, right under isMoving.. tell me if you spot anything that doesn't look right. I pasted the whole thing right in so I don't know what could be wrong here.

Edit: I wonder, it at all possible that we are using different versions of MV? I'm on 1.6.2, but I'm wondering if you're on an older version for one of your projects, and that's where you might have tested this.. and there might be some sort of difference between versions interfering with this. Seems unlikely.. but it's worth asking, I think.
 

Attachments

Last edited:

Restart

Veteran
Veteran
Joined
Mar 15, 2019
Messages
523
Reaction score
410
First Language
English
Primarily Uses
RMMV
you should be sticking it in as a little snippit at the end
 

Barbbugg

Bug fanatic
Member
Joined
Jun 16, 2020
Messages
8
Reaction score
1
First Language
English
Primarily Uses
RMMV
you should be sticking it in as a little snippit at the end
It works now! I didn't do anything else other than put it in that different place this time, same paste and all. Thank you very very much for being so patient with me, you're a real game saver.
 

Morpheus

Jack-of-Trades
Veteran
Joined
Mar 14, 2012
Messages
197
Reaction score
48
First Language
english
Primarily Uses
N/A
Its weird for me that this work only for 1 time per map. even when i refreshed the game
Code:
rpg_managers.js:1949 TypeError: Cannot read property 'right' of undefined
    at Function.Collider.aabboxCheck (Pixel.js:4153)
    at Function.Collider.polygonsWithinColliderList (Pixel.js:3363)
    at Function.Collider.polygonsWithinColliderList (Pixel.js:3365)
    at Function.Collider.polygonsWithinColliderList (Pixel.js:3365)
    at Game_Player.Game_CharacterBase.moveVectorMap (Pixel.js:1009)
    at Game_Player.Game_CharacterBase.moveVector (Pixel.js:1080)
    at Game_Player.moveByInput (Pixel.js:1555)
    at Game_Player.update (Pixel.js:1416)
    at Scene_Map.updateMain (rpg_scenes.js:609)
    at Scene_Map.updateMainMultiply (rpg_scenes.js:600)
SceneManager.catchException @ rpg_managers.js:1949
I get this error too. Worked one time and stopped working after that.
 

Restart

Veteran
Veteran
Joined
Mar 15, 2019
Messages
523
Reaction score
410
First Language
English
Primarily Uses
RMMV
do you have any other plugins running, particularly ones that might be spawning events?
 

doriantoki

Veteran
Veteran
Joined
Dec 20, 2012
Messages
115
Reaction score
29
First Language
English
Primarily Uses
RMMV
I've also encountered this issue, it is now fixed as of the latest version on GitHub.

What was happening was the move random command was being called multiple times before the previous move command was completed, so it was continuously moving-randomly, causing it to take tiny steps rather than move 1 tile distances.

For the next beta I'm going to work on custom move options, one of which is optionally disabling the ability for random movement to go diagonally. It will also include Plugin commands for moving events in small steps and I'll be expanding on the ability to toggle on/off the grid adjacent alignment of move commands.


Thank you very much for the help in identifying these issues and helping to get them fixed.
This didn't seem to fix it ...

NPCs are still just randomly nudging along at 1 pixel.

Also, using the plugin command for random movement interferes with the event if there is a dialogue box attached to it due to needing to Autorun the event to have the random movement work properly. Unless I am missing something obvious here?
 

Barbbugg

Bug fanatic
Member
Joined
Jun 16, 2020
Messages
8
Reaction score
1
First Language
English
Primarily Uses
RMMV
I have not tested this extensively (not really familiar with how region restrictions work), but this seems to work in my quick 5 min test

Put this right above "// Special ladder behaviour" in the Game_CharacterBase.prototype.moveVector function

Code:
            if(Imported.YEP_RegionRestrictions)
        {
            //draw a box around our character and check if it's going into a
            //forbidden region.  if it is, prevent it from doing so.
            var aabbox = this.collider().aabbox;
            var x2=this.x+aabbox.left+move.x; 
            var y2=this.y+aabbox.bottom+move.y;
            //check left and bottom edge
            if (this.isEventRegionForbid(x2, y2, 5)){ move.x=0;move.y=0;}
            if (this.isPlayerRegionForbid(x2, y2, 5)){ move.x=0;move.y=0;}
            var x2=this.x+aabbox.right+move.x;
            //check right and bottom edge
            if (this.isEventRegionForbid(x2, y2, 5)){ move.x=0;move.y=0;}
            if (this.isPlayerRegionForbid(x2, y2, 5)){ move.x=0;move.y=0;}
            var y2=this.y+aabbox.top+move.y;
            //check right and top edge
            if (this.isEventRegionForbid(x2, y2, 5)){ move.x=0;move.y=0;}
            if (this.isPlayerRegionForbid(x2, y2, 5)){ move.x=0;move.y=0;}
            var x2=this.x+aabbox.left+move.x;
            //check left and top edge
            if (this.isEventRegionForbid(x2, y2, 5)){ move.x=0;move.y=0;}
            if (this.isPlayerRegionForbid(x2, y2, 5)){ move.x=0;move.y=0;}
        }
This only work for region restrictions that FORBID movement, the ones that allow movement would be a lot harder to do and probably aren't as important anyway.
This works-- but the player isn't able to sort of "slide along" with these regions like they are with Altimit colliders when pressed right against them. The player getting caught on regions when running away from something could be frustrating. Would it be at all possible for you to implement a modification that would allow the player to slide along to the sides while colliding with these such regions? I can always just use more Altimit colliders (when it comes to the player) if you can't, I just wanted to ask you about this before making that decision.
 

Restart

Veteran
Veteran
Joined
Mar 15, 2019
Messages
523
Reaction score
410
First Language
English
Primarily Uses
RMMV
This works-- but the player isn't able to sort of "slide along" with these regions like they are with Altimit colliders when pressed right against them. The player getting caught on regions when running away from something could be frustrating. Would it be at all possible for you to implement a modification that would allow the player to slide along to the sides while colliding with these such regions? I can always just use more Altimit colliders (when it comes to the player) if you can't, I just wanted to ask you about this before making that decision.
Honestly I don't really know enough to do that. The ideal case would be if someone coded in some kind of target-selectivity option for event colliders (so you could do it all with events), but I don't really have the time to delve into figuring out the ins and outs of it right now.
 

Sardonic

Veteran
Veteran
Joined
Sep 3, 2016
Messages
34
Reaction score
21
First Language
English
Primarily Uses
Does anyone know how to change the dash speed when using this plugin? I was modifying this code in rpg_objects:


Game_CharacterBase.prototype.realMoveSpeed = function() {
return this._moveSpeed + (this.isDashing() ? 1 : 0);
};

But if I change 1 to anything other than 1 I get jittering and slower movement speed when moving up or left. Every other direction works fine, I disabled my other plugins and the problem persisted. Does anybody else have the same problem? Any help would be great.
 

clitvin

Veteran
Veteran
Joined
Oct 26, 2015
Messages
102
Reaction score
12
Primarily Uses
Anyone have any idea on improving the abysmal performance of the Collider.polygonsWithinColliderList function? 15% of the entire game execution is being spent inside this function.
1593888929756.png
1593888962171.png
 

Restart

Veteran
Veteran
Joined
Mar 15, 2019
Messages
523
Reaction score
410
First Language
English
Primarily Uses
RMMV
see what's calling it
 

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

Latest Threads

Latest Posts

Latest Profile Posts

Small rant: While using SRD Hud maker for a battle hud, I typed in the wrong script call and got an error, but then forgot to delete the piece that caused the error before closed the Hud maker and hit F5 to restart the game. Now everytime I engage in a battle my game crashes...
:kaolivid:
Would Jump into Javascript be best off continuing to break down the MV core files, or would people prefer a quick detour to cover everything that's changed in the core from MV to MZ?
Not going to lie... PIXI Particles make fantastic graphics... But predicting the hitbox of something with a "fixed size" but whose graphics can stick out past that, is quite challenging. :kaoswt:
Would you like a glass of spiders?

Forum statistics

Threads
100,530
Messages
976,896
Members
132,081
Latest member
Kaezyelnatz
Top