script help

chance = Random.rand(10)
if chance <= 4

"need command link for monster to use skill id"
end

everything works i just dont know the code i need to force the monster to trigger a skill id. im using this as a common event bring triggered by a skill.
That is not scripting, that is eventing - scripts are if you use the script editor that is part of the game editor.


What you need at this place is a force action, but that needs to check and know the active enemy indices of the current troop.


Can you give us more info on what exactly you want to do with this?
You could just turn on a switch, then have that skill set up in the monster's attack patterns, and conditioned by the switch. If you want to FORCE it to use that skill when the conditions are met, give it a priority that's 5 higher than any of the others in the attack pattern.


At some point you'll also want to turn the switch off again.
im using a common event to run a script and i cant use force ability cuz troop system i use doesnt work. u can just delete/close i have really bad grammer and cant explain anything.
force action and troop indices do work in a common event - but because the editor has no way to know which troop you're in, the lines remain blank without the enemy name.


But they will work if you are careful where to select which blank line.


Can you give us a screenshot of where you want to use it (the common event) and links to any battlescript if you're using one?
i got it working, i replaced the create battle action under game_enemy that way i gave the system 10% chance the monster will perform its action else return.

Spoiler
  #--------------------------------------------------------------------------
  # * Create Battle Action
  #--------------------------------------------------------------------------
  def make_actions
    super
    return if @actions.empty?
    action_list = enemy.actions.select {|a| action_valid?(a) }
    return if action_list.empty?
    if Random.rand($game_troop.members.size) <= $game_troop.members.size/10
      rating_max = action_list.collect {|a| a.rating }.max
      rating_zero = rating_max - 3
      action_list.reject! {|a| a.rating <= rating_zero }
      @actions.each do |action|
      action.set_enemy_action(select_enemy_action(action_list, rating_zero))
      end
    else
      return
    end
  end

Original thread: https://forums.rpgmakerweb.com/threads/script-help.53310/