RMRK is retiring.
Server is paid up for the rest of 2026, but the forum may go after that. See here for more information. Please archive or save anything you would like to keep before 2027.
Main Menu
  • Welcome to The RPG Maker Resource Kit.

[VX] Problem with Tankentai/Force Action maybe?

Started by thanatos2k1, December 05, 2011, 07:16:28 AM

0 Members and 1 Guest are viewing this topic.

thanatos2k1

Hello,  I'm attempting to make a skill that increases the amount of attacks based on agility, I have it mapped out and working properly.. but when it kills an enemy, it crashes the game here:

Script 'Sideview 2 (3.4d)' line 767: NoMethodError occured.

undefined method 'actor?' for nil:NilClass


The problem that I seem to be having possibly has to deal with the Mithran's Force Action script:

# Advanced forced action
# by Mithran
# Use an Advanced > Script event command to trigger

#
#######FORMAT
#######    force_action(-1, 1, 1, 237, -1)

#format is:
# force_action(A, B, C, D, E)
# replace A with the group you want to pick the actor or enemy out of
#  -1 = target actors by index
#   0 = target enemies by troop index
#   1 = target actors by party index

# replace B with the index of the actor or enemy you want to pick
# for troop and party, the index number starts at zero
# (eg., default party is 0 Ralph, 1 Ulrika, 2 Bennett, 3 Ylva)
# actor index starts at 1
# (eg., default party is 1 Ralph, 2 Ulrika, 3 Bennett, 4 Ylva)

# Replace C with the kind of action you want to force
# 0 = basic
# 1 = skill
# 2 = item  *
# *ignored on enemies 
# *Item is still consumed, but it is not checked before using.  May change this later.

# Replace D with the id of the action you want to perform
# if C is basic (0)
#  0 - attack
#  1 - guard
#  2 - escape*
#  3 - wait
# *escape is ignored on actors
# if C is skill or item
#  the id of the item or skill you are selecting to force

# Replace E with the index of the target you want to force to
# -2 = select the last target*
# -1 = choose a random target
#  0 or above = pick the selected group index
# *if the previous action had no target, this forced action will be ignored

# Example:
# force_action(-1, 1, 1, 2, -2)
# forces Ralph (if he is in the party) to use double attack on the last enemy he
# targeted


module Mithran
  module ForceAction
module_function
def force_action(group, index_id, kind, basic_id, target_id, scope_change = false)
  battler = nil
  if group == -1
battler = $game_actors[index_id]
return if !$game_party.members.include?(battler)
  elsif group == 0
battler = $game_troop[index_id]
  else
battler = $game_party[index_id]
  end
  return if battler.nil?
  return if !battler.exist?
  case kind
  when 1
skill = $data_skills[basic_id]
return if skill.nil?
battler.action.set_skill(basic_id)
  when 2
item = $data_items[basic_id]
return if item.nil?
return if !battler.actor?
battler.action.set_item(basic_id)
  else
case basic_id
when 0  # Attack
  battler.action.set_attack
when 1  # Guard
  battler.action.set_guard
when 2  # Escape
  battler.action.kind = 0
  if battler.actor?
battler.action.basic = 3
  else
battler.action.basic = 2
  end
else  # Wait
  battler.action.kind = 0
  battler.action.basic = 3
end
  end
  case target_id
  when -2
battler.action.decide_last_target
  when -1
battler.action.decide_random_target
  when 0..99
battler.action.target_index = target_id
  end
  battler.action.forcing = true
  $game_troop.forcing_battler = battler
end
  end
end

class Game_Interpreter
  include Mithran::ForceAction
end


I can't exactly remove this script either because it allows the skill to work the way I have it set up.. 
The way I have it set up is a Common Event determines the agility of an actor, and then based on that variable it links to a new skill (there are eight in all)  with a new sequence (also eight), the sequence determins how many times the actor hits.  And are set up like this:


[spoiler]
"EVICERATE1" =>
                       ["12","JUMP_TO_TARGET","DASH_ATTACK","WEAPON_DAMAGE","DAMAGE_ANIM",
                        "Can Collapse",
     
                        "FLEE_RESET",],                     
                       

  "EVICERATE2" =>      ["12","JUMP_TO_TARGET","DASH_ATTACK","WEAPON_DAMAGE","DAMAGE_ANIM",
                        "Can Collapse",
                        "10","JUMP_TO_TARGET","STEP_ATTACK","WEAPON_DAMAGE","DAMAGE_ANIM",     
                        "Can Collapse","FLEE_RESET",],                     
                       
  "EVICERATE3" =>
                       ["12","JUMP_TO_TARGET","DASH_ATTACK","WEAPON_DAMAGE","DAMAGE_ANIM",
                        "Can Collapse",
                        "10","JUMP_TO_TARGET","STEP_ATTACK","WEAPON_DAMAGE","DAMAGE_ANIM", 
                        "9","MOVE_TO_TARGET","UNDER_SWING","WEAPON_DAMAGE","DAMAGE_ANIM",   
                        "Can Collapse","FLEE_RESET",],                       
                       
  "EVICERATE4" =>
                       ["12","JUMP_TO_TARGET","DASH_ATTACK","WEAPON_DAMAGE","DAMAGE_ANIM",
                        "Can Collapse",
                        "10","JUMP_TO_TARGET","STEP_ATTACK","WEAPON_DAMAGE","DAMAGE_ANIM", 
                        "9","MOVE_TO_TARGET","UNDER_SWING","WEAPON_DAMAGE","DAMAGE_ANIM", 
                        "JUMP_BEHIND_TARGET2","12","DASH_ATTACK","VERT_SWINGL", 
                        "WEAPON_DAMAGE","DAMAGE_ANIM", 
                        "Can Collapse","FLEE_RESET",],                       
                       
  "EVICERATE5" =>
                       ["12","JUMP_TO_TARGET","DASH_ATTACK","ANIM","DAMAGE_ANIM","Can Collapse",
                        "10","JUMP_TO_TARGET","STEP_ATTACK","ANIM","DAMAGE_ANIM","Can Collapse", 
                        "9","MOVE_TO_TARGET","UNDER_SWING","ANIM","DAMAGE_ANIM","Can Collapse",
                        "JUMP_BEHIND_TARGET2","12","DASH_ATTACK","VERT_SWINGL", 
                        "ANIM","DAMAGE_ANIM","Can Collapse","JUMP_RESET","15","NEEDLE","15","ANIM","DAMAGE_ANIM", 
                        "Can Collapse","FLEE_RESET",],                         
                       
  "EVICERATE6" =>
                       ["12","JUMP_TO_TARGET","DASH_ATTACK","WEAPON_DAMAGE","DAMAGE_ANIM",
                        "Can Collapse",
                        "10","JUMP_TO_TARGET","STEP_ATTACK","WEAPON_DAMAGE","DAMAGE_ANIM", 
                        "9","MOVE_TO_TARGET","UNDER_SWING","WEAPON_DAMAGE","DAMAGE_ANIM", 
                        "JUMP_BEHIND_TARGET2","12","DASH_ATTACK","VERT_SWINGL", 
                        "WEAPON_DAMAGE","DAMAGE_ANIM",
                        "JUMP_RESET","15","NEEDLE","15","WEAPON_DAMAGE","DAMAGE_ANIM", 
                        "8","TRAMPLE","DASH_ATTACK","WEAPON_DAMAGE","DAMAGE_ANIM", 
                        "Can Collapse","FLEE_RESET",],                     
                       
"EVICERATE7" =>
                       ["12","JUMP_TO_TARGET","DASH_ATTACK","WEAPON_DAMAGE","DAMAGE_ANIM",
                        "Can Collapse",
                        "10","JUMP_TO_TARGET","STEP_ATTACK","WEAPON_DAMAGE","DAMAGE_ANIM", 
                        "9","MOVE_TO_TARGET","UNDER_SWING","WEAPON_DAMAGE","DAMAGE_ANIM", 
                        "JUMP_BEHIND_TARGET2","12","DASH_ATTACK","VERT_SWINGL", 
                        "WEAPON_DAMAGE","DAMAGE_ANIM",
                        "JUMP_RESET","15","NEEDLE","15","WEAPON_DAMAGE","DAMAGE_ANIM", 
                        "8","TRAMPLE","DASH_ATTACK","WEAPON_DAMAGE","DAMAGE_ANIM", 
                        "JUMP_BEHIND_TARGET2","8","OVER_SWING", 
                        "WEAPON_DAMAGE","DAMAGE_ANIM",
                        "Can Collapse","FLEE_RESET",],
  "EVICERATE8" =>
                       ["12","JUMP_TO_TARGET","DASH_ATTACK","WEAPON_DAMAGE","DAMAGE_ANIM",
                        "Can Collapse",
                        "10","JUMP_TO_TARGET","STEP_ATTACK","WEAPON_DAMAGE","DAMAGE_ANIM", 
                        "9","MOVE_TO_TARGET","UNDER_SWING","WEAPON_DAMAGE","DAMAGE_ANIM", 
                        "JUMP_BEHIND_TARGET2","12","DASH_ATTACK","VERT_SWINGL", 
                        "WEAPON_DAMAGE","DAMAGE_ANIM",
                        "JUMP_RESET","15","NEEDLE","15","WEAPON_DAMAGE","DAMAGE_ANIM", 
                        "8","TRAMPLE","DASH_ATTACK","WEAPON_DAMAGE","DAMAGE_ANIM", 
                        "JUMP_BEHIND_TARGET2","8","OVER_SWING", 
                        "WEAPON_DAMAGE","DAMAGE_ANIM",
                        "MOVE_TO_TARGET","JUMP_ATTACK","DULE_ATTACK", 
                        "FPS_NORMAL","WEAPON_DAMAGE","DAMAGE_ANIM","Can Collapse","FLEE_RESET",],
                       [/spoiler]


To call the variable I changed game Interpretter to allow a fix to the way the game processes
Control Variable:[0071:Agility] = [Actor]'s Agility
It was glitched before and the variable remained zero.  I will post the script if you need it.


Other than that it's held together with 8 skills, and a common event, here are screen shots:



Lacerate, this is called from the actors skills and battles and links to this common event:



And the common event forces an action using mithras script to use a skill like this based on agility:



I don't know where I'm going wrong and I've ben ripping my hair out for hours, also believe I posted in the wrong section of the forum ( sorry)  I believe the problem lies in Mithrans script, I think it needs to be editted perhaps... not sure what it is, and Ive come to a dead end.. Please help me if you can.. Thanks for reading..