RMRK is retiring.
Registration is disabled. The site will remain online, but eventually become a read-only archive. More information.

RMRK.net has nothing to do with Blockchains, Cryptocurrency or NFTs. We have been around since the early 2000s, but there is a new group using the RMRK name that deals with those things. We have nothing to do with them.
NFTs are a scam, and if somebody is trying to persuade you to buy or invest in crypto/blockchain/NFT content, please turn them down and save your money. See this video for more information.
[RPG Maker VXAce] Enemy Start States

0 Members and 1 Guest are viewing this topic.

**
Rep: +0/-0Level 81
RMRK Junior
i would like a script that allows you to define the starting states of enemies (like if you want an enemy to always be confused then you can add a note tag or add a table in the script that states that the enemy starts off with the confused state already in play

*
Rep:
Level 97
2014 Most Unsung Member2014 Best RPG Maker User - Engine2013 Best RPG Maker User (Scripting)2012 Best Member2012 Best RPG Maker User (Scripting)2012 Favorite Staff Member2012 Most Mature MemberSecret Santa 2012 ParticipantProject of the Month winner for July 20092011 Best Use of Avatar and Signature Space2011 Best RPG Maker User (Scripting)2011 Most Mature Member2011 Favourite Staff Member2011 Best Veteran2010 Most Mature Member2010 Favourite Staff Member
Haven't tried it, but is there any reason you couldn't just go into all the troops with the auto-stated enemies and make a battle event running at Turn 0 to apply the state to the enemies?

Alternately, maybe Yanfly's Passive Skills script would have a feature like that, though I haven't looked into that.

pokeball TDSOffline
***
Rep:
Level 84
-T D S-
Silver - GIAW 11 (Hard)Silver - Game In A Week VII
This should do it.

Code: [Select]
#==============================================================================
# ** Game_Enemy
#------------------------------------------------------------------------------
#  This class handles enemies. It used within the Game_Troop class
# ($game_troop).
#==============================================================================

class Game_Enemy < Game_Battler
  #--------------------------------------------------------------------------
  # * Alias Listing
  #-------------------------------------------------------------------------- 
  alias tds_enemy_starting_states_game_enemy_on_battle_start  on_battle_start
  #--------------------------------------------------------------------------
  # * Processing at Start of Battle
  #--------------------------------------------------------------------------
  def on_battle_start(*args, &block)
    # Run Original Method
    tds_enemy_starting_states_game_enemy_on_battle_start(*args, &block)
    # Match Enemy Notes for Starting States
    enemy.note[/<Starting_States: (.+)>/i]
    # Add Starting States if Match is not nil
    $1.split(/\s+/).each {|id| add_state(id.to_i)} if !$1.nil?
  end
end

Just add this to the enemy note box:

Code: [Select]
<Starting_States: state_id>

state_id is the ID of the state you want the enemy to start with. You can have as many ID's as you can fit, like so:

Code: [Select]
<Starting_States: 2 3 4 5 6 7 8 9 10 11>

Or

Code: [Select]
<Starting_States: 1>

Let me know if that works and if you want anything added/removed.

Have a nice day.
« Last Edit: August 22, 2012, 03:20:02 AM by TDS »

*
Rep:
Level 97
2014 Most Unsung Member2014 Best RPG Maker User - Engine2013 Best RPG Maker User (Scripting)2012 Best Member2012 Best RPG Maker User (Scripting)2012 Favorite Staff Member2012 Most Mature MemberSecret Santa 2012 ParticipantProject of the Month winner for July 20092011 Best Use of Avatar and Signature Space2011 Best RPG Maker User (Scripting)2011 Most Mature Member2011 Favourite Staff Member2011 Best Veteran2010 Most Mature Member2010 Favourite Staff Member
Looks good TDS! :) My only suggestion would be accomodate for more than one space between IDs by changing:
Code: [Select]
$1.split(/\s/)
to
Code: [Select]
$1.split(/\s+/)

It literally makes no difference, as even as it is, the empty spots would just become 0s and when you try to add them as a state they will return false at state_addable?

Additionally, the collect is a bit redundant. It could equivalently be:

Code: [Select]
$1.split(/\s+/).each {|id| add_state(id.to_i)} if !$1.nil?

Anyway, neither of those comments are meaningful problems; it's a very smooth and efficient script.

pokeball TDSOffline
***
Rep:
Level 84
-T D S-
Silver - GIAW 11 (Hard)Silver - Game In A Week VII
Thanks, I always appreciate the advice. As for the collect, now that I see it I can't understand why I was using it in the first place, I must really be off my game.

**
Rep: +0/-0Level 81
RMRK Junior
thank you and will try it out when i get home

**
Rep: +0/-0Level 81
RMRK Junior
that works really well thank you