Ergebnis 1 bis 4 von 4

Thema: Suche RGSS Kenner - Passability Abfragen in Movementskript einbauen!

Hybrid-Darstellung

Vorheriger Beitrag Vorheriger Beitrag   Nächster Beitrag Nächster Beitrag
  1. #1
    muh
    Code:
    module Genocide_Movement
    	class :Game_Character
    		def passable?(x, y, d, s = EVENT_DISTANCE, n = get_new_coordinates(x, y, d, s))
    			# Get new coordinates
    			new_x, new_y, dx, dy = *n
    			# If coordinates are outside of map: impassable
    			return false unless $game_map.valid?(new_x, new_y)
    			# If through is ON: passable
    			return true if @through
    			# Get move distance
    			s *= 0.25
    			# Standfeld berechnen
    			fx, fy = x.to_field, y.to_field
    			# Überprüfen, ob neues Feld betreten wird
    			cx = ((x - fx).abs < s and 0 < dx*(new_x - x))
    			cy = ((y - fy).abs < s and 0 < dy*(new_y - y))
    			#if cx and cy
    			#	return false unless $game_map.passable?(fx, fy, d) and $game_map.passable?(fx + dx, fy + dy, 10 - d)
    			if cx
    				return false unless $game_map.passable?(fx, fy, 5 + dx) and $game_map.passable?(fx + dx, fy, 5 - dx)
    				# Wenn y-Koordinate *,5 ist, Feld daneben prüfen
    				if y != fy 
              unless $game_map.passable?(fx, fy + (y <=> fy), 5 + dx) and
    													$game_map.passable?(fx + dx, fy + (y <=> fy), 5 - dx)
                return false
              end
              unless $game_map.passable?(fx + dx, fy + (y <=> fy), 8) and
    													$game_map.passable?(fx + dx, fy + (y <=> fy), fy + dy, 2)
                return false
              end
    				end
          end
    			if cy
    				return false unless $game_map.passable?(fx, fy, 5 - 3*dy) and $game_map.passable?(fx, fy + dy, 5 + 3*dy)
    				# Wenn x-Koordinate *,5 ist, Feld daneben prüfen
    				if x != fx 
              unless $game_map.passable?(fx + (x <=> fx), fy, 5 - 3*dy) and
    													$game_map.passable?(fx + (x <=> fx), fy + dy, 5 + 3*dy)
                return false
              end
              unless $game_map.passable?(fx + (x <=> fx), fy + dy, 4) and
    													$game_map.passable?(fx + (x <=> fx), fy + dy, 6)
                return false
              end
    				end
    			end
    			# Loop all events
    			for event in $game_map.events.values
    				next if event == self or event.through
    				# If through is OFF and (self is player => partner graphic as character)
    				# and event coordinates are consistent with move destination
    				if #not event.through and event.character_name != "" and
    					(self != $game_player or event.character_name != "") and
    					(event.x - new_x).abs < 1 and (event.y - new_y).abs < 1
    					# impassable
    					return false
    				end
    			end
    			# If self is not player, player through is OFF coordinates are consistent
    			# with move destination and your own graphic is the character
    			if self != $game_player and not $game_player.through and
    				@character_name != "" and ($game_player.x - new_x).abs < 1 and
    				($game_player.y - new_y).abs < 1
    				# impassable
    				return false
    			end
    			# passable
    			return true
    		end
      end
    end
    diese boolsche algebra ist die hölle ._.
    wie immer ein ostereierscript...viel spaß beim eier bugs finden. habs nicht ausreichend getestet.^^

    falls du was finden solltest bescheid geben und mir auf die finger haun.

  2. #2
    Man, du hättest aber echt mal sagen können, wie mans einbaut lol xD. Ich hab erst probiert und geguckt, ob mans vllt. ins skript selber einfügt und was überschreibt etc. Aber habs jetzt als neues Skript natürlich reingemacht.

    Und... FUNKTIONIERT! Geil ^^... Vielen Dank! Ich denke mal, es werden keine Bugs auftreten (hoffentlich). Wenn doch, meld ich mich entsprechend .

    greetz

Berechtigungen

  • Neue Themen erstellen: Nein
  • Themen beantworten: Nein
  • Anhänge hochladen: Nein
  • Beiträge bearbeiten: Nein
  •