Problem ze skryptem View range. - Dakla - 07-03-17 00:01
Witam.
Od pewnego czasu używam skryptu view range, który pozwala zrobić coś na kształt skradanki.
Polega to na tym, że określa się id zdarzenia i zasięg na który zdarzenie ma się uaktywniać. Jeśli bohater wejdzie w zasięg uaktywnia się główny przełącznik (lub zwykły przełącznik) i dzieje się cała reszta.
Problem w tym, że zdarzenie uaktywnia się nawet, jeśli gracz ukrywa się po skosie za przeszkodami to zdarzenie i tak go widzi. Poniżej zamieszczam 2 screeny które pokazują problem.
Nie działa:
![[Obrazek: nie_dzia_a.jpg]](https://s14.postimg.org/4gmxtvb3h/nie_dzia_a.jpg)
A tak normalnie działa skrypt. Nie widzą cię, przez kratki na których
nie da się przejść.
![[Obrazek: dzia_a.jpg]](https://s9.postimg.org/ij6ff40ez/dzia_a.jpg)
Skrypt:
Kod:
#==============================================================================
# ** View Range Script v3 Eta
#------------------------------------------------------------------------------
# Original version by: Near Fantastica
# Original date: June 14, 2005
#
# Modifications/edit by: DerVVulfman
# Modification date: March 28, 2012
#
#==============================================================================
#
# INTRODUCTION:
# The original v3 View Range system allowed a more detailed detection between
# player and event ranges than version 2. Adding the ability to use events to
# detect the player as well as enemy events facing the player added to its
# usefullness.
#
# Unfortunately, when version 2 was released (at least where I found it), the
# instructions for the system's use were only partially correct and did not
# inform the users that the system no longer used the event's self-switches.
# The newer version now used the RMXP Database's regular switches instead.
#
# Though it was not my intention to tangle with the View Range system, luck
# (and a few friends) nudged me into experimenting with this system. As such
# I have not only combined the use of SelfSwitches 'AND' regular switches in
# to the system, I have also added a couple more features for use.
#
# The system now includes a routine to check the range between two different
# events which may be useful for 'collision detection' purposes. Also, I have
# also altered the Event_Sound routine so the user can set a lower volume or
# pitch setting for targettable events.
#
#==============================================================================
#
# PLATFORM:
#
# Designed initially for RPGMaker XP, a minor change lets the system work with
# RPGMaker VX. With that, there is a simple switch called VX_RANGE which you
# can set to 'true' so it can work with RPGMaker VX itself.
#
#
#==============================================================================
#
# THE FUNCTIONS:
#
# There are now four routines that you can use with this system (or 5 if you
# script a routine to use the vr_in_range? method). The four are listed below
# detailing usage and proper syntax for you.
#
#--------------------------------------------------------------------------
#
# Event View
# ==========
# This function checks to see if the player is within the range of an event
# and turns on the properly designated switch.
#
# Syntax:
# $view_range.event_view(ev_id, v_range, sw_id, s_sw_id, block)
#
# ev_id - (Event ID)
# This is the ID number of the event that the radius/range is
# based on. If the player comes within the range of 'this'
# event, the system is triggered.
#
# ev2_id - (Event2 ID)
# This is the ID number of the event
#
# v_range - (View Range)
# This is the range(in tiles) in which to perform the check.
#
# sw_id - (Switch ID) - Defaulted to 'nil'
# The RMXP switch number to turn ON. By default, this is set
# to 'nil'. You must enter a valid Switch number to use.
#
# s_sw_id - (Self Switch ID) - Defaulted to 'nil'
# The 'Self-Switch' for the event to turn ON. Proper values
# to set are "A", "B", "C", or "D". By default, this is set
# to 'nil'. You must enter a valid Self-Switch to use.
#
# block - (Blocked by Tiles) - Defaulted to 'false'
# This is a 'true/false' switch that determines if the view
# range system is unable to see around impassable tiles. By
# default, this is set to 'false'. If it is set to 'true',
# the view range system will not detect the player if it is
# behind an impassable tile or tiles.
#
#--------------------------------------------------------------------------
#
# Event to Event View
# ===================
# This function checks to see if a single event is within the range of
# another event and turns on the properly designated switch. This new
# routine may be useful for collision detection between events.
#
# Syntax:
# $view_range.event2event_view(ev_id, ev2_id, v_range, sw_id, s_sw_id, block)
#
# ev_id - (Event ID)
# This is the ID number of the event that the radius/range is
# based on. If the target event moves or appears within the
# range of 'this' event, the system is triggered.
#
# ev2_id - (Event2 ID)
# This is the ID number of the target event which to check.
# If this event finds itself within range of the other
# event's area of effect, the system is triggered.
#
# v_range - (View Range)
# This is the range(in tiles) in which to perform the check.
#
# sw_id - (Switch ID) - Defaulted to 'nil'
# The RMXP switch number to turn ON. By default, this is set
# to 'nil'. You must enter a valid Switch number to use.
#
# s_sw_id - (Self Switch ID) - Defaulted to 'nil'
# The 'Self-Switch' for the event to turn ON. Proper values
# to set are "A", "B", "C", or "D". By default, this is set
# to 'nil'. You must enter a valid Self-Switch to use.
#
# block - (Blocked by Tiles) - Defaulted to 'false'
# This is a 'true/false' switch that determines if the view
# range system is unable to see around impassable tiles. By
# default, this is set to 'false'. If it is set to 'true',
# the view range system will not detect the target event if
# it is behind an impassable tile or tiles.
#
#
#--------------------------------------------------------------------------
#
# Enemies View
# ============
# This function checks to see if the player is within range of an event
# that is facing him/her, and turns on the properly designated switch.
#
# Syntax:
# $view_range.enemies_view(ev_id, v_range, sw_id, s_sw_id, block)
#
# ev_id - (Event ID)
# This is the ID number of the event that the radius/range is
# based on. If the player is in front of 'this' event and
# within the set range, the system is triggered.
#
# v_range - (View Range)
# This is the range(in tiles) in which to perform the check.
#
# sw_id - (Switch ID) - Defaulted to 'nil'
# The RMXP switch number to turn ON. By default, this is set
# to 'nil'. You must enter a valid Switch number to use.
#
# s_sw_id - (Self Switch ID) - Defaulted to 'nil'
# The 'Self-Switch' for the event to turn ON. Proper values
# to set are "A", "B", "C", or "D". By default, this is set
# to 'nil'. You must enter a valid Self-Switch to use.
#
# block - (Blocked by Tiles) - Defaulted to 'false'
# This is a 'true/false' switch that determines if the view
# range system is unable to see around impassable tiles. By
# default, this is set to 'false'. If it is set to 'true',
# the view range system will not detect the player if it is
# behind an impassable tile or tiles.
#
#--------------------------------------------------------------------------
#
# Event Sound
# ===========
# This function checks to see if the player is within range of an event
# that is linked to a sound effect. The closer the player is to the event,
# the louder the effect is played.
#
# The maximum sound range of this routine is eight (8) tiles. It is not
# recommended to overlap these events as this can cause massive lag on the
# game/project as the system will attempt to cycle through the overlapped
# calls. Also note that this routine will override the map's default back-
# ground sound effect.
#
# Syntax:
# $view_range.event_sound(ev_id, bgs_name, bgs_vol = 100, bgs_pitch = 100)
#
# ev_id - (Event ID)
# This is the ID number of the event that the radius/range is
# based on. If the player is in front of 'this' event and
# within the set range, the system is triggered.
#
# bgs_name - (Background Effect's Name)
# This is the filename of the background effect. This effect
# is stored in the Audio\BGS folder.
#
# bgs_vol - (Background Effect's Volume)
# This is the volume setting of the background effect within
# a range of 1 to 100, with 100 being the loudest.
#
# bgs_pitch - (Background Effect's Pitch)
# This is the pitch setting of the background effect within a
# range of 50 to 150, with 150 being the highest setting.
#
#==============================================================================
#
# HOW IT DETERMINES THE RANGE:
#
# The Range system works by searching the area of a circle for the player's
# 'x' and 'y' position. The view range is set in each event and is the ra-
# dius of a circle.
#
# The equation used is: radius^2 = (Px-Ex)^2 + (Py-Ey)^2
# Where P = player, and E = event
#
# If the radius is less than or equal to the view range, then the player is
# inside the circular area.
#
#==============================================================================
# The only configurable
#
VX_RANGE = false
#==============================================================================
# ** View Range
#------------------------------------------------------------------------------
# This class is Near Fantastica's which checks distances between events.
#==============================================================================
class View_Range
#--------------------------------------------------------------------------
# * Object Initialization
#--------------------------------------------------------------------------
def initialize
@playing_bgs = []
@bgs = BGS.new
@event_local_switch = ""
end
#--------------------------------------------------------------------------
# * In Range?
# element : element
# object : object
# range : range in tiles
# pass_block : if terrain tiles can block view
#--------------------------------------------------------------------------
def vr_in_range?(element, object, range, pass_block = false)
# Obtain Range
x = (element.x - object.x) * (element.x - object.x)
y = (element.y - object.y) * (element.y - object.y)
# Obtain values to loop and counter value
x_loops = x_count = ((object.x - element.x).abs)
y_loops = y_count = ((object.y - element.y).abs)
# Reset player's check location
check_player_x = -1
check_player_y = -1
r = x + y
if r <= (range * range)
# Set the return flag
rflag = true
# If tiles can block view
if pass_block
# Horizontal Checks
x_loops.times {
x_playerchk = ((object.x - element.x) >= 0 ? element.x + x_count : element.x - x_count)
x_passingchk = ((object.x - element.x) >= 0 ? (element.x + x_count)-1 : (element.x - x_count)+1)
# Dependant on VX or XP System
if VX_RANGE
x1 = x_passingchk
y1 = element.y
# Calculate new check position (required for VX)
case element.direction
when 1 ; x1 -= 1; y1 += 1
when 2 ; x1 += 0; y1 += 1
when 3 ; x1 += 1; y1 += 1
when 4 ; x1 -= 1; y1 += 0
when 6 ; x1 += 1; y1 += 0
when 7 ; x1 -= 1; y1 -= 1
when 8 ; x1 += 0; y1 -= 1
when 9 ; x1 -= 1; y1 -= 1
end
unless $game_map.passable?(x1, y1)
# Change flag
rflag = false
# Set player check location
check_player_x = object.x if x_playerchk == object.x
end
else
unless $game_map.passable?(x_passingchk, element.y, element.direction)
# Change flag
rflag = false
# Set player check location
check_player_x = object.x if x_playerchk == object.x
end
end
# Decrease counter
x_count -= 1
}
# Vertical Checks
y_loops.times {
y_playerchk = ((object.y - element.y) >= 0 ? element.y + y_count : element.y - y_count)
y_passingchk = ((object.y - element.y) >= 0 ? (element.y + y_count)-1 : (element.y - y_count)+1)
# Dependant on VX or XP System
if VX_RANGE
x1 = element.x
y1 = y_passingchk
# Calculate new check position (required for VX)
case element.direction
when 1 ; x1 -= 1; y1 += 1
when 2 ; x1 += 0; y1 += 1
when 3 ; x1 += 1; y1 += 1
when 4 ; x1 -= 1; y1 += 0
when 6 ; x1 += 1; y1 += 0
when 7 ; x1 -= 1; y1 -= 1
when 8 ; x1 += 0; y1 -= 1
when 9 ; x1 -= 1; y1 -= 1
end
unless $game_map.passable?(x1, y1)
# Change flag
rflag = false
# Set player check location
check_player_y = object.y if y_playerchk == object.y
end
else
unless $game_map.passable?(element.x, y_passingchk, element.direction)
# Change flag
rflag = false
# Set player check location
check_player_y = object.y if y_playerchk == object.y
end
end
# Decrease counter
y_count -= 1
}
end
# Re-enable flag based on player position
if check_player_x == object.x && check_player_y == object.y
r_flag = true
end
# Return system-determined flag
return rflag
else
# Return default flag
return false
end
end
#--------------------------------------------------------------------------
# * View Switch
# ev_id : event ID
# sw_id : switch ID
# s_sw_id : event's self switch ID
#--------------------------------------------------------------------------
def view_switch(ev_id, sw_id = nil, s_sw_id = nil)
$game_switches[sw_id] = true if sw_id != nil
if s_sw_id != nil
key=[$game_map.map_id, ev_id, s_sw_id]
$game_self_switches[key] = true
end
$game_map.need_refresh = true
end
#--------------------------------------------------------------------------
# * Event Sound
# ev_id : Event ID
# bgs_name : filename of background sound effect
# bgs_vol : background effect's volume
# bgs_pitch : background effect's pitch
#--------------------------------------------------------------------------
def event_sound(ev_id, bgs_name, bgs_vol = 100, bgs_pitch = 100)
event = $game_map.events[ev_id]
@bgs.name = bgs_name
@bgs.pitch = bgs_pitch
radius = ($game_player.x-event.x) * ($game_player.x-event.x) +
($game_player.y-event.y) * ($game_player.y-event.y)
if radius > 64
if @playing_bgs[event.id] != nil
@playing_bgs[event.id] = nil
$game_system.bgs_fade(1)
return
end
elsif radius <= 64 and radius > 49
if @playing_bgs[event.id] == nil
@bgs.volume = (bgs_vol * 30)/100
@playing_bgs[event.id] = @bgs
$game_system.bgs_play(@bgs)
return
end
@bgs.volume = (bgs_vol * 30)/100
if @bgs.volume != @playing_bgs[event.id].volume or
@bgs.name != @playing_bgs[event.id].name
@playing_bgs[event.id] = @bgs
$game_system.bgs_play(@bgs)
return
end
elsif radius <= 49 and radius > 36
@bgs.volume = (bgs_vol * 40)/100
@playing_bgs[event.id] = @bgs
$game_system.bgs_play(@bgs)
return
elsif radius <= 36 and radius > 25
@bgs.volume = (bgs_vol * 50)/100
@playing_bgs[event.id] = @bgs
$game_system.bgs_play(@bgs)
return
elsif radius <= 25 and radius > 16
@bgs.volume = (bgs_vol * 60)/100
@playing_bgs[event.id] = @bgs
$game_system.bgs_play(@bgs)
return
elsif radius <= 16 and radius > 9
@bgs.volume = (bgs_vol * 70)/100
@playing_bgs[event.id] = @bgs
$game_system.bgs_play(@bgs)
return
elsif radius <= 9 and radius > 4
@bgs.volume = (bgs_vol * 80)/100
@playing_bgs[event.id] = @bgs
$game_system.bgs_play(@bgs)
return
elsif radius <= 4 and radius > 1
@bgs.volume = (bgs_vol * 90)/100
@playing_bgs[event.id] = @bgs
$game_system.bgs_play(@bgs)
return
elsif radius = 1
@bgs.volume = (bgs_vol * 100)/100
@playing_bgs[event.id] = @bgs
$game_system.bgs_play(@bgs)
return
end
end
#--------------------------------------------------------------------------
# * Event View
# ev_id : event ID
# v_range : range in tiles
# sw_id : switch ID
# s_sw_id : event's self switch ID
# block : View block (true/false)
#--------------------------------------------------------------------------
def event_view(ev_id, v_range, sw_id = nil, s_sw_id = nil, block = false)
event = $game_map.events[ev_id]
if vr_in_range?(event, $game_player, v_range, block)
view_switch(ev_id, sw_id, s_sw_id)
end
end
#--------------------------------------------------------------------------
# * Event to Event View
# ev_id : event ID
# ev2_id : event ID of target
# v_range : range in tiles
# sw_id : switch ID
# s_sw_id : event's self switch ID
# block : View block (true/false)
#--------------------------------------------------------------------------
def event2event_view(ev_id, ev2_id, v_range, sw_id = nil, s_sw_id = nil, block = false)
event = $game_map.events[ev_id]
target = $game_map.events[ev2_id]
if vr_in_range?(event, target, v_range, block)
view_switch(ev_id, sw_id, s_sw_id)
end
end
#--------------------------------------------------------------------------
# * Enemies View
# ev_id : event ID
# v_range : range in tiles
# sw_id : switch ID
# s_sw_id : event's self switch ID
# block : View block (true/false)
#--------------------------------------------------------------------------
def enemies_view(ev_id, v_range, sw_id= nil, s_sw_id = nil, block = false)
event = $game_map.events[ev_id]
if event.direction == 2 && $game_player.y >= event.y
if vr_in_range?(event, $game_player, v_range, block)
view_switch(ev_id, sw_id, s_sw_id)
end
end
if event.direction == 4 && $game_player.x <= event.x
if vr_in_range?(event, $game_player, v_range, block)
view_switch(ev_id, sw_id, s_sw_id)
end
end
if event.direction == 6 && $game_player.x >= event.x
if vr_in_range?(event, $game_player, v_range, block)
view_switch(ev_id, sw_id, s_sw_id)
end
end
if event.direction == 8 && $game_player.y <= event.y
if vr_in_range?(event, $game_player, v_range, block)
view_switch(ev_id, sw_id, s_sw_id)
end
end
end
end
#==============================================================================
# ** Scene_Title
#------------------------------------------------------------------------------
# This class performs title screen processing.
#==============================================================================
class Scene_Title
#--------------------------------------------------------------------------
# * Frame Update
#--------------------------------------------------------------------------
alias vr_scene_title_update update
def update
$view_range = View_Range.new
vr_scene_title_update
end
end
#==============================================================================
# ** Game_System
#------------------------------------------------------------------------------
# This class handles data surrounding the system. Backround music, etc.
# is managed here as well. Refer to "$game_system" for the instance of
# this class.
#==============================================================================
class Game_System
#--------------------------------------------------------------------------
# * Public Instance Variables
#--------------------------------------------------------------------------
attr_accessor :playing_bgs
# Only add methods for RMVX
if VX_RANGE
#------------------------------------------------------------------------
# * Play Background Sound
# bgs : background sound to be played
#------------------------------------------------------------------------
def bgs_play(bgs)
@playing_bgs = bgs
if bgs != nil and bgs.name != ""
Audio.bgs_play("Audio/BGS/" + bgs.name, bgs.volume, bgs.pitch)
else
Audio.bgs_stop
end
Graphics.frame_reset
end
#------------------------------------------------------------------------
# * Fade Out Background Sound
# time : fade-out time (in seconds)
#------------------------------------------------------------------------
def bgs_fade(time)
@playing_bgs = nil
Audio.bgs_fade(time * 1000)
end
#------------------------------------------------------------------------
# * Get Playing Background Sound
#------------------------------------------------------------------------
def playing_bgs
return @playing_bgs
end
end
end
#==============================================================================
# ** Background Sounds
#------------------------------------------------------------------------------
# Data class for Background SE files.
#==============================================================================
class BGS
#--------------------------------------------------------------------------
# * Public Instance Variables
#--------------------------------------------------------------------------
attr_accessor :name
attr_accessor :volume
attr_accessor :pitch
#--------------------------------------------------------------------------
# * Object Initialization
#--------------------------------------------------------------------------
def initialize
@name
@volume
@pitch
end
end
Proszę o pomoc osoby obeznane z tematem.
RE: Problem ze skryptem View range. - Dr Man - 07-03-17 01:54
W skrypcie nie są uwzględnione przeszkody. Jednak da się temu zaradzić, musisz stworzyć zdarzenie w którym określisz na jakich współrzędnych zdarzenie nie będzie cię wykrywało i wyłączyć sprawdzanie zasięgu przez skrypt, warunek że jeśli jesteś na tej pozycji to np przełącznik zdarzenie nie widzi ON jeśli nie znajdujesz się za przeszkodą zdarzenie nie widzi OFF
RE: Problem ze skryptem View range. - Dakla - 07-03-17 15:11
W skrypcie SĄ uwzględnione przeszkody. Nie widzisz co się dzieje na drugim screenie ? Takie coś występuje tylko na skosie.
Co do tego sposobu to jest on słaby, choć działa. Chodzi mi o to, że trzeba by robić zdarzenia z każdego ,,skosu" . Ilość takich zdarzeń mogłaby znacząco przeszkodzić, gdy już inne zdarzenia są w tym miejscu np: w tym miejscu jest beczka z której można przy okazji się napić. Poza tym jeśli mapa z tą skradanką jest dosyć duża to nie wiem, jak będzie działać gra z taką ilością zdarzeń . Jestem przygotowany na zrobienie dużej ilości zdarzeń jeśli ma to wnieść coś w grę, jednak jeśli problem się nie rozwiązuje, to wolałbym w jakiś sposób zmienić skrypt.
Podsumowując ponawiam pytanie: czy ktoś umie poprawić ten skrypt by zadziałał poprawnie?
RE: Problem ze skryptem View range. - Dr Man - 07-03-17 15:45
Screeny nie działają więc nie mogłem zobaczyć co się na nich dzieje.
Myślałem że to v2 w której nie ma takiej opcji chociaż chodziło mi o jedno typowe zdarzenie z uwzględnieniem współrzędnych postaci, wystarczy warunek że jeśli jesteś za przeszkodą na koordynatach x y to wyłączany jest przełącznik z wywołaniem skryptu.
Napraw screeny to wtedy będę mógł jakoś pomóc
RE: Problem ze skryptem View range. - Dakla - 07-03-17 17:32
U mnie wszystko działa i screeny widać, ale teraz powinno działać bez żadnych odnośników na inne strony.
Co do tych koordynat musiałbym sprawdzać pełno współrzędnych, co jest trochę masochistyczne, bo zrobienie tego zajmie mi co najmniej lata młodości i starości.
RE: Problem ze skryptem View range. - Dr Man - 08-03-17 16:22
Dakla wcale nie duzo współrzędnych, kombinowałem w skrypcie i mi się nie udało, jak ALM wbiję to może pomoże, ma na pewno większa wiedzę i doświadczenie w RGSS, ja dopiero raczkuję. Możesz do niego napisać na priv albo poczekać aż coś napiszę w temacie.
Jednak znalazłem 2 rozwiązanie, które oparte jest na zdarzeniach
$game_player.x i $game_player.y określają położenie gracza
$game_map.events[id].x i $game_map.events[id].y określają współrzędne danego eventu, id to numer identyfikacyjny czyli określa który do event.
Jeśli potrafisz operować na funkcjach liniowych i interpretowaniu geometrycznym funkcji, to zakumasz o co chodzi w warunkach.
A i && w ruby oznacza "i" mamy 2 warunki czyli wszystkie warunki muszą być spełnione.
A || w ruby oznacza "lub" mamy 2 warunki czyli jeden z tych dwóch musi być spełniony.
Demko - https://ufile.io/44c51
RE: Problem ze skryptem View range. - Dakla - 08-03-17 17:39
Nie rozumiesz o co mi chodzi . Chciałem uniknąć wpisywania współrzędnych każdej osobnej pozycji. Tak przy okazji: pokazałeś sposób na ustalenie pozycji. Tutaj masz drugi sposób który jest czytelniejszy, a praktycznie nie tracisz nic, bo sprawdzać pozycję gracza zdarzy się bardzo często więc 2 zmienne nie idą na marne.
Twój sposób:
![[Obrazek: typowe_zdarzenie.jpg]](https://s14.postimg.org/rluthgpz1/typowe_zdarzenie.jpg)
Mój sposób:
![[Obrazek: zmienne.jpg]](https://s28.postimg.org/6fp5rxjpl/zmienne.jpg)
Ustalenie współrzędnych za pomocą zmiennych i tego drugiego sposobu nie za wiele się różni. Poza tym wspomniałem już, że staram się zrobić w miarę dużą grę, więc wolę nie tracić po 2 przełączników na strażnika gdy strażników jest np: 70 w całej grze. Na zdarzeniach pracuję bardzo często i taki pomysł już przerabiałem i nie poszło.
Swoją drogą, kto to ten ,,ALM"?
RE: Problem ze skryptem View range. - Dr Man - 08-03-17 18:42
Pokazałem ci drugi sposób na załatanie tego błędu po skosie, że wyłącza funkcję sprawdzania przez przeciwnika na jakiejś powierzchni określonej 2 koordynatami, jakbyś to zapisał na układzie równań i następnie przełożył na wykres wyszedł by ci prostokąt o wymiarze x2-x1 na y2-y1. Ustalać powierzchni to na pewno ten system nie robi, raczej sprawdza. No nie jest to najlepsze rozwiązanie a raczej alternatywa więc ALM może zaradzić, Ayene jest świetna w RGSS, ale niestety dosyć rzadko odwiedza forum, a Mateusz raczej da ci wykład którego nie zrozumiesz.
Ten co pokazałeś nie jest bardziej czytelny i zajmuję więcej miejsca. jeśli chciałbyś go przełożyć na warunek sprawdzający czy gracz jest na ustalonej powierzchni. wyglądał by tak: , działa tak samo ale pierwszy wygląda lepiej i jest mniejszy. Z przełącznikiem jest taka sprawa że wystarczy jeden dla każdego strażnika, i zamiast sw_id można było uzyć s_sw_id, po prostu zrobiłem to na pokaz i nie za bardzo celowałem w wydajność, ale zawsze można to poprawić. ;)
No nic starałem się pomóc, ALM to AlmostNoRuby
Edit: Faktycznie, coś mi się pomieszało z tym ALM ahaha :D
Przepraszam AlmostNoRuby
RE: Problem ze skryptem View range. - Dakla - 08-03-17 21:18
(08-03-17 18:42)Dr Man napisał(a): Mateusz raczej da ci wykład którego nie zrozumiesz.
Święta prawda . Miałem styczność z nim i nie umiem się z nim dogadać dowolnie jak bym się gimnastykował.
A co do tego ALN, to skoro nazywa się AlmostNoRuby to nie powinno być ANR? Z tym sposobem na zdarzeniach masz całkowitą rację. Jeśli skrypt pozostanie niezmodyfikowany to zostanie mi tylko to. Dzięki za pomoc.
RE: Problem ze skryptem View range. - AlmostNoRuby - 11-03-17 13:36
Cytat:No nic starałem się pomóc, ALM to AlmostNoRuby
Edit: Faktycznie, coś mi się pomieszało z tym ALM ahaha :D
Przepraszam AlmostNoRuby
Nie szkodzi 
A i po drugie wiem, mój Nick mówi wszystko. 
Na razie mam wolne i nie mam dostępu do lapka. Jutro wracam, może coś wykombinuję.
#####
#EDIT#
#####
Mam szkic:
tylko... on nie działa. Typowe dla $game_map.data "Can't convert nil to integer". Jakoś to zrobię.
W skrócie: Po uruchomieniu przełącznika "START" skanuje całą mapę w poszukiwaniu terrain tagu 1. Jak już to zrobił, to omija tę część kodu. Potem na okrągło sprawdza, na jakim bohater jest terrain tagu (czy 1, czy 0) i przełącza odpowiedni przełącznik. Jakoś tak.
terrain tag = typ terenu, w polskiej wersji.
A i tak na serio. W RPGVX wystarczyłoby
Kod:
if $game_player.in_area?(area)
|