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.

[XP] Debugging Trickster's AI Ally?

Hey. I asked around elsewhere and located Trickster's AI Ally 2.0 in the Lost Scripts thread. Problem is, in my RPG, it crashes as soon as my dudes start doing stuff inside the battle.

I get the error,

cpga22ks3.jpg

The code in question seems to be this,

Code:
# * Magic Influences 
      #-------------------------------------------------------------------------- 
      def magic_influences 
        # Initialize Counter 
        number = 0 
        # Initialize sp Array 
        sp = [] 
        # Run Through Each Skill 
        @actor.skills.each {|skill_id| sp << $data_skills[skill_id].sp_cost} 
        # If at least one member is in critical condition 
        if $game_party.critical? 
          # If knows at least one healing skill that can be used 
          @actor.skills.each do |skill_id| 
            # If skill is healing and can use the skill 
            if $data_skills[skill_id].is_healing? && @actor.skill_can_use?(skill_id) 
              # Heavy influence for magic 
              @action_magic = 20 
              # Break 
              break 
            end 
          end 
        end 
        # If Sp is less than the minimum then fail 
        @action_magic = 0 if @actor.sp < sp.min 
      end

I know nothing about scripting but I theorize that it's failing because for some reason actor.sp is exploding. Hopefully someone around here will be able to suggest what's going on. I can post the entire Game_AllyAi, or the demo RPG, if needed.

I'm not using any other custom script systems of any kind. So, I'm using the default battle system and all. To install it, since there was no installation instructions, I just copied and pasted it + the SDK exactly as arranged in the demo RPG into my own RPG.

/Edit

Okay, I managed to fix the first error. It seems that if your dudes don't have skills then the Ai Ally implodes.

Now I've got a new error! Horray! And it also occurs just when the fight starts and dudes start doing stuff. Delightful.

jan042009115709pmrv0.jpg

Code:
  #--------------------------------------------------------------------------
  # * Make Item Choice
  #--------------------------------------------------------------------------
  def make_item_choice
    # Get Item Id
    item_id = @useable[rand(@useable.size)]
    # Set Random Item
    @actor.current_action.item_id = item_id
    # If not Targets All
    if not $data_items[item_id].targets_all?
      # Make Target Choice
      make_item_target_choice
    end
  end

I suspect this is exploding because I don't have any offensive attack items. (Nor do I really want to have them at this point in the RPG... especially a huge amount to prevent the AI from crashing...).

I'm gonna try setting their item usage to 0.

/edit

That didn't work. Still exploding.

Okay I seriously can't get it to stop crashing. I hope someone here is a bit fluent with this.
 
Okay, how do I use that debug thing? Sorry I'm not very fluent with this heh.

It says this in Setup,

#=============================================================================
# â–  Ally AI and AutoBattling
#=============================================================================
# Trickster
# Version 2.0
# 11.24.06


Anyways, I did some pretty extensive testing in his demo module and it is for sure that error coming from the fact that my dude's inventory isn't loaded with items. If I remove the items in the demo, it starts exploding the same way. I wouldn't mind just disabling item usage altogether for the AI party members to fix it but I'm not sure how to do that.
 
That throws me this

adasdasdvr9.jpg


/edit

I tried throwing in the newest SDK but it still gave the same error, just a slightly different line #.

/edit 2

Did some more screwing in the Ai Ally demo. I ended up updating the SDK and MACL. I deleted the gradiant bar stuff and some of those things to make sure they weren't conflicting as they didn't seem critical to the AI. I re-followed your instructions and placed that set of code in front of the offending line,

if not $data_items[item_id].targets_all?

I then removed all items and gave every guy Heal so the lack of skills wouldn't crash it.

I got another crash at one point but I was hammering buttons so I didn't get to see it. It was the same error as the current crash but a different line, like 228 or something.

Now for the most part they don't do *anything*, they don't attack, but they'll heal each other if they get damaged. I don't know if this is progress or if I just broke everything even more, but I'm starting to lose hope for getting this to work at all.
 
lol, all commented sections. I don't know if that was the line, it went by really fast.

Do you have any idea what's going on? Have you tried taking the demo module and removing the cpu player's skills and the items the event gives you?
 

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