collapse collapse

 Community


 User Info




Willkommen Gast. Bitte einloggen oder registrieren.

 Partnerseiten

rpgvx.net

Das Forum ist offline

Autor Thema: MapMarker  (Gelesen 2523 mal)

Offline Onkel Hell

  • Sol Invictus
  • Administrator
  • VX-Kenner
  • ****
  • Beiträge: 562
  • You can't shoot me, I'm AIDS !
MapMarker
« am: Mai 02, 2008, 19:11:22 »
Beschreibung : Das Script zeigt in Areas mit speziellen namen die ihr einstellen könnt ein von euch eingestelltes emote, somit kann zb ein ausrufezeichen automatisch angezeigt werden wenn ein item in der nähe ist

Anmerkung :
Danke an Tally für Idee und Betatesting

Demo v1.2
http://rapidshare.com/files/112128206/MapMarker.rar

Anleitung :
#==============================================================================
# F.A.Q.
#==============================================================================
# Benutzt das MARKER-Array um eure Area-Namen einzustellen und die Balloon ID
# für das Emote das ihr haben möchtet. Ihr könnt soviele Zeilen hinzufügen wie ihr
# wollt
#
# Auf der Karte braucht ihr dann nur ein Area zu erstellen mit einem der Namen
# die ihr zuvor eingestellt habt und das emote wird automatisch angezeigt
#
# Um die markierung vom letzten Area zu löschen das ihr betreten habt,
# erstellt ein call script mit diesem darin :
# $game_player.delete_mark
#==============================================================================
# Main config
#==============================================================================
MARKER = [ ["item 1",1],         # [Areaname,Balloon ID]
           ["item 2",2],         # Example 1
           ["item 3",3],         # Example 2
           ["item 4",4],         # Example 3
                    ]

Script v1.2
Spoiler for Hiden:
#==============================================================================
#  Map Marker
#
#  Version : 1.2 - 01.04.08
#  Created by : hellMinor
#  Do NOT redistribute without my permission
#  Description : A little script to show a Emote Icon if you enter an
#                area with specific name
#
#==============================================================================
# F.A.Q.
#==============================================================================
# Use the MARKER-Array to define the Area names and the Balloon ID for the
# emote which should be shown in it. You can add as much lines as you want.
#
# On the map, just make an area with one of the names which you defined and
# the emote will be shown automatically
#
# To delete the mark of the last area you entered just make a call script
# with this in it : $game_player.delete_mark
#==============================================================================
# Main config
#==============================================================================
MARKER = [ ["item 1",1],         # [Areaname,Balloon ID]
           ["item 2",2],         # Example 1
           ["item 3",3],         # Example 2
           ["item 4",4],         # Example 3
                    ]                
#==============================================================================
class Game_Player < Game_Character
#==============================================================================  
  def in_item_area?(area)
    return false if area == nil
    return false if $game_map.map_id != area.map_id
    return false if @x < area.rect.x
    return false if @y < area.rect.y
    return false if @x >= area.rect.x + area.rect.width
    return false if @y >= area.rect.y + area.rect.height
    for i in 0..MARKER.size-1
      if area.name == MARKER[i][0]
        @last_area = area.id
        @mark = MARKER[i][1]
        return true
      end
    end
    return false
  end
#------------------------------------------------------------------------------  
  def auto_exclamation
    for area in $data_areas.values
      $game_player.balloon_id = @mark if in_item_area?(area)
    end
  end
#------------------------------------------------------------------------------
  def delete_mark
    for area in $data_areas.values
      area.name = "mark deleted" if area.id == @last_area
    end
  end
#------------------------------------------------------------------------------
  alias update_nonmoving_auto_exclamation update_nonmoving
  def update_nonmoving(last_moving)
    update_nonmoving_auto_exclamation(last_moving)
    auto_exclamation if last_moving
  end

end
« Letzte Änderung: Mai 03, 2008, 03:26:33 von hellMinor »
Verborgen in der Dunkelheit
Ich kenne nur die Einsamkeit
Auf das kein Gott mich sieht, ich bin ein Eremit


Mega Man Battle Engine


MapMarker

ERZENGEL

  • Gast
MapMarker
« Antwort #1 am: Mai 02, 2008, 19:21:30 »
Das ist aber mal ein kurzes Skript mit netten Effekt ^^ Vielen Dank für's posten.

Übrigens ist in Rubyfor i in 0..MARKER.size-1dasselbe wiefor i in 0...MARKER.sizeWelches du verwendet ist aber im Endeffekt sicher egal.
« Letzte Änderung: Mai 02, 2008, 19:30:26 von ERZENGEL »

MapMarker

woratana

  • Gast
MapMarker
« Antwort #2 am: Mai 03, 2008, 02:27:59 »
Umh, I'm not sure if it's the same :P
because I already has problem in my script with that before.

It will give an error when it run to the last one~ ( MARKER[MARKER.size] )

MapMarker

ERZENGEL

  • Gast
MapMarker
« Antwort #3 am: Mai 03, 2008, 02:46:27 »
I'm sure it got the same effect in this case (Maybe in other cases). You can test this:ARRAY = [0, 1, 2, 3, 4, 5]
for i in 0..ARRAY.size-1
  p i
end
for i in 0...ARRAY.size
  p i
end
But I think everybody should write scripts in the way he like it.

MapMarker

Talyana Meriweather Rahl

  • Gast
MapMarker
« Antwort #4 am: Mai 03, 2008, 03:24:46 »
Ah du hast es ja gepostet endlich ^__^ hab es schon reingefügt die neue Version ^__~

Ich hoffe dass der Delete Befehl endlich bei mir klappt XD

MapMarker

Offline Onkel Hell

  • Sol Invictus
  • Administrator
  • VX-Kenner
  • ****
  • Beiträge: 562
  • You can't shoot me, I'm AIDS !
MapMarker
« Antwort #5 am: Mai 03, 2008, 03:29:41 »
@woratana: which script do u mean ?o_O
but normally if iterate over arrays the size is everytime +1 the last number
i dont know if the third dot in a loop will automatically do -1 like erzengel tolds but every language is different
Verborgen in der Dunkelheit
Ich kenne nur die Einsamkeit
Auf das kein Gott mich sieht, ich bin ein Eremit


Mega Man Battle Engine


MapMarker

woratana

  • Gast
MapMarker
« Antwort #6 am: Mai 03, 2008, 08:48:41 »
I agree, Erzengel. Everyone should write script in the way they like :)

Spoiler for Hiden:
However, I tried that script in http://tryruby.hobix.com/, and this is what I got.
>> Array = [0,1,2,3,4,5]                                                
=> [0, 1, 2, 3, 4, 5]                                                  
>> for i in 0..Array.size                                              
>> p i                                                                  
>> end                                                                  
0                                                                      
1                                                                      
2                                                                      
3                                                                      
4                                                                      
5                                                                      
6                                                                      
=> 0..6
You will see that there's 6 in there too, and Array[6] will return nil because there's no value in that index.

Therefore, for i in 0...MARKER.size will not work.

Spoiler for Hiden:
>> Marker = [ ['item 1', 1],                                            
>> ['item 2', 2],                                                      
>> ['item 3', 3],                                                      
>> ['item 4', 4],                                                      
>> ]
Using Marker.size, it gives no MethodError
>> for i in 0..Marker.size                                              
>> if 'item 5' == Marker[i][0]                                          
>> p 'found!' + i.to_s                                                  
>> end                                                                  
>> end                                                                  
NoMethodError: undefined method `[]' for nil:NilClass                  
 from (irb):11                                                          
 from (irb):10:in `each'                                                
 from (irb):10
Marker.size-1 will work fine.
>> for i in 0..Marker.size-1                                            
>> if 'item 5' == Marker[i][0]                                          
>> p' found!' + i.to_s                                                  
>> end                                                                  
>> end                                                                  
=> 0..3
Don't worry, we still have many things we have to learn in Ruby (or RGSS :P).
I'm sure you also knew something that I don't know. :)

@Hellminor
I mean by the script in Erzengel's post~

EDIT:
Save space :3~
« Letzte Änderung: Mai 03, 2008, 18:42:18 von woratana »

MapMarker

ERZENGEL

  • Gast
MapMarker
« Antwort #7 am: Mai 03, 2008, 12:44:58 »
Oh ok, vergesst was ich gesagt hab und sorry wegen der Verwirrung ^^
« Letzte Änderung: Mai 03, 2008, 12:51:06 von ERZENGEL »

MapMarker

Dainreth

  • Gast
MapMarker
« Antwort #8 am: Mai 03, 2008, 17:55:33 »
Klingt sehr gut das Skript, werd's mal ausprobieren, danke für die Arbeit!

 


 Bild des Monats

rooftop party

Views: 3583
By: papilion

 Umfrage

  • Wer soll das BdM gewinnen?
  • Dot Kandidat 1
  • 3 (25%)
  • Dot Kandidat 2
  • 1 (8%)
  • Dot Kandidat 3
  • 2 (16%)
  • Dot Kandidat 4
  • 0 (0%)
  • Dot Kandidat 5
  • 6 (50%)
  • Stimmen insgesamt: 12
  • View Topic

 Schnellsuche





SimplePortal 2.3.3 © 2008-2010, SimplePortal