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.

issue with skill_can_use?

ok so im working on this AI system, which is working great!!! all except it lets my healers use moves they dont know :( here is the code giving me issues:
[rgss]#@values is the power of a skill(all neg because i filtered out the healing skills beforehand)
#@skill is the skill ^^^^
#@choice starts at 0
    for i in 1...$data_skills.size
      if @values != nil #just to be safe, tho it shouldn't occur
        if @values < @choice && self.skill_can_use?(@skill.id)
          p(i.to_s+","+self.skill_can_use?(i).to_s+","+self.id.to_s)
          @choice = @values
          @skill_choice = @skill.id
        end  
      end  
    end
[/rgss]
my print give me:
1,true,1 <---right
2,true,1 <---wrong
everything is default (1 is heal, 2 is greater heal)
as you can see below enemy 1 does not know greater heal
14dojsg.jpg

any idea why @skill_choice keeps ending up as 2 when self.skill_can_use? should prevent it
 

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