How to push objet

Look the code I try to use.  Unfortunatly, if I push objet that can't move, that also do the sound of course. How to solve that?


By the way, if you have a way to put all on a plugin that will be great because I will use this relly ofter.

case.png
Wrap all of that in the following conditional branch:

Code:
Conditional Branch: Script: this.isMapPassable(this.x, this.y, $gamePlayer.direction())
  play SE
  move route for object
  move route for player (?)
Branch End

This way it will check if the object CAN move away from the player, and will only do the rest of the steps if that's possible.  I'm just assuming you've got one move route for the object and one for the player.
You my hero!!! =:0)


Ho, I got error "undefined is not a function" any idea why?


What I try:


this.isMapPassable(this.x,this.y,$gamePlayer.direction())


this.isMapPassable(this.x, this.y, $gamePlayer.direction())


this.isMapPassable(this.x,this.y,gamePlayer.direction())


this.isMapPassable($this.x,$this.y,$gamePlayer.direction())


this.isMapPassable(this.x,this.y,$gamePlayer.direction())


this.isMapPassable(this.x,this.y,$gamePlayer.direction())=true


this. prototype .isMapPassable(this.x,this.y,$gamePlayer.direction())


myeventname.isMapPassable(myeventname.x,myeventname.y,$gamePlayer.direction())


Nothing work


I finnaly try this:


$gamePlayer.isMapPassable(this.x, this.y, $gamePlayer.direction())


I dont get an error with that but get no reaction, when I check value of this.x and this.y that give 0 0. I try replace them by a value and that work. Why this is not reconized?
can you show the console log?  It has more useful information.
can you show the console log?  It has more useful information.

of course, how I do that? I will try to find how in case I found it before you answer me.


Ok found on forum, with F8 right?


If I put your exact code I got:


TypeError: undefined is not a function
    at Game_Interpreter.eval (eval at <anonymous> (file:///C:/Games/Project8/js/rpg_objects.js:9274:37), <anonymous>:1:6)
    at Game_Interpreter.command111 (file:///C:/Games/Project8/js/rpg_objects.js:9274:20)
    at Game_Interpreter.executeCommand (file:///C:/Games/Project8/js/rpg_objects.js:8897:34)
    at Game_Interpreter.update (file:///C:/Games/Project8/js/rpg_objects.js:8805:19)
    at Game_Map.updateInterpreter (file:///C:/Games/Project8/js/rpg_objects.js:6082:27)
    at Game_Map.update (file:///C:/Games/Project8/js/rpg_objects.js:5989:14)
    at Scene_Map.updateMain (file:///C:/Games/Project8/js/rpg_scenes.js:417:14)
    at Scene_Map.updateMainMultiply (file:///C:/Games/Project8/js/rpg_scenes.js:409:10)
    at Scene_Map.update (file:///C:/Games/Project8/js/rpg_scenes.js:398:10)
    at Function.SceneManager.updateScene (file:///C:/Games/Project8/js/rpg_managers.js:1788:25)


If I put: $gamePlayer.isMapPassable(this.x, this.y, 8)


then that will not give an error but this.x and this.y will alway have value of 0.
By the way, did I need to do something speficic for other user to know that I answer theyr question? Did I need to quote them? That take a lot of time to get answer and I understand that nobody is paid for help so Im jsut curious if I do thing corectly for other user to be able to see my reply.
Please do read our forum rules, which state to not double post.


Shaz will reply whenever she has the time, or other members will pitch in. By the way, I get the same error.
I'm sorry - I wrote that in Game_Event context, completely overlooking the fact that script calls get run in Game_Interpreter context.


This is the command you need to put in the script call (tested and working):

Code:
e = this.character(0); e.isMapPassable(e.x, e.y, $gamePlayer.direction())
Thanks my problem is solve now =:0) If I want to do some more thing with this objet and need help I must continue asking on this tread or I need to start a new tread?


Also, if I have many question, did I needto ask all of them in same tread or I need to post each question in a different tread? How many tread I can start in same time?
one thread per topic.  So if you need more help with pushing this item, you can ask it in this thread.  But if you need help with something different, it's a new thread.


There is no limit to how many threads you can have open at once.  Just try not to flood the forum with lots of threads.  One way to avoid this is to search for an already-posted solution first, then if you can't find one, make your own thread.
I jsut discovert that the code did't work in all situation.

I jsut discovert that this code did't work in all situation:



e = this.character(0); e.isMapPassable(e.x, e.y, $gamePlayer.direction())


It's work as long that he not enconter another event. If another event blocking the path, that will return true event if he can't push the objet. Any idea why?
Ah, sneaky MV renamed the passable? method in Game_CharacterBase.


Try changing isMapPassable to canPass - this does the original check for map passability as well as checking the THROUGH flag and whether it collides with anything.  All the parameters stay the same.
Ah, sneaky MV renamed the passable? method in Game_CharacterBase.


Try changing isMapPassable to canPass - this does the original check for map passability as well as checking the THROUGH flag and whether it collides with anything.  All the parameters stay the same.

I just replace by canPass but work the same way. If I push the objet and a monster is on the way, or another objet, it's will return true.


By the way, I discover that this objet can pass overt another "ground" event. I understand a event is a event, but anyway to make the objet be blocked by monster but able to pass overt a switch on the floor?
are the events the same priority?
are the events the same priority?



Same priority? Im not sure to understand what did you mean by that? If you mean position about player... The witch in the ground is bellow player and the ball is same level then player. By the way are you the good person to report a translation error in rpg maker mb french? Under and over player are interverted in french...
I think there's a translation errors forum or thread where you can report that.  I have nothing to do with it, sorry.


Yes, that's what I meant by priority - where it says below/same as/above characters.
I think there's a translation errors forum or thread where you can report that.  I have nothing to do with it, sorry.


Yes, that's what I meant by priority - where it says below/same as/above characters.



Ok, they are not on the same level.
I still making some test but unfortunatly that don't work corectly. Because it's return true if an event is on the way. Any idea why?


e = this.character(0); e.isMapPassable(e.x, e.y, $gamePlayer.direction())
Try changing isMapPassable to canPass - this does the original check for map passability as well as checking the THROUGH flag and whether it collides with anything.  All the parameters stay the same.

Original thread: https://forums.rpgmakerweb.com/threads/how-to-push-objet.62623/