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.

Skill Cooldown

Can someone teach me how to make skills cooldown or can someone make a script of it for me?
ex. Fire = 0 cooldown turns
Greater Fire = 2 cooldown turns (it can only be use again after 2 turns)
Mass Fire = 5 cooldown turns (it can only be use again after 5 turns)

The Max Cooldown Turn of my skills is 10

Thanks in advance. I will greatly appreciate any Help :)

Can someone also tell me what is ATK-F, EVA-F, STR-F, DEX-F, AGI-F, INT-F, PDEF-F, MDEF-F and Variance.
And how are these thing affects skills.

Thanks
 
How do you want to show the user that the skill is not available until it's "cooldown" (recharge)?


If you look in the "Battle Formulas" section of the help document, you'll see that all of the *-F values are a percentage of that characteristic used to calculate damage.
If you notice in the skills in the database, weapon skills (as opposed to magic skills) use ATK-F & STR-F as factors, where magic skills use INT-F.

The exception being EVA-F, which is a percentage of the default EVA (8 * target's AGI / attacker's DEX - target's EVA, which is the sum of all armor & state EVAs) as a chance to evade. i.e. If you set EVA-F to 100, you use the default EVA. If a skill is harder to evade, set the EVA-F to a smaller number.

Variance is just that, expressed as a percentage. Once the damage is calculated using all the other factors, it randomizes the final result. i.e. Variance = 15 means + or - 15% on the final damage result.
 
reiven10":3cg2in8f said:
Can someone teach me how to make skills cooldown or can someone make a script of it for me?
ex. Fire = 0 cooldown turns
Greater Fire = 2 cooldown turns (it can only be use again after 2 turns)
Mass Fire = 5 cooldown turns (it can only be use again after 5 turns)

The Max Cooldown Turn of my skills is 10

Thanks in advance. I will greatly appreciate any Help :)

Can someone also tell me what is ATK-F, EVA-F, STR-F, DEX-F, AGI-F, INT-F, PDEF-F, MDEF-F and Variance.
And how are these thing affects skills.

Thanks

You can do this without scripts. Add a common event call to those skills, and then make that they sum to a variable the number of turns left (make a variable for each skill) and remove that skill.

Then put a page in all enemy groups with condition that checks every turn.This will call a common event that removes -1 to all skill_turns_variables and check if they are 0. If they are 0 is that the player had the cooldown and then make that learn again that skill.

pd: the problem will be how can you know what actor is doing the magic and how teach skills by variables. You will have to call this script in the event call in the skill:

actor_id=$scene.attacker_id
$game_variables 
 
@gertrunk - sorry if this reply was too late, I hope you can still answer my question
It took me hard to understand this but at the end I was still able to do it, but how could I able to to removed the used skill through scipt?

thank you very much! :) I hope your still in rmxp community
 
Hmmm . . . so it must be something like . . .

1st Common Event
@>Control Variables: [001: Heal] -= 1
@>Conditional Branch: Variable [001: Heal] <= 0
@>Script: v=$game_variable[1]
: :$game_actors[v].learn_skill(1)
@>
: Branch End
@>Control Variables: [002: Greater Heal] -= 1
@>Conditional Branch: Variable [002: Greater Heal] <= 0
@>Script: v=$game_variable[2]
: :$game_actors[v].learn_skill(2)
@>
: Branch End
@>Control Variables: [003: Mass Heal] -= 1
@>Conditional Branch: Variable [003: Heal] <= 0
@>Script: v=$game_variable[3]
: :$game_actors[v].learn_skill(3)
@>
: Branch End
@>

2nd Common Event
@>Control Variables: [001: Heal] += 2
@>Script: actor_id=$scene.attacker_id
: : $game_variables[1] = actor_id
@>Script: v=$game_variable[1]
: :$game_actors[v].forget_skill(1)
@>

3rd Common Event
@>Control Variables: [002: Greater Heal] += 5
@>Script: actor_id=$scene.attacker_id
: : $game_variables[2] = actor_id
@>Script: v=$game_variable[2]
: :$game_actors[v].forget_skill(2)
@>

4th Common Event
@>Control Variables: [003: Mass Heal] += 10
@>Script: actor_id=$scene.attacker_id
: : $game_variables[3] = actor_id
@>Script: v=$game_variable[3]
: :$game_actors[v].forget_skill(3)
@>

Then in every troops i will put the Condition Turn 1+1X with Span of Turn, then call the 1st Common Event
Is there something wrong on what am I doing?

Heal = 2 cooldown
Greater Heal = 5 cooldown
Mass Heal = 10cooldown

@Brewmeister - Thank you very much for helping me

Hmmm . . . can it be done without needing the skills to forget, i mean just disable the skill and it cannot be use until the cooldown is over and while in cooldown the mana replaces the number of cooldown left

Thank you guys for helping me, i would greatly appreciate any help
 
Instead of 'forget_skill' & 'learn_skill', you could set the 'occasion', but it would be in the current copy of the database, so if 2 actors have the same skill it would disable it for both. If each actor has unique skills, try

$data_skills[3].occasion = 3 # 0: always, 1: battle, 2: menu, 3: never
 
In my previous post, I think there is something wrong with it, cause it didn't learn back the skill that I have use,
Do it work well with RTAB? I am using RTAB and i just thought that it wont work because, the higher your agility the often you attack, and the Conditional Turn only occur every turns of those troops right?
If I am right . . . can it be dont with, every skill has common event and whenever you do an atk, skill, defend of use an item, the cooldown turn of those skill still at cooldown will reduced by one, this way i don't think that I would be needing the Conditional turns for troops.

Thank you very much Brewmeister, i hope you can still answer my question.
 
I don't have, or use RTAB. Unless it is set up to interpret troop events the way the default battle system is, the "turn" logic won't work for you.
You need someone who is familiar with the RTAB to insert the code to decrement your game_variables.
 
How would I add a common event on script?

Ex. if Input.trigger?(Input::C)
# Branch by actor command window cursor position
case @actor_command_window.index
when 0 # attack
# Play decision SE
$game_system.se_play($data_system.decision_se)
# Set action
@active_battler.current_action.kind = 0
@active_battler.current_action.basic = 0
# Start enemy selection
start_enemy_select

How would I add that, after the Attack, I call a common event which reduced the variable of each skill of the same actor who does the attack, to be able to use it again
 
NoMethodError occurred while running the script.
undefined method`learn_skill`for nil:NilClass

this error occurred when I do what gerrtunk said

its not because of my RTAB because i created a new project to try it first, and this error appeared when i used a skill
 

Atoa

Member

Cooldown[Skill ID] = Turns
Code:
#==============================================================================

# 

#------------------------------------------------------------------------------

# 

#==============================================================================

module Config

  Cooldown = {}

  

  Cooldown[1] = 2

end

 

#==============================================================================

# 

#------------------------------------------------------------------------------

# 

#==============================================================================

class RPG::Skill

  #--------------------------------------------------------------------------

  # 

  #--------------------------------------------------------------------------

  def cooldown

    return (Config::Cooldown[@id] != nil ? Config::Cooldown[@id] : 0)

  end

end

 

#==============================================================================

# 

#------------------------------------------------------------------------------

# 

#==============================================================================

class Game_Battler

  #--------------------------------------------------------------------------

  # 

  #--------------------------------------------------------------------------

  attr_accessor :cooldown

  #--------------------------------------------------------------------------

  # 

  #--------------------------------------------------------------------------

  alias cooldown_initialize initialize

  def initialize

    cooldown_initialize

    @cooldown = {}

  end

  #--------------------------------------------------------------------------

  # 

  #--------------------------------------------------------------------------

  alias cooldown_skill_can_use skill_can_use?

  def skill_can_use?(skill_id)

    return false if @cooldown[skill_id] != nil and @cooldown[skill_id] > 0

    return cooldown_skill_can_use(skill_id)

  end

  #--------------------------------------------------------------------------

  # 

  #--------------------------------------------------------------------------

  def update_cooldowns

    @cooldown.keys.each {|id| 

      @cooldown[id] = [@cooldown[id] - 1, 0].max if @cooldown[id] != nil

    }

  end

  #--------------------------------------------------------------------------

  # 

  #--------------------------------------------------------------------------

  def cooldown_clear

    @cooldown.keys.each {|id| @cooldown[id] = 0}

  end

  #--------------------------------------------------------------------------

  # 

  #--------------------------------------------------------------------------

  alias cooldown_skill_effect skill_effect

  def skill_effect(user, skill)

    effective = cooldown_skill_effect(user, skill)

    user.cooldown[skill.id] = skill.cooldown if effective

    return effective

  end

end

 

#==============================================================================

# 

#------------------------------------------------------------------------------

# 

#==============================================================================

class Scene_Battle

  #--------------------------------------------------------------------------

  # 

  #--------------------------------------------------------------------------

  alias cooldown_update_phase4_step2 update_phase4_step2

  def update_phase4_step2

    @active_battler.update_cooldowns

    cooldown_update_phase4_step2

  end

  #--------------------------------------------------------------------------

  # 

  #--------------------------------------------------------------------------

  alias cooldown_battle_end battle_end

  def battle_end(result)

    for actor in $game_party.actors

      actor.cooldown_clear

    end

    cooldown_battle_end(result)

  end

end
Some considerations:
- The cooldown are counted on the begin character action, if something keep the actor from acting the cooldown won't be counted.
- It works for both enemies and actors, and the count are independent.
- The cooldowns are cleared at the end of the battle, if an actor is removed during the battle, his cooldown won't be cleared (what will block skills even on the main menu), you can manually clear the cooldowns by making an script call with "$game_actors[ID].cooldown_clear"
- This works on the default battle system, i don't know if it will works with another battle systems.
 
The script is pretty good and simple to use . . . but, too bad it's not compatible with RTAB.
Atoa can i ask you a question? I am pretty new at RPG Maker XP and I think I am so young to learn Game Making
I am just a 1st year collage student but i took the course of information technology, since I think we will going to study something similar to this in the future, I would like to do some experiment and study this program on my own.
Here's my question, How do you do scripts? Do you type it manually? or your using another program to make the script.
I asked this because I notice the Comments, I thought it was made by another program bacause what's the purpose of typing those comments without any real text of information, It comes to my mind that It was on default using the program

Hope you can answer my question
BTW . . . thank you very much for helping me :)
 

Atoa

Member

I type them manually. I was just not in the mood to add the coments, but i add the comment lines so the code still organized.

Also it wouldn't be hard to make it RTAB compatible, i just don't do it because i never used the RTAB, not even looked into it's code once, so i'm not familiarized with it and i'm not going to study an huge script like it just for an small compatibility fix, but anyone more familiarized with it could do the edits fast, since it only edits two methods from Scene_Battle.
 
Ohh I see, thanks a lot
Do you have any advice, where to start to study RGSS?
Well, im not that new at programming since i already know C++ and Java JCreator, but this one seems different to them
and now im desperate to learn RGSS to be able to make a good game.
 

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