Event through event

Gidan90

Villager
Member
Joined
Mar 30, 2014
Messages
12
Reaction score
0
First Language
Italian
Primarily Uses
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::passability_Syntax)
    end
    return false
  end
end


I hope the request is clear.


Can someone help me? Thanks.
 

Shaz

Veteran
Veteran
Joined
Mar 2, 2012
Messages
40,111
Reaction score
13,715
First Language
English
Primarily Uses
RMMV
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;
      }));
    });
}();
 

Gidan90

Villager
Member
Joined
Mar 30, 2014
Messages
12
Reaction score
0
First Language
Italian
Primarily Uses
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.
 

Shaz

Veteran
Veteran
Joined
Mar 2, 2012
Messages
40,111
Reaction score
13,715
First Language
English
Primarily Uses
RMMV
And you've got Through Event Passability as a comment on both events?  Can you show screenshots of them both please?
 

Gidan90

Villager
Member
Joined
Mar 30, 2014
Messages
12
Reaction score
0
First Language
Italian
Primarily Uses
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
 
Last edited by a moderator:

Jonforum

Veteran
Veteran
Joined
Mar 28, 2016
Messages
1,623
Reaction score
1,440
First Language
French
Primarily Uses
RMMV
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;
	  }
 

Gidan90

Villager
Member
Joined
Mar 30, 2014
Messages
12
Reaction score
0
First Language
Italian
Primarily Uses
I've tried with:


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


but return this error: SyntaxError: Unexpected end of input
 
Last edited by a moderator:

Shaz

Veteran
Veteran
Joined
Mar 2, 2012
Messages
40,111
Reaction score
13,715
First Language
English
Primarily Uses
RMMV
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;
      }));
    });
  };
}());
 

Gidan90

Villager
Member
Joined
Mar 30, 2014
Messages
12
Reaction score
0
First Language
Italian
Primarily Uses
Perfect! Thank you Shaz.
 

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

Latest Threads

Latest Profile Posts

Don't forget, aspiring writers: Personality isn't what your characters do, it is WHY they do it.
Hello! I would like to know if there are any pluggings or any way to customize how battles look?
I was thinking that when you start the battle for it to appear the eyes of your characters and opponents sorta like Ace Attorney.
Sadly I don't know how that would be possible so I would be needing help! If you can help me in any way I would really apreciate it!
The biggest debate we need to complete on which is better, Waffles or Pancakes?
rux
How is it going? :D
Day 9 of giveaways! 8 prizes today :D

Forum statistics

Threads
106,051
Messages
1,018,549
Members
137,837
Latest member
Dabi
Top