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.

conditional branch: if something is [side] to event [name]

someone knows how you do something like:
@>conditional branch: [EVENT] has no event at [SIDE]
@>
: Else
@>
: Branch End

its for event script
 
This may works... *no tested* :p
paste this before Main:
Code:
class Interpreter
  def next_to_event
    x = $game_map.events[@event_id].x
    y = $game_map.events[@event_id].y
    $game_map.events.each do |event|
      return true if event.x == x && event.y - 1 == y ||
        event.y + 1 == y
      return true if event.y == y && event.x - 1 == x ||
        event.x + 1 == x
    end
    return false
  end
end

Then type this in the conditional branch:
Code:
next_to_event
 
im getting: script 'conditional branch' line 6: NoMethodError occurred :P
undefined method `X' for #<Array:0x13917c8> :P
btw, i need to be able to choose the side of the vent where nothing should be and i need to be able to choose the event for which it happens
 
Use this instead:
Code:
class Interpreter
  def next_to_event(event_id)
    x = $game_map.events[event_id].x
    y = $game_map.events[event_id].y
    $game_map.events.values.each do |event|
      return true if event.x == x && event.y - 1 == y ||
        event.y + 1 == y
      return true if event.y == y && event.x - 1 == x ||
        event.x + 1 == x
    end
    return false
  end
end

I just added the event shit, so you call it this way:
Code:
next_to_event(id)

And... this is also a request, not support :s
 
Slipknot;279408 said:
Use this instead:
Code:
class Interpreter
  def next_to_event(event_id)
    x = $game_map.events[event_id].x
    y = $game_map.events[event_id].y
    $game_map.events.values.each do |event|
      return true if event.x == x && event.y - 1 == y ||
        event.y + 1 == y
      return true if event.y == y && event.x - 1 == x ||
        event.x + 1 == x
    end
    return false
  end
end

I just added the event shit, so you call it this way:
Code:
next_to_event(id)

And... this is also a request, not support :s

:eek: sorry, didn't know if i had to post this in request or in support

but this still isn't what i meant :(
maybe this explains it
http://www.sendspace.com/file/ci5g7o
 

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