Envision, Create, Share

Welcome to HBGames, a leading amateur game development forum and Discord server. All are welcome, and amongst our ranks you will find experts in their field from all aspects of video game design and development.

How to add dual-wield to a character through 'call script'

Hello,

I'm sorry if this has been answered, I had no luck with the search function.

I'm using a passive skill script and I want one of the skills to enable a character to dual-wield, so I was thinking something like

if actor has dual-wield_ability then
actor.two_swords_style = true
end

Obviously the syntax is wrong, but I'm still new at this ;_;

Any help is appreciated!
 

Tdata

Sponsor

Dargor":372gl566 said:
You will need this little code.
Code:
#==============================================================================
# ** Game_Actor
#------------------------------------------------------------------------------
#  This class handles actors. It's used within the Game_Actors class
# ($game_actors) and referenced by the Game_Party class ($game_party).
#==============================================================================

class Game_Actor < Game_Battler
  #--------------------------------------------------------------------------
  # * Public Instance Variables
  #--------------------------------------------------------------------------
  attr_accessor :two_swords_style
  #--------------------------------------------------------------------------
  # * Alias Listing
  #--------------------------------------------------------------------------
  alias dargor_vx_actor_tss_setup setup
  #--------------------------------------------------------------------------
  # * Setup
  #     actor_id : actor ID
  #--------------------------------------------------------------------------
  def setup(actor_id)
    dargor_vx_actor_tss_setup(actor_id)
    @two_swords_style = $data_actors[actor_id].two_swords_style
  end
end

With that, you can change the two_swords_style flag by using
Code:
$game_actors[actor_id].two_swords_style = flag

Take care!
-Dargor
 
Ah, how embarrassing, I can't get it to work  :down:

It seems I'm having trouble on where to put the alias thing.
Nowhere in my code did I have any other Alias Listing, so I just tried putting the code above and below certain places, but no luck.

At the moment I have it under:
def setup(actor_id)
...
@level = actor.initial_level
alias dargor_vx_actor_tss_setup setup
dargor_vx_actor_tss_setup(actor_id)
@two_swords_style = $data_actors[actor_id].two_swords_style
@exp_list = Array.new(101)
...
end
I'm getting an error message on line 52, saying the stack level is too deep... whatever that means  :huh:

This is my 52nd line:  @character_index = actor.character_index

Sorry for being a noob, totally new to scripting, apparently x.x

Thanks so much for the reply!
 
I did that script on request, you only have to place the script above Main and Below everything else and in a script call, you use: $game_actors[actor_id].two_swords_style = flag (true/false)
 

Thank you for viewing

HBGames is a leading amateur video game development forum and Discord server open to all ability levels. Feel free to have a nosey around!

Discord

Join our growing and active Discord server to discuss all aspects of game making in a relaxed environment. Join Us

Content

  • Our Games
  • Games in Development
  • Emoji by Twemoji.
    Top