RMRK is retiring.
Registration is disabled. The site will remain online, but eventually become a read-only archive. More information.

RMRK.net has nothing to do with Blockchains, Cryptocurrency or NFTs. We have been around since the early 2000s, but there is a new group using the RMRK name that deals with those things. We have nothing to do with them.
NFTs are a scam, and if somebody is trying to persuade you to buy or invest in crypto/blockchain/NFT content, please turn them down and save your money. See this video for more information.
[RESOLVED][RMVX]Dynamically random skills

0 Members and 1 Guest are viewing this topic.

***
Rep:
Level 89
... I got nothing.
So, I have a guy, who has a skill, that randomly uses other skills he knows.

For example:

Guy uses "Randomize"

Then he might use Fire, Ice or Lightning.

What I'm wondering, is if it's possible to let him learn... Quake, then when he uses 'randomize' there's a chance he can use Fire, Ice, Lightning or Quake.

Any thoughts?
« Last Edit: August 31, 2010, 02:36:45 AM by epson777341 »

***
Rep:
Level 89
... I got nothing.
Bump.

Was I being too vague?

I know I have to use Common events, and conditional branches. I'm just stuck on how to use them.

*****
Rep:
Level 84
This text is way too personal.
Bronze - GIAW 11 (Hard)Silver - GIAW Halloween
Long Way:

Check to see what skills the character has. If you don't have skill books, you can just use $game_party.members[1].skills.size to check for how many. Then randomize accordingly.

Short would be a lot more complicated, but shorter.
« Last Edit: August 27, 2010, 11:08:55 PM by cozziekuns »

***
Rep:
Level 89
... I got nothing.
I deal with insanely tedious and complicated events everyday.

I'm not too good with scripting and the guy learns his skills in no particular order.

What's the other way, if you don't mind me asking?

*****
Rep:
Level 84
This text is way too personal.
Bronze - GIAW 11 (Hard)Silver - GIAW Halloween
Well, I was thinking of altering the force action command in Game_Interpreter to check if a certain switch is on, which would be turned on and off according to the common event. Then use force action. The problem is, I have no idea if you want randomize to activate only specific skills, or all his skills. If it's specific, it gets even more complicated.

***
Rep:
Level 89
... I got nothing.
Well, all but one of his skills, which is the skill that randomizes.

*****
Rep:
Level 84
This text is way too personal.
Bronze - GIAW 11 (Hard)Silver - GIAW Halloween
Oh, then that's easy.

Code: [Select]
module COZZIEKUNS
  module RANDOMIZE
    ACTOR_ID = 1 # Actor ID of the person with the skill "Randomize".
    SWITCH_ID = 1 # ID of the Switch that activates with the skill "Randomize".
    SKILL_ID = 1 # ID of the Skill "Randomize".
  end
end

#==============================================================================
# ** Game_Interpreter
#------------------------------------------------------------------------------
#  An interpreter for executing event commands. This class is used within the
# Game_Map, Game_Troop, and Game_Event classes.
#==============================================================================

class Game_Interpreter 
  #--------------------------------------------------------------------------
  # * Force Action
  #--------------------------------------------------------------------------
  def command_339
    loop do
      random_skill = rand($game_actors[COZZIEKUNS::RANDOMIZE::ACTOR_ID].skills.size) + 1
      break if random_skill != COZZIEKUNS::RANDOMIZE::SKILL_ID
    end
    iterate_battler(@params[0], @params[1]) do |battler|
      next unless battler.exist?
      battler.action.kind = @params[2]
      if battler.action.kind == 0
        battler.action.basic = @params[3]
      else
        if $game_switches[COZZIEKUNS::RANDOMIZE::SWITCH_ID]
          battler.action.skill_id = random_skill
        else
          battler.action.skill_id = @params[3]
        end
      end
      if @params[4] == -2                   # Last target
        battler.action.decide_last_target
      elsif @params[4] == -1                # Random
        battler.action.decide_random_target
      elsif @params[4] >= 0                 # Index designation
        battler.action.target_index = @params[4]
      end
      battler.action.forcing = true
      $game_troop.forcing_battler = battler
      @index += 1
      return false
    end
    return true
  end
end
« Last Edit: August 28, 2010, 03:41:46 PM by cozziekuns »

***
Rep:
Level 89
... I got nothing.
Hmmm...

Doesn't seem to be working..

He uses randomize and that's it.

*****
Rep:
Level 84
This text is way too personal.
Bronze - GIAW 11 (Hard)Silver - GIAW Halloween
Sorry for not explaining this to you. Well, what your supposed to do is:

Make the skill "Randomize" link to a common event.
Check the switch (SWITCH_ID) to ON.
Force Action: Anything.

And that's it.


*****
Rep:
Level 84
This text is way too personal.
Bronze - GIAW 11 (Hard)Silver - GIAW Halloween
That's weird. Use this for now:

Code: [Select]
module COZZIEKUNS
  module RANDOMIZE
    ACTOR_ID = 1 # Actor ID of the person with the skill "Randomize".
    SWITCH_ID = 1 # ID of the Switch that activates with the skill "Randomize".
    SKILL_ID = 1 # ID of the Skill "Randomize".
  end
end

#==============================================================================
# ** Game_Interpreter
#------------------------------------------------------------------------------
#  An interpreter for executing event commands. This class is used within the
# Game_Map, Game_Troop, and Game_Event classes.
#==============================================================================

class Game_Interpreter 
  #--------------------------------------------------------------------------
  # * Force Action
  #--------------------------------------------------------------------------
  def command_339
    random_skill = rand($game_actors[COZZIEKUNS::RANDOMIZE::ACTOR_ID].skills.size) + 1
    iterate_battler(@params[0], @params[1]) do |battler|
      next unless battler.exist?
      battler.action.kind = @params[2]
      if battler.action.kind == 0
        battler.action.basic = @params[3]
      else
        if $game_switches[COZZIEKUNS::RANDOMIZE::SWITCH_ID]
          battler.action.skill_id = random_skill
        else
          battler.action.skill_id = @params[3]
        end
      end
      if @params[4] == -2                   # Last target
        battler.action.decide_last_target
      elsif @params[4] == -1                # Random
        battler.action.decide_random_target
      elsif @params[4] >= 0                 # Index designation
        battler.action.target_index = @params[4]
      end
      battler.action.forcing = true
      $game_troop.forcing_battler = battler
      @index += 1
      return false
    end
    return true
  end
end

Which means he has a chance of using randomize again.

***
Rep:
Level 89
... I got nothing.
I'm getting an error.

For the first code you gave me:

undefined local variable or method 'random_skill' for
#<Game_Interpreter:0xb1979a0>


When I tried the second code, he used a skill he didn't have. He used Skill #4 when his randomize skill is #220

EDIT: He'll use a random skill from #1 to #however many skills he knows.
« Last Edit: August 30, 2010, 04:10:51 AM by epson777341 »

*****
Rep:
Level 84
This text is way too personal.
Bronze - GIAW 11 (Hard)Silver - GIAW Halloween
That's weird. I'll have to check it out later though. Sorry for the inconvenience.

**
Rep: +0/-0Level 75
RMRK Newbie
The kind of common event you are looking for should be pretty simple to do.
Just a loop, conditional branches for each skill that may be usable in the random-skill, and loop-breaks whenever a skill got chosen and casted.

This will only properly work if your characters are locked however... like the 1st char always is Actor No. 1. If you want that random ability to work no matter how your characters are grouped you need it in script, yeah.

Gonna try to show it with event code/whatever:
I skipped all "Else" clauses that wouldn't affect the code beside making it less readable.

@>Loop
     @>Control Variables: [000#: Random] = Random No. (1...# skills usable by the ability)
     @>Conditional Branch: Variable [000#: Random] == 1
          @>Conditional Branch: [CharacterX] is [Skill A] learned
               @>Force action: Actor No.1, [Skill A], Random, Execute Now
               @>Exit Event Processing or Break Loop
     @>Conditional Branch: Variable [000#: Random] == 2
          @>Conditional Branch: [CharacterX] is [Skill B] learned
               @>Force action: Actor No.1, [Skill B], Random, Execute Now
               @>Exit Event Processing or Break Loop

        .....

     @>Conditional Branch: Variable [000#: Random] == # skills usable by ability
          @>Conditional Branch: [CharacterX] is [Skill Omega] learned
               @>Force action: Actor No.1, [Skill Omega], Last Target, Execute Now
               @>Exit Event Processing or Break Loop

 : Repeat Above (Until a usable skill has been randomly selected and executed, at which point the Event or Loop will stop processing and the battle should then proceed as normal.)

Now I lost track of where I placed that new event on my map... x_x
Hope this helps.

***
Rep:
Level 89
... I got nothing.
Wouldn't work, My characters can be in any position...

Thanks anyway.

*****
Rep:
Level 84
This text is way too personal.
Bronze - GIAW 11 (Hard)Silver - GIAW Halloween
Code: [Select]
module COZZIEKUNS
  module RANDOMIZE
    ACTOR_ID = 1 # Actor ID of the person with the skill "Randomize".
    SWITCH_ID = 1 # ID of the Switch that activates with the skill "Randomize".
    SKILL_ID = 1 # ID of the Skill "Randomize".
  end
end

#==============================================================================
# ** Game_Interpreter
#------------------------------------------------------------------------------
#  An interpreter for executing event commands. This class is used within the
# Game_Map, Game_Troop, and Game_Event classes.
#==============================================================================

class Game_Interpreter
  #--------------------------------------------------------------------------
  # * Force Action
  #--------------------------------------------------------------------------
  def command_339
    random_skill = 0
    loop do
      random_skill = rand($game_actors[COZZIEKUNS::RANDOMIZE::ACTOR_ID].skills.size) + 1
      break if random_skill != COZZIEKUNS::RANDOMIZE::SKILL_ID
    end
    iterate_battler(@params[0], @params[1]) do |battler|
      next unless battler.exist?
      battler.action.kind = @params[2]
      if battler.action.kind == 0
        battler.action.basic = @params[3]
      else
        if $game_switches[COZZIEKUNS::RANDOMIZE::SWITCH_ID]
          battler.action.skill_id = random_skill
        else
          battler.action.skill_id = @params[3]
        end
      end
      if @params[4] == -2                   # Last target
        battler.action.decide_last_target
      elsif @params[4] == -1                # Random
        battler.action.decide_random_target
      elsif @params[4] >= 0                 # Index designation
        battler.action.target_index = @params[4]
      end
      battler.action.forcing = true
      $game_troop.forcing_battler = battler
      @index += 1
      return false
    end
    return true
  end
end

I actually tested this code, so I'm really sure it works this time.

***
Rep:
Level 89
... I got nothing.
Argh, nope.

He still uses a random skill from 1 to 'however many skills he has'

Could it be because I'm using Battle engine Melody?

*****
Rep:
Level 84
This text is way too personal.
Bronze - GIAW 11 (Hard)Silver - GIAW Halloween
Maybe, but it's probably my lack of judgement.

Code: [Select]
module COZZIEKUNS
  module RANDOMIZE
    ACTOR_ID = 1 # Actor ID of the person with the skill "Randomize".
    SWITCH_ID = 1 # ID of the Switch that activates with the skill "Randomize".
    SKILL_ID = 1 # ID of the Skill "Randomize".
  end
end

#==============================================================================
# ** Game_Interpreter
#------------------------------------------------------------------------------
#  An interpreter for executing event commands. This class is used within the
# Game_Map, Game_Troop, and Game_Event classes.
#==============================================================================

class Game_Interpreter
  #--------------------------------------------------------------------------
  # * Force Action
  #--------------------------------------------------------------------------
  def command_339
    random_skill = 0
    loop do
      random_skill = rand($game_actors[COZZIEKUNS::RANDOMIZE::ACTOR_ID].skills.size)
      break if random_skill != COZZIEKUNS::RANDOMIZE::SKILL_ID
    end
    iterate_battler(@params[0], @params[1]) do |battler|
      next unless battler.exist?
      battler.action.kind = @params[2]
      if battler.action.kind == 0
        battler.action.basic = @params[3]
      else
        if $game_switches[COZZIEKUNS::RANDOMIZE::SWITCH_ID]
          battler.action.skill_id = $game_actors[COZZIEKUNS::RANDOMIZE::ACTOR_ID].skills[random_skill].id
        else
          battler.action.skill_id = @params[3]
        end
      end
      if @params[4] == -2                   # Last target
        battler.action.decide_last_target
      elsif @params[4] == -1                # Random
        battler.action.decide_random_target
      elsif @params[4] >= 0                 # Index designation
        battler.action.target_index = @params[4]
      end
      battler.action.forcing = true
      $game_troop.forcing_battler = battler
      @index += 1
      return false
    end
    return true
  end
end

This SHOULD work, but seeing as I've been saying that a lot, I'm not so sure now.




***
Rep:
Level 89
... I got nothing.
Awesome, it works.

Thanks a lot, Cozziekuns!

I'll change the topic to [Resolved]