Envision, Create, Share

Welcome to HBGames, a leading amateur game development forum and Discord server. All are welcome, and amongst our ranks you will find experts in their field from all aspects of video game design and development.

Events on Events

Status
Not open for further replies.
I made a post about this in the General Support forum, and I was told that my best bet is to request a script :thumb:

I'm making a Zelda game, but the enemies are causing a bit of the problem. When Link strikes an enemy with a sword, they slide back a few tiles. When an enemy is in front of another enemy and is hit by the sword, it doesn't slide back at all and just trades hits with the player. This also makes fighting mobs of enemies impossible. The monsters just end up surrounding you, and no matter what you do, they will never get knocked back, and you end up watching poor Link die, heart by heart.

Now if I set the enemies to Through, this doesn't help either because they can walk on walls and solid objects. In Zelda III (A Link to the Past), enemies could step over each other and were unable to step on walls. I would like to request a script that does just that, perhaps allowing you to adjust if the event is solid or not through a comment or script? I would also like the player to be able to pass through them. Making it compatable with SDK 1.5 would be nice.

Thank you for taking your time to read my request! ^_^
 
As I was the one that suggested a script may be a better alternative, I will clarify and suggest am few other ways this script could work.

By adding a comment to an event, that event retains it's through properties, however cannot pass through tiles flagged as 'X' in the database editor. Therefore, that event can pass through both other on screen moving events and the hero.

He wants it so that when you strike back an enemy, they will slide backwards 2 tiles, sliding through other enemies and being able to walk over, but not able to walk through the walls of the map.

This is useful in other situations. For on screen enemies that can fly for example, or ones that are ghosts, they can still pass through/over one another, but not leave the defined dungeon area the player has set out and therefore still pose a threat on the players route.

It can also be useful for little animals that inhabit forests or towns such as mice. With this, they wouldn't be able to trap the player in but wouldn't be walking on houses either.

And puzzles... loads of different ideas for that.
 
All you really need to do is create some tag for your enemies, such as a comment with something like
Code:
Comment : ABS Enemy

Now, something like this:
Code:
class Game_Event
  attr_reader :is_an_abs_enemy
  alias_method :seph_absenemyread_gmevt_refresh, :refresh
  def refresh
    seph_absenemyread_gmevt_refresh
    @is_an_abs_enemy = false
    return if @erased || @list.nil?
    for event_command in @list
      next unless [108, 408].include?(event_command.code)
      next unless event_command.parameters[0].upcase == 'ABS Enemy'
      @is_an_abs_enemy = true
      break
    end
  end
end

Now, $game_map.events[event_id].is_an_abs_enemy will tell whether an event is also an abs enemy.

Now, in Game_Character 1, find:
Code:
    # Loop all events
    for event in $game_map.events.values
      # If event coordinates are consistent with move destination
      if event.x == new_x and event.y == new_y

Replace it with:
Code:
    # Loop all events
    for event in $game_map.events.values
      # Skip If ABS Enemy
      next if event.is_an_abs_enemy
      # If event coordinates are consistent with move destination
      if event.x == new_x and event.y == new_y


Review:
1) Paste class Game_Event block in new script above main
2) Find and replace parts in Game_Character 1
3) Give your events comment with ABS Enemy (Non-Case Sensitive)

I haven't tried, so let me know if it doesn't work.
 
I've tried it out and it doesn't seem to be doing anything. I placed the comment on the first page of the event, then copy-and-pasted that same event next to it. When they start chasing Link they still seem to be completely solid.

Thanks for all of your help, Seph and Calibre ^_^
(Just because I gave out thank yous doesn't mean this thread should be closed just yet ^-^)
 
Never mind, I got it to work. I just changed your script a little (it's odd I got it to work since I have NO scripting skills whatsoever). Thanks again Seph, you can do your closing and mark this thread as "[Resolved]" now ^_^
 
Status
Not open for further replies.

Thank you for viewing

HBGames is a leading amateur video game development forum and Discord server open to all ability levels. Feel free to have a nosey around!

Discord

Join our growing and active Discord server to discuss all aspects of game making in a relaxed environment. Join Us

Content

  • Our Games
  • Games in Development
  • Emoji by Twemoji.
    Top