Event through event

In my abs I need that enemies pass through the other events on the map, but non through the walls. I've found this lines for rmvx ace and I need a conversion to mv.



module Dhoom
  module EventPassability
    Passability_Syntax = "Through_Event_Passability"
  end
end


class Game_CharacterBase
  def collide_with_events?(x, y)
    $game_map.events_xy_nt(x, y).any? do |event|
      return false if event_comment_through? and event.event_comment_through?
      event.normal_priority? || self.is_a?(Game_Event)
    end
  end
 
  def event_comment_through?
    return false if !self.is_a?(Game_Event)
    @list.each do |list|
      return true if list.code == 108 and list.parameters.include?(Dhoom::EventPassability:😛assability_Syntax)
    end
    return false
  end
end


I hope the request is clear.


Can someone help me? Thanks.
Save into your js/plugins folder.  Name shouldn't matter.


I haven't tested this.  If it doesn't work, open the console and show a screenshot of the error messages.

Code:
/*:
 * @plugindesc Allows events to walk through other events
 <eventthroughevent>
 * @author Dhoom
 *
 * @param Passability Syntax
 * @desc Comment text for through event
 * @default Through Event Passability
 *
 * @help  This plugin does not provide plugin commands.
 */

(function() {
  
  var parameters = $plugins.filter(function(p) { return p.description.contains('<eventthroughevent>'); })[0].parameters;
  var passabilitySyntax = String(parameters['Passability Syntax'] || 'Through Event Passability');
  
  Game_CharacterBase.prototype.isCollidedWithEvents = function(x, y) {
    var events = $gameMap.eventsXyNt(x, y);
    return events.some(function(event) {
      return false if this.isEventCommentThrough() and event.isEventCommentThrough();
      return event.isNormalPriority();
    }.bind(this));
  };
  
  Game_CharacterBase.prototype.isEventCommentThrough = function() {
    return false if !this.list();
    return this.list().some(function(cmd) {
      return (cmd.code === 108 || cmd.code === 408) && (cmd.parameters.some(function(param) {
        return param === passabilitySyntax;
      }));
    });
}();
Save into your js/plugins folder.  Name shouldn't matter.


I haven't tested this.  If it doesn't work, open the console and show a screenshot of the error messages.



/*:
* @plugindesc Allows events to walk through other events
<eventthroughevent>
* @author Dhoom
*
* @param Passability Syntax
* @desc Comment text for through event
* @default Through Event Passability
*
* @help This plugin does not provide plugin commands.
*/

(function() {

var parameters = $plugins.filter(function(p) { return p.description.contains('<eventthroughevent>'); })[0].parameters;
var passabilitySyntax = String(parameters['Passability Syntax'] || 'Through Event Passability');

Game_CharacterBase.prototype.isCollidedWithEvents = function(x, y) {
var events = $gameMap.eventsXyNt(x, y);
return events.some(function(event) {
return false if this.isEventCommentThrough() and event.isEventCommentThrough();
return event.isNormalPriority();
}.bind(this));
};

Game_CharacterBase.prototype.isEventCommentThrough = function() {
return false if !this.list();
return this.list().some(function(cmd) {
return (cmd.code === 108 || cmd.code === 408) && (cmd.parameters.some(function(param) {
return param === passabilitySyntax;
}));
});
}();

Thanks Shaz, but doesn't work. Doesn't return any error but not work.
And you've got Through Event Passability as a comment on both events?  Can you show screenshots of them both please?
Yes i did it. I've tested on rmvx ace and works well. I attach the screenshot as soon as possible.


EDIT: I had not seen this error: error.png
Save into your js/plugins folder.  Name shouldn't matter.


I haven't tested this.  If it doesn't work, open the console and show a screenshot of the error messages.



/*:
* @plugindesc Allows events to walk through other events
<eventthroughevent>
* @author Dhoom
*
* @param Passability Syntax
* @desc Comment text for through event
* @default Through Event Passability
*
* @help This plugin does not provide plugin commands.
*/

(function() {

var parameters = $plugins.filter(function(p) { return p.description.contains('<eventthroughevent>'); })[0].parameters;
var passabilitySyntax = String(parameters['Passability Syntax'] || 'Through Event Passability');

Game_CharacterBase.prototype.isCollidedWithEvents = function(x, y) {
var events = $gameMap.eventsXyNt(x, y);
return events.some(function(event) {
return false if this.isEventCommentThrough() and event.isEventCommentThrough();
return event.isNormalPriority();
}.bind(this));
};

Game_CharacterBase.prototype.isEventCommentThrough = function() {
return false if !this.list();
return this.list().some(function(cmd) {
return (cmd.code === 108 || cmd.code === 408) && (cmd.parameters.some(function(param) {
return param === passabilitySyntax;
}));
});
}();





You use strange javascript syntax @Shaz


this


return false if this.isEventCommentThrough() and event.isEventCommentThrough();




is same to this ? no ?

Code:
	  if (this.isEventCommentThrough() && event.isEventCommentThrough()) {
	  return false;
	  }
I've tried with:


      if (this.isEventCommentThrough() && event.isEventCommentThrough()){
        return false;
      }


but return this error: SyntaxError: Unexpected end of input
was it referring to that line in particular?


@Jonforum that's what I get from working simultaneously with ruby and js.  And not taking the time to test myself because it appeared to be such a simple script (and I didn't have a lot of time when I did it).


Here you go - this works for me.  Looks like MV had some extra functions that Ace didn't have, so it wasn't just a simple 'convert from Ruby to JS'.

Code:
/*:
 * @plugindesc Allows events to walk through other events
 <eventthroughevent>
 * @author Dhoom
 *
 * @param Passability Syntax
 * @desc Comment text for through event
 * @default Through Event Passability
 *
 * @help  This plugin does not provide plugin commands.
 */

(function() {

  var parameters = $plugins.filter(function(p) { return p.description.contains('<eventthroughevent>'); })[0].parameters;
  var passabilitySyntax = String(parameters['Passability Syntax'] || 'Through Event Passability');

  Game_Event.prototype.isCollidedWithEvents = function(x, y) {
    var events = $gameMap.eventsXyNt(x, y);
    return events.some(function(event) {
      return !(this.isEventCommentThrough() && event.isEventCommentThrough());
    }.bind(this));
  }

  Game_CharacterBase.prototype.isEventCommentThrough = function() {
    if (!this.list()) { return false };
    return this.list().some(function(cmd) {
      return (cmd.code === 108 || cmd.code === 408) && (cmd.parameters.some(function(param) {
        return param === passabilitySyntax;
      }));
    });
  };
}());
Perfect! Thank you Shaz.

Original thread: https://forums.rpgmakerweb.com/threads/event-through-event.72178/