how does CC_PMS_VXA_v4.1 work?

minonna

Villager
Member
Joined
Mar 19, 2020
Messages
5
Reaction score
0
First Language
italian
Primarily Uses
RMVXA
i've recently downloaded this script, but i cant find any tutorials on how to use it
can someone help me figure things out? ^^"
 

Andar

Veteran
Veteran
Joined
Mar 5, 2013
Messages
31,365
Reaction score
7,675
First Language
German
Primarily Uses
RMMV
please link to the website where you downloaded it.
that is a very confusing filename and we need to see the script to help you (usually instructions on how to use the script are in the comments at the beginning of the script).

If you have more general problems instead of specific use problems, then I suggest you follow the link "how to use a script" in my signature.
 

minonna

Villager
Member
Joined
Mar 19, 2020
Messages
5
Reaction score
0
First Language
italian
Primarily Uses
RMVXA
 

MushroomCake28

KAMO Studio
Global Mod
Joined
Nov 18, 2015
Messages
3,729
Reaction score
4,682
First Language
English
Primarily Uses
RMMZ

I've moved this thread to RGSSx Script Support. Please be sure to post your threads in the correct forum next time. Thank you.

 
Last edited:

Andar

Veteran
Veteran
Joined
Mar 5, 2013
Messages
31,365
Reaction score
7,675
First Language
German
Primarily Uses
RMMV
@minonna what exacty are your problems with that script? what do you want to do with it and how have you tried to use it?

I admit that you need a bit more background on parallax mapping to use that due to its additional options, but exactly because of those options we can't tell you what to do without specific questions from you, and descriptions of what you want to do with it.
 

minonna

Villager
Member
Joined
Mar 19, 2020
Messages
5
Reaction score
0
First Language
italian
Primarily Uses
RMVXA
just nothing appears?
this is how i edited the script
$cc_imported ||= {}
$cc_imported["CC_PMS"] = true

#==============================================================================
## CC::pMSモジュール

module CC
module PMS
DIR = "Graphics/ParallaxMaps/"

# off_sw_id (osi) : When Switch[osi] is true, the layer is invisible.
# changer_var_id (cvi) : When Variables[cvi] > 0, the file 'map(mapid)_(name)(value of Variables[cvi])' is called.
# Othewise, 0 is used as last character of filename.
# blend_type : 0 = normal, 1 = add, 2 = sub

LAYERS = [ # name, z, opacity, blend_type, off_sw_id, changer_var_id, animate_arr, scroll_ratio
["gnd", 0, 255, 0, 22, 22, [], nil, ],
["high", 0, 255, 0, 23, 23, [], nil, ],

OFF_SW = false # If $game_variables[OFF_SW] is true, entire PMS will stop.

# Interval to change images.
ANIM_INTERVAL = 60

end # of PMS
end # of CC


#==============================================================
## キャッシュ

module Cache
def self.parallax_map(filename)
self.load_bitmap(CC::pMS::DIR, filename)
end

def self.clear_parallax_map
# パララックスはメモリを食うので、手動解放を用意しておく
flag = false
@cache.each{|key, value|
if key.include?(CC::pMS::DIR)
@cache.delete(key)
flag = true
end
}
GC.start if flag
end
end

#==============================================================================
## 組み込み

class Spriteset_Map
alias _pmscc_create_parallax create_parallax
def create_parallax
_pmscc_create_parallax
create_pms
end

alias _pmscc_dispose_parallax dispose_parallax
def dispose_parallax
dispose_pms
_pmscc_dispose_parallax
end

alias _pmscc_update_parallax update_parallax
def update_parallax
_pmscc_update_parallax
update_pms
end

def create_pms
@cc_pms = []
@cc_pms_mapid = $game_map.map_id
CC::pMS::LAYERS.each {|params| @cc_pms.push( CC_pms.new(params, @viewport1) ) }
end

def dispose_pms
@cc_pms.each {|layer| layer.dispose }
end

def update_pms
if @cc_pms_mapid != $game_map.map_id
@cc_pms_mapid = $game_map.map_id
refresh_pms
end
@cc_pms.each {|layer| layer.update }
end

def refresh_pms
dispose_pms
create_pms
end
end # Spriteset_Map


#==============================================================================
## CC_pms クラス

class CC_pms
attr_reader :name
def initialize(params, viewport)
@Name = params[0]

@sprite = Sprite.new
@sprite.viewport = viewport
@sprite.z = params[1]
@sprite.opacity = params[2]
@sprite.blend_type = params[3]

@off_switch_id = params[4]
changer_var_id = params[5]
animation_array = params[6]

@scroll_ratio_x = 1
@scroll_ratio_y = 1
if params[7] != nil
@scroll_ratio_x = params[7][0]
@scroll_ratio_y = params[7][1]
end

# アニメ処理
@filename_itr = 0 # 何番目のファイルネームを使うか
@frame_count = CC::pMS::ANIM_INTERVAL # ファイルネーム交換のフレーム周期

# ファイル名の配列を作る
filename = 'map' << $game_map.map_id.to_s << '_' << @Name
filename << ( ( changer_var_id > 0 )?( $game_variables[changer_var_id].to_s ):( '0' ) )
@filename_arr = []
if animation_array == []
@filename_arr.push(filename)
else
animation_array.each {|num| @filename_arr.push( filename + '_' + num.to_s )}
end

reset_image
update
end

#-------------------------------------
def dispose
@sprite.dispose
end

#-------------------------------------
def reset_image
# 画像のロードを試みてロード失敗したら空にする
begin
@sprite.bitmap = Cache.parallax_map( @filename_arr[@filename_itr] )
rescue
@sprite.bitmap = nil
return
end
#p @filename_arr[@filename_itr]
end # of reset_image

#-------------------------------------
def update
# マップ変更のチェック

# 画像ないならリターン
return if @sprite.bitmap.nil?

# オフスイッチが入ってるならvisibleをオフにしてリターン
if $game_switches[@off_switch_id] || $game_switches[CC::pMS::oFF_SW]
@sprite.visible = false
return
else
@sprite.visible = true
end

# アニメーションのカウントを進める
if @filename_arr.size > 1
@frame_count -= 1
if @frame_count < 1
@frame_count = CC::pMS::ANIM_INTERVAL
@filename_itr += 1
@filename_itr = 0 if @filename_itr >= @filename_arr.size
reset_image
end
end

# 表示位置を更新
@sprite.ox = $game_map.display_x * 32 * @scroll_ratio_x
@sprite.oy = $game_map.display_y * 32 * @scroll_ratio_y
end # of update
end
those attached are the files im using
 

Attachments

Roninator2

Gamer
Veteran
Joined
May 22, 2016
Messages
2,660
Reaction score
563
First Language
English
Primarily Uses
RMVXA
@minonna You should put code into a code block

Code:
You can see that a lot of the code is changed into smiley faces.
A spoiler is also good to shorten the message and not take up a lot of space.
1584669738517.png

i edited the script
If it is edited, you should point out what changes you made.
 

minonna

Villager
Member
Joined
Mar 19, 2020
Messages
5
Reaction score
0
First Language
italian
Primarily Uses
RMVXA
well the script came with a game to test it so i just for example deleted the layers i didnt need
this is the original code
Code:
$cc_imported ||= {}
$cc_imported["CC_PMS"] = true

#==============================================================================
## CC::PMSモジュール

module CC
module PMS
    DIR = "Graphics/ParallaxMaps/"
    
    # off_sw_id (osi)      : When Switch[osi] is true, the layer is invisible.
    # changer_var_id (cvi) : When Variables[cvi] > 0, the file 'map(mapid)_(name)(value of Variables[cvi])' is called.
    #                        Othewise, 0 is used as last character of filename.
    # blend_type : 0 = normal, 1 = add, 2 = sub
    
    LAYERS = [ # name, z, opacity, blend_type, off_sw_id, changer_var_id, animate_arr, scroll_ratio
        ["gnd", 1, 255, 0, 22, 22, [], nil, ],
        ["high", 250, 255, 0, 23, 23, [], nil, ],
        ["shd", 251, 85, 2, 25, 25, [], nil, ],
        ["anim", 1, 255, 0, 26, 26, [0,1,2,1], nil,  ],
        ["rati", 250, 255, 0, 27, 27, [], [0.5, 1], ],
        #["water", 50, 255, 0, 24, 24, [0,1,2,1], nil, ],
    ] #
    OFF_SW        = 21        # If $game_variables[OFF_SW] is true, entire PMS will stop.
    
    # Interval to change images.
    ANIM_INTERVAL = 60
    
end # of PMS
end # of CC


#==============================================================
## キャッシュ

module Cache
    def self.parallax_map(filename)
        self.load_bitmap(CC::PMS::DIR, filename)
    end
    
    def self.clear_parallax_map
        # パララックスはメモリを食うので、手動解放を用意しておく
        flag = false
        @cache.each{|key, value|
            if key.include?(CC::PMS::DIR)
                @cache.delete(key)
                flag = true
            end
        }
        GC.start if flag
    end
end

#==============================================================================
## 組み込み

class Spriteset_Map
  alias _pmscc_create_parallax create_parallax
  def create_parallax
    _pmscc_create_parallax
    create_pms
  end
 
  alias _pmscc_dispose_parallax dispose_parallax
  def dispose_parallax
      dispose_pms
    _pmscc_dispose_parallax
  end
 
  alias _pmscc_update_parallax update_parallax
  def update_parallax
      _pmscc_update_parallax
      update_pms
  end
 
  def create_pms
    @cc_pms = []
    @cc_pms_mapid = $game_map.map_id
    CC::PMS::LAYERS.each {|params| @cc_pms.push( CC_pms.new(params, @viewport1) ) }
  end
 
  def dispose_pms
        @cc_pms.each {|layer| layer.dispose }
  end
 
  def update_pms
      if @cc_pms_mapid != $game_map.map_id
        @cc_pms_mapid = $game_map.map_id
          refresh_pms
      end
      @cc_pms.each {|layer| layer.update }
  end
 
  def refresh_pms
      dispose_pms
      create_pms
  end
end # Spriteset_Map


#==============================================================================
## CC_pms クラス

class CC_pms
    attr_reader :name
    def initialize(params, viewport)
        @name = params[0]
        
        @sprite = Sprite.new
        @sprite.viewport = viewport
        @sprite.z = params[1]
        @sprite.opacity = params[2]
        @sprite.blend_type = params[3]
        
        @off_switch_id = params[4]
        changer_var_id = params[5]
        animation_array = params[6]
        
        @scroll_ratio_x = 1
        @scroll_ratio_y = 1
        if params[7] != nil
            @scroll_ratio_x = params[7][0]
            @scroll_ratio_y = params[7][1]
        end
        
        # アニメ処理
        @filename_itr = 0 # 何番目のファイルネームを使うか
        @frame_count = CC::PMS::ANIM_INTERVAL # ファイルネーム交換のフレーム周期
        
        # ファイル名の配列を作る
        filename = 'map' << $game_map.map_id.to_s << '_' << @name
        filename << ( ( changer_var_id > 0 )?( $game_variables[changer_var_id].to_s ):( '0' ) )
        @filename_arr = []
        if animation_array == []
            @filename_arr.push(filename)
        else
            animation_array.each {|num| @filename_arr.push( filename + '_' + num.to_s )}
        end
        
        reset_image
        update
    end
    
    #-------------------------------------
    def dispose
        @sprite.dispose
    end
    
    #-------------------------------------
    def reset_image
        # 画像のロードを試みてロード失敗したら空にする
        begin
            @sprite.bitmap = Cache.parallax_map( @filename_arr[@filename_itr] )
        rescue
            @sprite.bitmap = nil
            return
        end
        #p @filename_arr[@filename_itr]
    end # of reset_image
    
    #-------------------------------------
  def update
      # マップ変更のチェック
      
      # 画像ないならリターン
      return if @sprite.bitmap.nil?
      
      # オフスイッチが入ってるならvisibleをオフにしてリターン
      if $game_switches[@off_switch_id] || $game_switches[CC::PMS::OFF_SW]
          @sprite.visible = false
          return
      else
          @sprite.visible = true
      end
      
      # アニメーションのカウントを進める
      if @filename_arr.size > 1
            @frame_count -= 1
            if @frame_count < 1
                @frame_count = CC::PMS::ANIM_INTERVAL
                @filename_itr += 1
                @filename_itr = 0 if @filename_itr >= @filename_arr.size
                reset_image
            end
      end
      
        # 表示位置を更新
        @sprite.ox = $game_map.display_x * 32 * @scroll_ratio_x
        @sprite.oy = $game_map.display_y * 32 * @scroll_ratio_y
  end # of update
end
i guess it really shows that im new to this site ^^"
 

TheoAllen

Self-proclaimed jack of all trades
Veteran
Joined
Mar 16, 2012
Messages
5,592
Reaction score
6,522
First Language
Indonesian
Primarily Uses
RMVXA
I'm going to try to answer the original question
i've recently downloaded this script, but i cant find any tutorials on how to use it
can someone help me figure things out? ^^"
Have you read Andar's Tutorial?
Edit: Additionally, do you know switches and variables in RM?
just nothing appears?
well the script came with a game to test it so i just for example deleted the layers i didnt need
And the game comes with the demo. Is the demo not working?
You never tell us what exactly you do step by step. So we can not help you further until you do.
 
Last edited:

Andar

Veteran
Veteran
Joined
Mar 5, 2013
Messages
31,365
Reaction score
7,675
First Language
German
Primarily Uses
RMMV
You really need to follow the link to how to use a script, because you misunderstood quite a number of things and as a result probably caused the logic to fail.
Original:
OFF_SW = 21 # If $game_variables[OFF_SW] is true, entire PMS will stop.
Your (wrong) edit
OFF_SW = false # If $game_variables[OFF_SW] is true, entire PMS will stop.
OFF_SW needs to be a number.
To be more precise, it needs to be the ID of a switch (that is what SW stands for.
When turning this switch ON, the engine will stop.
But "false" is not a number, which means the test for that switch will fail.



[ # name, z, opacity, blend_type, off_sw_id, changer_var_id, animate_arr, scroll_ratio
["gnd", 0, 255, 0, 22, 22, [], nil, ],
["high", 0, 255, 0, 23, 23, [], nil, ],
And again, did you understand that 22 and 23 in these lines are IDs for switches and variables?
Any switch and variable used in script configuration needs to be named in your project's list to prevent you from using them somewhere else.
If you already used switches 22 and 23 as well as variables 22 and 23, then anything could go wrong.
and even if you haven't used them already, you need to use them in order to tell the script what to do.

that is part of the explanations in my tutorial.
there is more however and I simply don't have the time to analyse everything you might have done wrong.
for example what pictures are you using and what names did you give those pictures?
 

Users Who Are Viewing This Thread (Users: 0, Guests: 1)

Latest Threads

Latest Posts

Latest Profile Posts

Couple hours of work. Might use in my game as a secret find or something. Not sure. Fancy though no? :D
Holy stink, where have I been? Well, I started my temporary job this week. So less time to spend on game design... :(
Cartoonier cloud cover that better fits the art style, as well as (slightly) improved blending/fading... fading clouds when there are larger patterns is still somewhat abrupt for some reason.
Do you Find Tilesetting or Looking for Tilesets/Plugins more fun? Personally I like making my tileset for my Game (Cretaceous Park TM) xD
How many parameters is 'too many'??

Forum statistics

Threads
105,863
Messages
1,017,053
Members
137,571
Latest member
grr
Top