LOGIN
SEARCH
PROFILE
keys: ↑ ↓
LOGOUT
INDEX
MEMBERS
keys: ↑ ↓
HOME
PORTAL
PLAY ALONG
PLAY with WORDS
PLAY with GRAPHICS
PLAY with SOUNDS
PLAY with CODES
PLAY with PROJECTS
keys: ← →
Guest Access
Register:
Members:



View previous topic View next topic Go down Message [Page 1 of 1]

Active Member
Active Member
#1 How do I use Alias in RGSSx?
Loading

handy333

Active Member
Active Member
Active Member
profile
How do you use alias? I've looked around google and found some stuff alias vs. alias_method.

You could win a free Theme Song.

Active Member
Show Signature


Active Member
http://projectrisingsun.weebly.com/ http://soundcloud.com/handyfox http://www.youtube.com/channel/UCkBX7ZxqoXslAtqsdrmsn_w
EVENTALIST
EVENTALIST
#2 Re: How do I use Alias in RGSSx?
Loading

mr_wiggles

EVENTALIST
 EVENTALIST
EVENTALIST
profile
You alias via variable defining. Here is a sample class function i wish to alias.
Code:

Class_Name.prototype.functionName = function() {
 // Function processing.
};

To alias that i would simply do something similar to the following.
Code:

var alias_Class_Name_functionName = Class_Name.prototype.functionName;

Class_Name.prototype.functionName = function() {
 // Function processing.
 alias_Class_Name_functionName.call(this); // call alias before edit.
};
EVENTALIST
Show Signature
EVENTALIST
Active Member
Active Member
#3 Re: How do I use Alias in RGSSx?
Loading

handy333

Active Member
Active Member
Active Member
profile
Thanks.
I guess I just don't get it.
I'll just try to start over with some
small, beginner tutorials one day.
Active Member
Show Signature


Active Member
http://projectrisingsun.weebly.com/ http://soundcloud.com/handyfox http://www.youtube.com/channel/UCkBX7ZxqoXslAtqsdrmsn_w
EVENTALIST
EVENTALIST
#4 Re: How do I use Alias in RGSSx?
Loading

mr_wiggles

EVENTALIST
 EVENTALIST
EVENTALIST
profile
You'll get it in time, ever make any progress on that title edit?
EVENTALIST
Show Signature
EVENTALIST
Active Member
Active Member
#5 Re: How do I use Alias in RGSSx?
Loading

handy333

Active Member
Active Member
Active Member
profile
I'm still working on it. I'll have to switch back to ace because my trial is running up. I've been actually working on this event GUI. It's not bad at all to look at but the event setup is a noodle factory.

I haven't seen any scripts for it but could you add like a new option at the title screen that will take you to a new scene? Something like a gallery or the like.
Active Member
Show Signature


Active Member
http://projectrisingsun.weebly.com/ http://soundcloud.com/handyfox http://www.youtube.com/channel/UCkBX7ZxqoXslAtqsdrmsn_w
EVENTALIST
EVENTALIST
#6 Re: How do I use Alias in RGSSx?
Loading

mr_wiggles

EVENTALIST
 EVENTALIST
EVENTALIST
profile
A plugin buffer for a scene called from the title? Sure i can see how far i can get tonight.
EVENTALIST
Show Signature
EVENTALIST
EVENTALIST
EVENTALIST
#7 Re: How do I use Alias in RGSSx?
Loading

mr_wiggles

EVENTALIST
 EVENTALIST
EVENTALIST
profile
Code:
//================================================================================
// TitleCall.js
//================================================================================
/*: @author Mr_Wiggles
 *   Date: 11/14/15
 *   Version: 0.5
 * ------------------------------------------------------------------------------
 * @plugindesc Adds extra option to call custom scene at title menu.
 *
 * @param SceneAdded
 * @desc  This is the name of your Scene Class to call.
 * @default null
 *
 * @param SceneMenuName
 * @desc  This is the name to show in the title options.
 * @default null
 *
 * @help This plugin allows you to add in an extra option into the game title
 * scene and be able to call it from said scene.
 * ------------------------------------------------------------------------------
 */ //============================================================================
//--------------------------------------------------------------------------------
// Auto run: Sets plugin items that are user defined in RMMV.
//--------------------------------------------------------------------------------
(function() {
//============================================================================
// Scene Title
//============================================================================
  var parameters = PluginManager.parameters('TitleCall');
  var sceneToCall = String(parameters['SceneAdded'] || 'null');
  var sceneName = String(parameters['SceneMenuName'] || 'null');
 //------------------------------------------
  Scene_Title.prototype.createCommandWindow = function() {
    this._commandWindow = new Window_TitleCommand();
    this._commandWindow.setHandler('newGame',  this.commandNewGame.bind(this));
    this._commandWindow.setHandler('continue', this.commandContinue.bind(this));
    this._commandWindow.setHandler('options',  this.commandOptions.bind(this));
    this._commandWindow.setHandler(sceneName, this.commandCallScene.bind(this));
    this.addWindow(this._commandWindow);
  };
  //------------------------------------------
  Window_TitleCommand.prototype.makeCommandList = function() {
    this.addCommand(TextManager.newGame,   'newGame');
    this.addCommand(TextManager.continue_, 'continue', this.isContinueEnabled());
    this.addCommand(TextManager.options,   'options');
    this.addCommand(sceneName, sceneName);
  };
  //------------------------------------------
  Scene_Title.prototype.commandCallScene = function() {
    this._commandWindow.close();
    return eval("SceneManager.goto(" + sceneToCall + ")");
  };
})(); // End of plugin block.

Here is what i threw together so far. Only problem is it wont call any scene other the then the default. I thought it had something to do with the plugin scenes not being created until i tried using "PluginManager.setup($plugins);" from main.js and still nothing. It works, how ever I'm just not sure as to why it wont work with plugin script scene names. It calls all of the built in scenes just fine though.

"Scene_Save, Scene_Battle, Scene_Item,.. ect." Head scratcher as to why it doesn't count the new scripts into the list of loaded object classes.
EVENTALIST
Show Signature
EVENTALIST
Active Member
Active Member
#8 Re: How do I use Alias in RGSSx?
Loading

handy333

Active Member
Active Member
Active Member
profile
I'm still using ace. I'm not sure but my trial ran out.
Active Member
Show Signature


Active Member
http://projectrisingsun.weebly.com/ http://soundcloud.com/handyfox http://www.youtube.com/channel/UCkBX7ZxqoXslAtqsdrmsn_w
EVENTALIST
EVENTALIST
#9 Re: How do I use Alias in RGSSx?
Loading

mr_wiggles

EVENTALIST
 EVENTALIST
EVENTALIST
profile
I made minor edits to it, and some part where i did some testing:
Code:
//================================================================================
// TitleCall.js
//================================================================================
/*: @author Mr_Wiggles
 *   Date: 11/14/15
 *   Version: 0.5
 * ------------------------------------------------------------------------------
 * @plugindesc Adds extra option to call custom scene at title menu.
 *
 * @param SceneAdded
 * @desc  This is the name of your Scene Class to call.
 * @default null
 *
 * @param SceneMenuName
 * @desc  This is the name to show in the title options.
 * @default null
 *
 * @help This plugin allows you to add in an extra option into the game title
 * scene and be able to call it from said scene.
 * ------------------------------------------------------------------------------
 */ //============================================================================
//--------------------------------------------------------------------------------
// Auto run: Sets plugin items that are user defined in RMMV.
//--------------------------------------------------------------------------------
(function() {
//============================================================================
// Scene Title
//============================================================================
  var parameters = PluginManager.parameters('TitleCall');
  var sceneToCall = String(parameters['SceneAdded'] || 'null');
  var sceneName = String(parameters['SceneMenuName'] || 'null');
  var fileName = String(parameters['FileName'] || 'null');
 //------------------------------------------
  Scene_Title.prototype.createCommandWindow = function() {
    this._commandWindow = new Window_TitleCommand();
    this._commandWindow.setHandler('newGame',  this.commandNewGame.bind(this));
    this._commandWindow.setHandler('continue', this.commandContinue.bind(this));
    this._commandWindow.setHandler('options',  this.commandOptions.bind(this));
    this._commandWindow.setHandler(sceneName, this.commandCallScene.bind(this));
    this.addWindow(this._commandWindow);
  };
  //------------------------------------------
  Window_TitleCommand.prototype.makeCommandList = function() {
    this.addCommand(TextManager.newGame,   'newGame');
    this.addCommand(TextManager.continue_, 'continue', this.isContinueEnabled());
    this.addCommand(TextManager.options,   'options');
    this.addCommand(sceneName, sceneName);
  };
  //------------------------------------------
  Scene_Title.prototype.commandCallScene = function() {
    if (PluginManager._scripts.contains(sceneToCall)) {
      this._commandWindow.close();
      this.fadeOutAll();
      var testScene = 'Scene_Options'; // Built in RGGS scene name to test call
      //SceneManager.goto(eval(testScene)); // Works - shutsdown when called scene exited
      //SceneManager.goto(eval(sceneToCall)); // No work at all, not found
      SceneManager.push(eval(testScene)); // Works - returns to prevous scene when exited
      //SceneManager.push(eval(sceneToCall)); // No work at all, not found
    }
  };
  //------------------------------------------
  //eval('function ' + sceneToCall + '() {return Scene_Base; }');
  //eval(sceneToCall + '.prototype = Object.create(Scene_Base.prototype)');
  //eval(sceneToCall + '.prototype.constructor = ' + sceneToCall);
})(); // End of plugin block.

The plugin name in the data base must be the same as the scene's name you are calling.

It works when you call a built in RGGS scene but not when its a plugin. There is a spot line numbers 54 - 58 you can see where i tested the call method i was using and took notes.
EVENTALIST
Show Signature
EVENTALIST
EVENTALIST
EVENTALIST
#10 Re: How do I use Alias in RGSSx?
Loading

mr_wiggles

EVENTALIST
 EVENTALIST
EVENTALIST
profile
Are you asking about aliasing in Ruby? Sorry read this section as RMMV for some reason, to alias in Ruby you just need to do something similar to the following:

Code:

# un-altered ORIGINAL script:
class Sample
  def initialize
    # Do some code here in original un-aliased class.
  end
end

You want to make additions to that definition "initialize" for example, say tacking on code before or after the definition block in the class? Or even bypassing the function and replacing it with a new one but still occasionally calling the original?

You can do all of that above by using one of these three methods:
Code:

class Sample
  alias :new_initialize :initialize
  def initialize # Unaltered name from the original function block defined.
     # ----------------------------------------
     # Do code BEFORE alias to original HERE:
     # ----------------------------------------
     new_initialize # call original UN-altered function NOW.
     # ----------------------------------------
     # Do code AFTER alias to original script HERE:
     # ----------------------------------------
     # Bellow is how you would by pass the original but still be able to call it if needed:
     if condition == true
       new_initialize # call original UN-altered function NOW.
     end
     # ----------------------------------------
  end
end


Say you have a class function you want to alias but its got arguments, and you wanna change those:
Code:

class Sample
  def refresh(x, y, z, alpha, color, name)
    # some code
  end
end

You can do something like this and grab the arguments and pass em along.
Code:

class Sample
  alias :new_refresh :refresh
  def refresh(*args)
    args = *args
    args = [args] unless args.is_a?(Array)
    # This way you can add/subtract args to the original function as well.
    x, y, z, alpha, color, name = args
    # You can make changes to the argument variables now.
    new_refresh(x, y, z, alpha, color, name)# call original UN-altered function NOW.
  end
end


Sorry about the confusion talking about Java in a Ruby thread, lol. Any questions?
EVENTALIST
Show Signature
EVENTALIST
Active Member
Active Member
#11 Re: How do I use Alias in RGSSx?
Loading

handy333

Active Member
Active Member
Active Member
profile
This looks good, I'll have to look at it when I get home. One of the things about alias that bothers me is this:

AKS_LDJA_LKA...

I can't tell if its just random organized code or the actual classes.
Active Member
Show Signature


Active Member
http://projectrisingsun.weebly.com/ http://soundcloud.com/handyfox http://www.youtube.com/channel/UCkBX7ZxqoXslAtqsdrmsn_w
EVENTALIST
EVENTALIST
#12 Re: How do I use Alias in RGSSx?
Loading

mr_wiggles

EVENTALIST
 EVENTALIST
EVENTALIST
profile
handy333 wrote:This looks good, I'll have to look at it when I get home. One of the things about alias that bothers me is this:

AKS_LDJA_LKA...

I can't tell if its just random organized code or the actual classes.


I don't even know what that is, never seen it before. I googled it and got nothing as a whole, however breaking it up by the underscore in the name i turned up:

https://www.google.com/search?q=LDJA&ie=utf-8&oe=utf-8#q=AKS
http://www.ldja.org/
https://en.wikipedia.org/wiki/Landeskriminalamt

You have a sample of where you found it at?
EVENTALIST
Show Signature
EVENTALIST
Active Member
Active Member
#13 Re: How do I use Alias in RGSSx?
Loading

handy333

Active Member
Active Member
Active Member
profile
Here's an example of what I mean:

Code:
 
#--------------------------------------------------------------------------
  # * Change Level
  #     level : new level
  #     show  : Level up display flag
  #     temp_change : Is it temporary or permanent?
  #--------------------------------------------------------------------------
  alias modalg_tempchangestolvl_record_lvl_change change_level
  def change_level(level, show, temp_change = false)
    if temp_change
      # Lazy instantiation - it would probably be easier to properly initialize it in
      # the initialize method, but for the sake of the example this is better
      @temporary_exp = 0 if @temporary_exp == nil
      # @exp is current experience, so subtract from it the experience we are being reduced to.
      @temporary_exp += @exp - @exp_list[level]
    end
   modalg_tempchangestolvl_record_lvl_change (level, show)
  end

At the top (after the description) there's this:
alias modalg_tempchangestolvl_record_lvl_change change_level

I normally see something like this when I'm referencing some other codes. I'm sure it has something to do with alias.

Are the words that's separated by underscores separate classes or variables or could they just be anything. Then at the end of it there's the change_level separated from it.
Active Member
Show Signature


Active Member
http://projectrisingsun.weebly.com/ http://soundcloud.com/handyfox http://www.youtube.com/channel/UCkBX7ZxqoXslAtqsdrmsn_w
EVENTALIST
EVENTALIST
#14 Re: How do I use Alias in RGSSx?
Loading

mr_wiggles

EVENTALIST
 EVENTALIST
EVENTALIST
profile
handy333 wrote:
At the top (after the description) there's this:
alias modalg_tempchangestolvl_record_lvl_change change_level

I normally see something like this when I'm referencing some other codes. I'm sure it has something to do with alias.

You are correct, but I like to use ' : ' in front of my alias' its cleaner to read, both for you and the computer. It relies on character key elements (flag words).


Are the words that's separated by underscores separate classes or variables or could they just be anything. Then at the end of it there's the change_level separated from it.

No they are simply the names of objects. See when you alias you have to move one object, the one your writing over, into memory. Alias does this for you and returns an object name of the clone. This is the first word 'word_one' in the alias. The second points to the object that is being cloned.
Code:

alias :word_one :word_two


Here's an example of what I mean:

Code:
 
#--------------------------------------------------------------------------
  # * Change Level
  #     level : new level
  #     show  : Level up display flag
  #     temp_change : Is it temporary or permanent?
  #--------------------------------------------------------------------------
  alias modalg_tempchangestolvl_record_lvl_change change_level
  def change_level(level, show, temp_change = false)
    if temp_change
      # Lazy instantiation - it would probably be easier to properly initialize it in
      # the initialize method, but for the sake of the example this is better
      @temporary_exp = 0 if @temporary_exp == nil
      # @exp is current experience, so subtract from it the experience we are being reduced to.
      @temporary_exp += @exp - @exp_list[level]
    end
   modalg_tempchangestolvl_record_lvl_change (level, show)
  end

This can be cleaned up like so:
Code:
 #--------------------------------------------------------------------------
  alias :record_lvl_change :change_level
  def change_level(level, show, temp_change = false)
    if temp_change
      # Lazy instantiation - it would probably be easier to properly initialize it in
      # the initialize method, but for the sake of the example this is better
      @temporary_exp = 0 if @temporary_exp == nil
      # @exp is current experience, so subtract from it the experience we are being reduced to.
      @temporary_exp += @exp - @exp_list[level]
    end
   record_lvl_change(level, show) # no spaces! ()
  end

This will also only work if the original, word_two, "change_level" has 2 arguments it needs/ asks for. Just extra if you get a "Wrong arguments # for #" Error print.
EVENTALIST
Show Signature
EVENTALIST
Active Member
Active Member
#15 Re: How do I use Alias in RGSSx?
Loading

handy333

Active Member
Active Member
Active Member
profile
I think I'm beginning to get how this work. What can you tell me about attr_accessor?
Active Member
Show Signature


Active Member
http://projectrisingsun.weebly.com/ http://soundcloud.com/handyfox http://www.youtube.com/channel/UCkBX7ZxqoXslAtqsdrmsn_w
EVENTALIST
EVENTALIST
#16 Re: How do I use Alias in RGSSx?
Loading

mr_wiggles

EVENTALIST
 EVENTALIST
EVENTALIST
profile
Attr_accessor makes @variables accessible from out side the class object (read and write). attr_reader is 'read' only out of class.
Code:
class Attr_Sample
attr_reader :sampleOne
attr_accessor :sampleTwo
 def initialize
   @sampleOne = 0
   @sampleTwo = 0
 end
end

class Use_Sample
 def initialize
   @sample = Attr_Sample.new
   print(@sample.sampleOne)
   @sample.sampleOne = 2
    print(@sample.sampleOne)
    print(@sample.sampleTwo)
   @sample.sampleTwo = 1 # syntax error no method
 end
end

Above is kinda short hand for this:
Code:
class Sample
  def initialize
    @sampleOne =0
    @sampleTwo =0
  end

  def sampleOne
    return @sampleOne
  end

  def sampleOne=(value)
     @sampleOne = value
  end

  def sampleTwo
    return @sampleTwo
  end
end

attr_accessor and attr_reader are just typing short cuts is all.
EVENTALIST
Show Signature
EVENTALIST
Active Member
Active Member
#17 Re: How do I use Alias in RGSSx?
Loading

handy333

Active Member
Active Member
Active Member
profile
This is great. I've been messing around with both of these and I think I'm starting to get it. I just don't know how to use it for anything.
Active Member
Show Signature


Active Member
http://projectrisingsun.weebly.com/ http://soundcloud.com/handyfox http://www.youtube.com/channel/UCkBX7ZxqoXslAtqsdrmsn_w
EVENTALIST
EVENTALIST
#18 Re: How do I use Alias in RGSSx?
Loading

mr_wiggles

EVENTALIST
 EVENTALIST
EVENTALIST
profile
that'd be left to your imagination. Smile
EVENTALIST
Show Signature
EVENTALIST
Active Member
Active Member
#19 Re: How do I use Alias in RGSSx?
Loading

handy333

Active Member
Active Member
Active Member
profile
I mean like ruby in rgss form. I'm not sure how to put the ruby into it. Its like to do something simple you have to have like 200 lines of code.
Active Member
Show Signature


Active Member
http://projectrisingsun.weebly.com/ http://soundcloud.com/handyfox http://www.youtube.com/channel/UCkBX7ZxqoXslAtqsdrmsn_w
EVENTALIST
EVENTALIST
#20 Re: How do I use Alias in RGSSx?
Loading

mr_wiggles

EVENTALIST
 EVENTALIST
EVENTALIST
profile
Do you have a comparison, you use python?
EVENTALIST
Show Signature
EVENTALIST
Active Member
Active Member
#21 Re: How do I use Alias in RGSSx?
Loading

handy333

Active Member
Active Member
Active Member
profile
Python? No, I tried it along time ago but it never stuck. What I mean is like when I use unity I can do something like this with c#:

//variables
someVariables

//update method
button inputs
//custom method
eh...

With Rgss in Rpg maker x...
Code:

#==========================================================================
# ** Player : Dash
#=========================================================================

#-------------------------------------------------------------------------------
# * SDK Log
#-------------------------------------------------------------------------------
SDK.log('Player.Dash', 'Kain Nobel ©', 3.5, '2009.06.17')
#-------------------------------------------------------------------------------
# * SDK Enabled Test : Begin
#-------------------------------------------------------------------------------
if SDK.enabled?('Player.Dash')

#==========================================================================
# ** Game_Player::Dash
#==========================================================================

class Game_Player::Dash
  #-----------------------------------------------------------------------------
  # * Switch which disables the dash system and HUD
  #-----------------------------------------------------------------------------
  Switch_Disable = 1
  #-----------------------------------------------------------------------------
  # * Switch which disables exhaustion
  #-----------------------------------------------------------------------------
  Switch_Exhaust = 2
  #-----------------------------------------------------------------------------
  # * Maps which disable the dash system and HUD
  #-----------------------------------------------------------------------------
  Maps_Disabled  = []
  #-----------------------------------------------------------------------------
  # * Scenes which don't display dash HUD (alternate scenes with Spriteset_Map)
  #-----------------------------------------------------------------------------
  Scenes_Disabled = true
  #-----------------------------------------------------------------------------
  # * Button used for Dashning
  #-----------------------------------------------------------------------------
  Button = Input::C
  #-----------------------------------------------------------------------------
  # * Public Instance Variables
  #-----------------------------------------------------------------------------
  attr_accessor :slow_speed
  attr_accessor :walk_speed
  attr_accessor :dash_speed
  attr_accessor :stamina
  attr_accessor :points
  #-----------------------------------------------------------------------------
  # * Object Initialization
  #-----------------------------------------------------------------------------
  def initialize
 @slow_speed   = 3   # Speed for when player is exhausted
 @walk_speed   = 3.5 # Speed for when player is walking
 @dash_speed   = 5   # Speed for when player is dashing
 @stamina  = 1   # Steps player can take while dashing
 @stamina_rate = 0.01 # Frames that stamina is replenished
 @exhersion = @stamina / 8 # At the point where player exhausted
 @points   = @stamina # Sets points to stamina (don't touch)
  end
  #-----------------------------------------------------------------------------
  # * Enabled?
  #-----------------------------------------------------------------------------
  def enabled?
 return false if $game_switches[Switch_Disable]
 return false if Maps_Disabled[$game_map.map_id]
 if Scenes_Disabled == true
  return false unless $scene.is_a?(Scene_Map)
 else
  return false if Scenes_Disabled.include?($scene.class.to_s)
 end
 return true
  end
  #-----------------------------------------------------------------------------
  # * Increase Points
  #-----------------------------------------------------------------------------
  def increase_points(n)
 @points = [[@points + n, @stamina].min, 0].max
  end
  #-----------------------------------------------------------------------------
  # * Decrease Points
  #-----------------------------------------------------------------------------
  def decrease_points(n)
 increase_points(-n)
  end
  #-----------------------------------------------------------------------------
  # * Update
  #-----------------------------------------------------------------------------
  def update
 unless enabled?
  update_disabled
  return
 end
 @disabled = false
 if idle?
  update_idle
  return
 elsif exhausted?
  update_exhausted
  return
 elsif walking?
  update_walking
  return
 elsif dashing?
  update_dashing
  return
 end
  end
  #-----------------------------------------------------------------------------
  # * Update Disabled
  #-----------------------------------------------------------------------------
  def update_disabled
 unless @disabled
  $game_player.move_speed = (Game_Player.new).move_speed
  @disabled = true
 end
  end
  #-----------------------------------------------------------------------------
  # * Idle?
  #-----------------------------------------------------------------------------
  def idle?
 !$game_player.moving?
  end
  #-----------------------------------------------------------------------------
  # * Exhausted?
  #-----------------------------------------------------------------------------
  def exhausted?
 @exhausted && !$game_switches[Switch_Exhaust]
  end
  #-----------------------------------------------------------------------------
  # * Walking?
  #-----------------------------------------------------------------------------
  def walking?
 return true if $game_player.move_route_forcing
 $game_player.moving? && !Input.press?(Button)
  end
  #-----------------------------------------------------------------------------
  # * Dashing?
  #-----------------------------------------------------------------------------
  def dashing?
 return false if $game_system.map_interpreter.running?
 return false if $game_temp.message_window_showing
 return false if $game_player.move_route_forcing
 $game_player.moving? && Input.press?(Button)
  end
  #-----------------------------------------------------------------------------
  # * Update Idle
  #-----------------------------------------------------------------------------
  def update_idle
 increase_points(exhausted? ? @stamina_rate * 0.5 : @stamina_rate)
 if @points > (@exhersion)
  @exhausted = false
 end
  end
  #-----------------------------------------------------------------------------
  # * Update Exhausted
  #-----------------------------------------------------------------------------
  def update_exhausted
 $game_player.move_speed = @slow_speed
 increase_points(@stamina_rate * 0.5)
 if @points > (@exhersion)
  @exhausted = false
 end
  end
  #-----------------------------------------------------------------------------
  # * Update Walking
  #-----------------------------------------------------------------------------
  def update_walking
 $game_player.move_speed = @walk_speed
 increase_points(@stamina_rate * 0.5)
  end
  #-----------------------------------------------------------------------------
  # * Update Dashing
  #-----------------------------------------------------------------------------
  def update_dashing
 unless $game_player.move_speed == @dash_speed
  $game_player.move_speed += (@dash_speed * 0.1)
  return
 end
 decrease_points(@stamina_rate * 2)
 if @points.zero?
  @exhausted = true
 end
  end
  #-----------------------------------------------------------------------------
  # * Last Move
  #-----------------------------------------------------------------------------
  def last_move
 return 0 if idle?
 return 1 if exhausted?
 return 2 if walking?
 return 3 if dashing?
  end
end

#==========================================================================
# ** Game_Player
#==========================================================================

class Game_Player < Game_Character
  #-----------------------------------------------------------------------------
  # * Public Instance Variables
  #-----------------------------------------------------------------------------
  attr_accessor :move_speed
  #-----------------------------------------------------------------------------
  # * Alias Listings
  #-----------------------------------------------------------------------------
  alias_method :dashsystem_gmplayer_updateplayermove, :update_player_movement
  #-----------------------------------------------------------------------------
  # * Dash
  #-----------------------------------------------------------------------------
  def dash
 @dash ||= Game_Player::Dash.new
 @dash
  end
  #-----------------------------------------------------------------------------
  # * Update
  #-----------------------------------------------------------------------------
  def update_player_movement
 dashsystem_gmplayer_updateplayermove
 @dash.update
  end
end

#==========================================================================
# ** Window_DashStamina
#==========================================================================

class Window_DashStamina < Window_Base
  #-----------------------------------------------------------------------------
  # * Object Initialization
  #-----------------------------------------------------------------------------
  def initialize
 super(0, 416, 160, 64)
 self.contents = Bitmap.new(width - 32, height - 32)
 self.opacity = 0
 refresh
  end
  #-----------------------------------------------------------------------------
  # * Refresh
  #-----------------------------------------------------------------------------
  def refresh
 self.contents.clear
 @points = $game_player.dash.points
 @last_move = $game_player.dash.last_move
 self.contents.draw_seph_gradient_bar(0, 0, @points,
 $game_player.dash.stamina, 128)
 if $game_player.dash.idle?
  color = ($game_player.dash.exhausted? ? Color.new(255,0,0) : normal_color)
  self.contents.font.color = color
  self.contents.draw_text(0, 0, 128, 32, "Idle", 1)
 elsif $game_player.dash.exhausted?
  self.contents.font.color = Color.new(255,0,0)
  self.contents.draw_text(0, 0, 128, 32, "Exhausted", 1)
 elsif $game_player.dash.walking?
  self.contents.font.color = normal_color
  self.contents.draw_text(0, 0, 128, 32, "Walking", 1)
 elsif $game_player.dash.dashing?
  self.contents.font.color = system_color
  self.contents.draw_text(0, 0, 128, 32, "Dashing", 1)
 end
  end
  #-----------------------------------------------------------------------------
  # * Update?
  #-----------------------------------------------------------------------------
  def update?
 need_update = false
 need_update |= $game_player.dash.points != @points
 need_update |= $game_player.dash.last_move != @last_move
 (need_update && Graphics.frame_count % 4 == 1)
  end
  #-----------------------------------------------------------------------------
  # * Update
  #-----------------------------------------------------------------------------
  def update
 self.visible = $game_player.dash.enabled?
 if update?
  refresh
 end
  end
end

#==========================================================================
# ** Spriteset_Map
#==========================================================================

class Spriteset_Map
  #-----------------------------------------------------------------------------
  # * Alias Lisitngs
  #-----------------------------------------------------------------------------
  alias_method :dashsystem_ssmap_initialize, :initialize
  alias_method :dashsystem_ssmap_update, :update
  alias_method :dashsystem_ssmap_dispose, :dispose
  #-----------------------------------------------------------------------------
  # * Object Initialization
  #-----------------------------------------------------------------------------
  def initialize
 @window_dashstamina = Window_DashStamina.new
 dashsystem_ssmap_initialize
  end
  #-----------------------------------------------------------------------------
  # * Update
  #-----------------------------------------------------------------------------
  def update
 @window_dashstamina.update
 dashsystem_ssmap_update
  end
  #-----------------------------------------------------------------------------
  # * Dispose
  #-----------------------------------------------------------------------------
  def dispose
 @window_dashstamina.dispose
 dashsystem_ssmap_dispose
  end
end

#-------------------------------------------------------------------------------
# * SDK Enabled Test : End
#-------------------------------------------------------------------------------
end

This is to basically dash.
I got it from this site:
http://www.gdunlimited.net/forums/topic/8472-player-dash/

It's for rmxp.
Active Member
Show Signature


Active Member
http://projectrisingsun.weebly.com/ http://soundcloud.com/handyfox http://www.youtube.com/channel/UCkBX7ZxqoXslAtqsdrmsn_w
EVENTALIST
EVENTALIST
#22 Re: How do I use Alias in RGSSx?
Loading

mr_wiggles

EVENTALIST
 EVENTALIST
EVENTALIST
profile
handy333 wrote:This is to basically dash.
I got it from this site:
http://www.gdunlimited.net/forums/topic/8472-player-dash/

It's for rmxp.

Nah that's dash with extra features.

This is basically dash:
Code:
class Game_Player
  alias :simpleDash_update :update
  def update
    @move_speed = Input.press?(Input::X) ? 5 : 4
    simpleDash_update
  end
end

Sprint button is "A" on Keyboard.

You can fit it on one line if you really wanted to:
Code:
class Game_Player;alias:sD:update;def update;@move_speed=Input.press?(Input::X)?5:4;sD;end;end
EVENTALIST
Show Signature
EVENTALIST
Active Member
Active Member
#23 Re: How do I use Alias in RGSSx?
Loading

handy333

Active Member
Active Member
Active Member
profile
Well I'll be. I've never seen a script so small in all my years of using someone else's scripts in my games. I don't know if I've ever said this but I've always been good with events so thats how I get by.
I guess you won that theme song!
Congratulations!
Whenever you need one for a game let me know.
I'll do my best.
Active Member
Show Signature


Active Member
http://projectrisingsun.weebly.com/ http://soundcloud.com/handyfox http://www.youtube.com/channel/UCkBX7ZxqoXslAtqsdrmsn_w
EVENTALIST
EVENTALIST
#24 Re: How do I use Alias in RGSSx?
Loading

mr_wiggles

EVENTALIST
 EVENTALIST
EVENTALIST
profile
handy333 wrote:Well I'll be. I've never seen a script so small in all my years of using someone else's scripts in my games. I don't know if I've ever said this but I've always been good with events so thats how I get by.

That's how i started out was in eventing. Stick with them and you'll be coding in no time once you start seeing block similarities in the event commands. Have you made an event that uses labels?


handy333 wrote:I guess you won that theme song!
Congratulations!
Whenever you need one for a game let me know.
I'll do my best.

Sweet, thanks. Thinking about it i could use one for my old ass game from 6 years ago that i happened to find online in cryo sleep. It was in bad shape when i found it but i spent a few hours cleaning it up. I can PM you the Demo i slapped together.

That way you can see how the game "feels" and such.
EVENTALIST
Show Signature
EVENTALIST
Active Member
Active Member
#25 Re: How do I use Alias in RGSSx?
Loading

handy333

Active Member
Active Member
Active Member
profile
great. I'll take a look at it.

I have used some labels for a game I was working on for a Phoenix Wright like system. That turned out messy. Actually, the whole game turned out messy. That's how Project Rising Sun Started.
Active Member
Show Signature


Active Member
http://projectrisingsun.weebly.com/ http://soundcloud.com/handyfox http://www.youtube.com/channel/UCkBX7ZxqoXslAtqsdrmsn_w
#26 Re: How do I use Alias in RGSSx?
Loading

Sponsored content

profile

View previous topic View next topic Back to top Message [Page 1 of 1]

 

Chatbox system disabled
Personal messaging disabled