[RMVX ACE] [RGSS] STATE THAT SEALS LEARNED SKILLS UNTIL RECOVERY

Posts

Pages: 1
Hey all,

I'm a bit stumped atm. I have a very basic knowledge of RGSS3 and I was wondering if anyone could help me learn how to go about forming a script.

Here is an idea of what I'd like it to do but I'm not sure is this is a good way to go about it:

class Game_CustomStateEffects < Game_BattlerBase
  #----
  # seal skills
  # - disable learned skills based on specific or random SkillID or TypeID
  # - disable a specific number of skills
  #----
  #
 
  def get_learnedskills
    #checks all currently learned skills and their type
  end
 
  def sealskill (SkillID)
    #disables specific skill based on ID
  end
 
  def sealskilltype (SkilltypeID)
    #disables skill type based on ID
  end
 
  def sealrandomskill (x,SkilltypeID)
    #seals x number of skills at random, limited to type
  end
 
end
Marrend
Guardian of the Description Thread
21781
A state can have a feature that seals specific skills, or a skill category, with no additional coding. The tricky part is where you're sealing a certain number skills at random, given a skill category. I haven't quite figured out all the details, but, I do have...

def sealrandomskills(actor, num, stype_id)
  if actor.added_skill_types.include(stype_id)
    disable_array = []
    i = 0
    while i < actor.skills.size
      skill = actor.skills[i]
      if skill.s_type == s_type
        disable_array.push(skill)
      end
      i += 1
    end
    if disable_array.size <= num
      #feature = RPG::Feature.new(code, data_id, value)
      # "code" variable can be looked up via Game_BattlerBase
      # FEATURE_STYPE_SEAL = 42; FEATURE_SKILL_SEAL = 44
      # "data_id" variable is, probably, in this case, either the skill, or
      # skill cateogry, to seal.
      # No clue what "value" would be in this case. Doing nothing will set
      # it to 0, so, maybe doing nothing is what should be done?
      feature = RPG::Feature.new(42, stype_id)
    else
      #later
    end
  end
end

...this?
author=Marrend
A state can have a feature that seals specific skills, or a skill category, with no additional coding. The tricky part is where you're sealing a certain number skills at random, given a skill category. I haven't quite figured out all the details, but, I do have...

def sealrandomskills(actor, num, stype_id)
  if actor.added_skill_types.include(stype_id)
    disable_array = []
    i = 0
    while i < actor.skills.size
      skill = actor.skills[i]
      if skill.s_type == s_type
        disable_array.push(skill)
      end
      i += 1
    end
    if disable_array.size <= num
      #feature = RPG::Feature.new(code, data_id, value)
      # "code" variable can be looked up via Game_BattlerBase
      # FEATURE_STYPE_SEAL = 42; FEATURE_SKILL_SEAL = 44
      # "data_id" variable is, probably, in this case, either the skill, or
      # skill cateogry, to seal.
      # No clue what "value" would be in this case. Doing nothing will set
      # it to 0, so, maybe doing nothing is what should be done?
      feature = RPG::Feature.new(42, stype_id)
    else
      #later
    end
  end
end

...this?

Thanks for the reply and the explanations ^^
I'll keep those variables in mind. If you don't mind me asking, how would you go about writing a script call for this? Every time I write something like $Game_CustomStateEffects.sealrandomskills(actor, 3, 1) I receive a syntax error.
Marrend
Guardian of the Description Thread
21781
author=ClavisAnima
If you don't mind me asking, how would you go about writing a script call for this? Every time I write something like $Game_CustomStateEffects.sealrandomskills(actor, 3, 1) I receive a syntax error.


It seems to me that your expectation is that there is a variable called "$Game_CustomStateEffects" when such has not been defined yet. There's a few ways to go about it, but, the general rule of thumb is to write something like...

var = Game_CustomStateEffects.new


...this. There's some technical babble behind this that might be a tad beyond the scope of a thread like this, but, what that line does is create an object that contains the functions and variables of the "Game_CustomStateEffects" class. From which you could type a line such as...

var.sealrandomskills(actor, 3, 1)


...later.

For instance, the global variables that start with the "$" character that can be accessed from anywhere are defined in the Data_Manager class...

module DataManager
  #--------------------------------------------------------------------------
  # * Create Game Objects
  #--------------------------------------------------------------------------
  def self.create_game_objects
    $game_temp          = Game_Temp.new
    $game_system        = Game_System.new
    $game_timer         = Game_Timer.new
    $game_message       = Game_Message.new
    $game_switches      = Game_Switches.new
    $game_variables     = Game_Variables.new
    $game_self_switches = Game_SelfSwitches.new
    $game_actors        = Game_Actors.new
    $game_party         = Game_Party.new
    $game_troop         = Game_Troop.new
    $game_map           = Game_Map.new
    $game_player        = Game_Player.new
  end
end


...like so. This isn't to say that this code needs to be accessed from absolutely anywhere. As a state, it should probably be limited to the context of the RPG::State class...

class RPG::State < RPG::BaseItem
def sealrandomskills(actor, num, stype_id)
  if actor.added_skill_types.include(stype_id)
    disable_array = []
    i = 0
    while i < actor.skills.size
      skill = actor.skills[i]
      if skill.s_type == s_type
        disable_array.push(skill)
      end
      i += 1
    end
    if disable_array.size <= num
      #feature = RPG::Feature.new(code, data_id, value)
      # "code" variable can be looked up via Game_BattlerBase
      # FEATURE_STYPE_SEAL = 42; FEATURE_SKILL_SEAL = 44
      # "data_id" variable is, probably, in this case, either the skill, or
      # skill cateogry, to seal.
      # No clue what "value" would be in this case. Doing nothing will set
      # it to 0, so, maybe doing nothing is what should be done?
      feature = RPG::Feature.new(42, stype_id)
      actor.features.push(feature) # <- Not 100% sure about this line.
    else
      #later
    end
  end
end


..like so. Though, even if I did figure out how to implement the sealing of skills, the question becomes how to set a state to seal the skill(s) in question. Not to mention what, exactly, happens when the state dissolves.

For what it's worth, I made a game in Ace where actors would gain and/or lose features as other characters joined and/or left the active party. Among other tidbits. What I was doing there isn't quite the same as what you're looking to do, but, it was quite complex, and I would not do that again, even if somebody paid me.

Thank you, that clears up a lot for me!
Btw I didn't know State was a class of its own. I tried searching for a class like it in the script editor but I couldn't find anything. Maybe I'm not searching for the right thing but are there any other classes like it that I should know about?

I also think that setting a state to seal the skills might be a challenge. I might look at some scripts that deal with states and maybe that'll help me get some ideas for tacking those questions.

For the game I intended to make this script for, I might have to use a different method to achieve the effect I'm looking for since I'm working on a deadline and I realise that I wont be using the feature that much. Nonetheless, I'll keep working on this script as a side project just in case I might need it for another game. I'll try and post updates as I work on it. Thanks again Marrend for your help ^^
Marrend
Guardian of the Description Thread
21781
To be fair, anything attached to the "RPG" module (which is actually a lot of stuff) cannot be found in the script editor. At all. What information there is on them can be found with the help-file, though.

*Edit: I'm happy to have been some help! Though, if you're on a deadline, it might behoove you to work within the given event-commands and seal a skill category, rather than random skills within that category.
Pages: 1