Jump to content
New account registrations are disabed. This website is now an archive. Read more here.
Bigace360

Scripting Question: displaying enemy conditions

Recommended Posts

Okay so this was the problem that I had written last time, but the site wanted to be a dick and delete everything I wrote by sending me to that error page and not saving anything. I wrote this in notepad just in case that happens again.


Anyways, besides my angry rant, here's the problem I'm having. As the title says I need help displaying the enemies condition for skills. I have the Ability name down, however in order to get the RGSS to output the conditions for said abilities to work, I'm at a lose. This is what I have so far:

class Window_BestiaryStatus < Window_Base
def draw_enemy_abilities(enemy, x, y)
 self.contents.font.color, self.contents.font.size = normal_color, 16
 ([email="0...@enemy.actions.size).each"]0...@enemy.actions.size).each[/email] do |i|
  if @enemy.actions[i].kind == 0
   case @enemy.actions[i].basic
   when 0 then self.contents.draw_text_bordered_2(x, y+(18*i), self.width, 24, 'Attack',0)
   when 1 then self.contents.draw_text_bordered_2(x, y+(18*i), self.width, 24, 'Defend',0)
   when 2 then self.contents.draw_text_bordered_2(x, y+(18*i), self.width, 24, 'Escape',0)
   when 3 then self.contents.draw_text_bordered_2(x, y+(18*i), self.width, 24, 'Do Nothing',0)
   end
  elsif @enemy.actions[i].kind = 1
   ability = $data_skills[@enemy.actions[i].skill_id].name
   self.contents.draw_text_bordered_2(x, y+(18*i), self.width, 24, ability,0)
  end
 end
end
end

Well as you can see this would only output the enemies actions and not the conditions to go with it. All I can find that related to conditions is this stuff from Game_Enemy

:

class Game_Enemy
< Game_Battler
 def make_action
   self.current_action.clear
   return unless self.movable?
   available_actions = []
   rating_max = 0
   for action in self.actions
  n = get_battle_turn
  a = action.condition_turn_a
  b = action.condition_turn_b
  next if (b == 0 and n != a) or (b > 0 and (n < 1 or n < a or n % b != a % b))
  next if self.hp * 100.0 / self.maxhp > action.condition_hp
  next if $game_party.max_level < action.condition_level
  switch_id = action.condition_switch_id
  next if switch_id > 0 and $game_switches[switch_id] == false
  next if action.kind == 1 and not skill_can_use?(action.skill_id) and Enemy_Dont_Skip_Action
  available_actions.push << action
  rating_max = [rating_max, action.rating].max
   end
 end
end

Beyond this point, I have no clue, I'm probably blind and don't see or maybe it requires some skill. Other then that this and the 3 other errors is whats keep from releasing this script. So if anyone can help figure this help that would be great. If you need anymore info I'll try to add what I can.

Share this post


Link to post
Share on other sites

Look RMXP's help for the RPG::Enemy::Action class, it says it all. There are all those condition variables, you just need to retrieve them.

Share this post


Link to post
Share on other sites

Ya thats all of them in that second code, they're located in Game_Enemy. I checked both of them before posting, just in case I missed something.

Share this post


Link to post
Share on other sites

MonsterAlbum03.png

 

Well as you can see in this image from the latest version of my script, all I'm trying to do is output the condition that goes with the action, if there was no condition output nothing. That was all I was asking.

Share this post


Link to post
Share on other sites

First, this:

 

module RPG
 class Troop
class Page
  class Condition
	def initialize
	  @turn_valid = false
	  @enemy_valid = false
	  @actor_valid = false
	  @switch_valid = false
	  @turn_a = 0
	  @turn_b = 0
	  @enemy_index = 0
	  @enemy_hp = 50
	  @actor_id = 1
	  @actor_hp = 50
	  @switch_id = 1
	end
	attr_accessor :turn_valid
	attr_accessor :enemy_valid
	attr_accessor :actor_valid
	attr_accessor :switch_valid
	attr_accessor :turn_a
	attr_accessor :turn_b
	attr_accessor :enemy_index
	attr_accessor :enemy_hp
	attr_accessor :actor_id
	attr_accessor :actor_hp
	attr_accessor :switch_id
  end
end
 end
end

 

 

Now look at "make_action" in Game_Enemy, and "setup_battle_event" in Scene_Battle 1.

Its not actually overly difficult, but very tedious. You need to "translate" all the numerical formulas into plain English. Yes, that sucks.

Edited by ForeverZer0

Share this post


Link to post
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now

  • Recently Browsing   0 members

    No registered users viewing this page.

×
×
  • Create New...