• 0
Syltti

Targeting an empty Actor slot in battle.

Question

Hello, everyone~ Another day, another thread~ xD Today, I, after some searching the net, managed to allow my Necromancer, Ryana, to summon a zombie (another Actor) in battle. And, thanks to a post by Shaz, managed to get that zombie to be removed after battle without having to copy&pasta the life out of my Troops events. Here's the main problem:
I want to make it so that, when I'm selecting Ryana's summon skill, only an empty Actor slot can be selected. Reason for this is that it doesn't make sense for a summon to be used on an actor, then another actor appears. Doing this all causes an unsightly "Failed" to appear, THEN my zombie appears.
 
Any help is appreciated~
 
Thanks~
 
Original thread with Shaz's post: http://forums.rpgmakerweb.com/index.php?/topic/12224-is-there-a-way-to-remove-a-character-from-party-at-end-of-battle/
 
*Note


Shaz says, "You could modify the Scene_Battle 1 script, battle_end method. Somewhere prior to removing the battle states, do a $game_party.remove_actor(id)." Where you actually go is Game_Battlers and look for:
  #--------------------------------------------------------------------------  # * Processing at End of Battle  #--------------------------------------------------------------------------  def on_battle_end    @result.clear    remove_battle_states    remove_all_buffs    clear_actions    clear_tp unless preserve_tp?    appear  end

If your summon is an Actor like mine, put $game_party.remove_actor(id) above "remove_battle_states" like this:

  #--------------------------------------------------------------------------  # * Processing at End of Battle  #--------------------------------------------------------------------------  def on_battle_end    @result.clear    $game_party.remove_actor(id)    remove_battle_states    remove_all_buffs    clear_actions    clear_tp unless preserve_tp?    appear  end

 

*Bonus

I finally figured out how to turn off switches after battle! (I'm a n00b, k?) This can be done in Game_Battler as well:

  #--------------------------------------------------------------------------  # * Processing at End of Battle  #--------------------------------------------------------------------------  def on_battle_end    @result.clear    $game_party.remove_actor(id)   #If you have a summoned actor    remove_battle_states    remove_all_buffs    clear_actions    clear_tp unless preserve_tp?    appear  end

What you want to do is add $game_switches, like this:

  #--------------------------------------------------------------------------  # * Processing at End of Battle  #--------------------------------------------------------------------------  def on_battle_end    @result.clear    $game_party.remove_actor(id)    $game_switches[switch_id] = false  #ex. $game_switches[9] = false    remove_battle_states    remove_all_buffs    clear_actions    clear_tp unless preserve_tp?    appear  end

Hope this helps~

 

[Edit] If I can add one more thing, how can I make a skill unusable in cases like this? Like, I summon my zombie, and so long as it's alive/on the field, I can't use that summoning skill again.

Edited by Estellise Roekes

Share this post


Link to post
Share on other sites

22 answers to this question

  • 0

Why not set the scope to "none"? With my limited testing, this doesn't produce a "failed" message and still runs the common event (which I assume is what you're using to add the party member).

If you're worried about only being able to select the skill when there's room in your party, then you'd probably need something that adds custom conditions for skill use.

Share this post


Link to post
Share on other sites
  • 0

I initially had it set to None, but then no animation is played. While I could do without, I'd like to have an animation for the summoning, preferably in a place where this is no current battler. I'm just being petty. xD

Share this post


Link to post
Share on other sites
  • 0

Fair enough. The ability to select an empty slot is definitely going to require scripting since by default the "item max" for the actor selection window is only the size of the current party.

[Edit] As for your edit, you could add an invisible state to the caster that seals the summon skill in the common event of the skill. You could then remove the state when you un-summon or when the summon dies. As for how to tell when the summon is dead, you could have a battle event with the condition of Actor [summon]'s HP is 0% or below, but you'd need this in every troop.

Edited by Racheal

Share this post


Link to post
Share on other sites
  • 0

Is there really no other way to signify that my summon is dead without pasting in every troop?

Share this post


Link to post
Share on other sites
  • 0

If you check out this thread, I have a way to dismiss the summoned actor after the battle in a common event running in parallel, in case you want to integrate other commands alongside the summoned actor being dismissed.

 

To dismiss the summoned actor mid-battle when he/she dies, add this scriptlet after Materials:

class Scene_Battle < Scene_Base  #--------------------------------------------------------------------------  # * Processing at End of Action  #--------------------------------------------------------------------------  def process_action_end    @subject.on_action_end    refresh_status    @log_window.display_auto_affected_status(@subject)    @log_window.wait_and_clear    @log_window.display_current_state(@subject)    @log_window.wait_and_clear        ##### Is summoned actor dead? #####    $game_party.members.each do |member|      if member.id == 2 && member.dead? # replace 2 with zombie actor id        $game_party.remove_actor(member.id)      end    end    ###################################        BattleManager.judge_win_loss  endend

I don't really like doing it this way, but since parallel processes don't run during battles, this is the easiest way I've found. I'll keep looking, though!

 

[EDIT] So after some trial and error, here's a scriptlet that allows you to disable the skill while it's active. Just add this into a script call in the common event called by the summon skill (or wherever you end up adding the actor):

summoner = $data_actors[1]f = RPG::BaseItem::Feature.new(44, 130, 1)summoner.features.push(f)

Breakdown:

$data_actors[1] - replace the 1 with the id of your summoner.

f = RPG::BaseItem::Feature.new(44, 130, 1) - 44 is the code for sealing skills, replace 130 with the id of your summon skill, the 1 is just for setting disabled to true.

summoner.features.push(f) - add the new feature (disable skill 130 in this case) to your summoner!

 

To re-enable the skill when the summoned actor dies, add these lines to wherever you dismiss the actor:

summoner = $data_actors[1]ft = summoner.features.pop

If you plan on having multiple summons, I can come up with a better way of handling this - this approach only really allows for 1 summon to be active at a time.

Note that if you want to summon the same actor more than once per battle, you'll need to initialize the actor when summoned (there's a checkbox when adding the actor in an event, not sure about through the script).

 

Hope that helps :P.

 

Cheers,

Duncan

Edited by DuncanS

Share this post


Link to post
Share on other sites
  • 0

Oh, that would work nicely. If I have more than one zombie on the field, I assume I can add additional ifs to this? Sorry, the answer to this is painfully obvious. xD

 

[Edit]While this is exactly what I could use to not have to copy and paste throughout my troops (which I already did), I already have it set so that when my zombie dies, the summoner is put in a state where the summon skill is sealed, and that's only unsealed when the zombie dies. I actually tried putting that into the script as $game_actor(2).remove_state(34). Not sure if I did that right. xD I also get an error when trying to load the game with it in.

Edited by Estellise Roekes

Share this post


Link to post
Share on other sites
  • 0

Ah ok, that's actually a much easier way of handling it than what I did! XD

 

The line should be $data_actors[2].remove_state(34) to accomplish what you're aiming for, I think.

Share this post


Link to post
Share on other sites
  • 0

WOOOOO~ Finally got it after multitudes of errors! /o/ It was $game_actors[2].remove_state(34).

 

But why do you say going through the troops would be easier? (Aside from scripting headaches. xD)

Share this post


Link to post
Share on other sites
  • 0

Oh, I was referring to my edit for disabling the skill :P. Doing it in a state is definitely easier!

Share this post


Link to post
Share on other sites
  • 0

Oh, I see. Yeah, I current have my summon skills common event set up like this:

post-19904-0-91884600-1380079027_thumb.p

The switch is for a forced action in battle where my zombie resurrects the summon should the summoner die. But, as you can see, I got a state set up to seal Hina's summoning skill (Hina being the zombie). I did what was previously suggested and had that state removed (from Ryana) when Hina died in battle (Hina's switch turns off at that point too). What I wanted to avoid was having to go through all the troops and paste an event to have Hina removed from the party upon her death and the State on Ryana be lifted.

 

With the mini-script you posted, Hina's removal and her summoning skill being unsealed are both taken care of immediately, which is exactly what I wanted. I'ma test that part to see if adding another if let's me work this out for a second zombie as well. If all goes well, that's one problem taken care of~ I'll then have to go back to my original problem.

Share this post


Link to post
Share on other sites
  • 0

To your original question, you can have a conditional in your common event for summoning:

Conditional Branch: Script: $game_party.battle_members.size < $game_party.max_battle_members

If the party is already full, you can have some other calls in the else statement, or just have it fizzle.

Share this post


Link to post
Share on other sites
  • 0

Hm. If I did that right, it should look this:

post-19904-0-31206900-1380081110_thumb.p

right? If so, nothing changed; I can still only selected my own actors

Share this post


Link to post
Share on other sites
  • 0

Ahh ok, sorry! I misunderstood your original question :S. If I understand correctly, the issue is the Failed message popping up when you target a party member with the skill?

If so, you can set the scope to The User, and put the following into the damage formula: 

a.result.used = false; 0

If that isn't what you want, let me know :P.

Share this post


Link to post
Share on other sites
  • 0

That would've come in handy for something else I was doing a few days ago. xD No, the original problem was that I wanted to select an empty actor slot for the summons. Basically, the skill's Scope is "One Ally", and I wanted to select (or only be able to select) and empty actor slot as the target, with that slot being where my zombies will be assigned. So your script call solution was in the right direction. xD It's just that, even with that conditional branch, nothing changed.

 

I've run into another problem too. It's just one thing after another. xD

Share this post


Link to post
Share on other sites
  • 0

Haha yeah, that's always the way it goes ><". I see what you're saying, but I guess Xypher's rather blunt observation is kinda true here - you can't really target an empty slot (not easily anyway, as far as I know). The conditional call is to check that an empty slot still exists, so you can perform calls based on the result.

 

Is there a reason you need to target the individual slots specifically? If so, I can look into selecting a specific empty slot, but I don't really know where to start xP.

Edited by DuncanS

Share this post


Link to post
Share on other sites
  • 0

Well, it's basically because I want an animation to be played when I summon. As I said somewhere near the top of this thread, I can just set the scope to None, but if there's a means of getting this to work, I'd like to get at it. If that proves to be too difficult, I can just do without.

Share this post


Link to post
Share on other sites
  • 0

Another alternative might be to set the scope to none and play the animation where you want it via a script in the common event. I'm going to look into how feasible this is now. Either that, or have an animation that targets the "entire screen" but is actually centered on an actor spot.

Share this post


Link to post
Share on other sites
  • 0

Oh, that's where this line comes in:

a.result.used = false; 0

If you have this, the animation will display (without the Failed message). Setting the scope to User with that in the Formula (set Type to HP Damage, it will deal 0 but won't register anyway) means that you don't need to select a slot at all. The only issue then is that the skill can fizzle if the party is full, but you can handle that scenario in the else condition of the conditional.

 

If your worry is about where the animation is being played, Rachael is right that you can call the animation in the common event you use to summon.

Share this post


Link to post
Share on other sites
  • 0

Played around a bit with getting an animation to play. I did my tests in the Symphony demo assuming that's what you're using since you tagged the thread with it.

First off, because the script calls are long and hard to work with in the limited space the engine gives you, I made a little scriptlet to simplify the call:

class Game_Interpreter  def start_actor_ani(actor_index, animation_id)    #set x    x = SYMPHONY::View::ACTORS_POSITION[actor_index][0]    SceneManager.scene.spriteset.actor_sprites[actor_index].x = x    #set y    y = SYMPHONY::View::ACTORS_POSITION[actor_index][1]    SceneManager.scene.spriteset.actor_sprites[actor_index].y = y    #start snimation    a = $data_animations[animation_id]    SceneManager.scene.spriteset.actor_sprites[actor_index].start_animation(a)  endend
Then your common event you'll just want a script call of the following:

i = $game_party.battle_members.sizeif i < $game_party.max_battle_members  start_actor_ani(i, 38)end
Changing the 38 to whichever animation you want. This should go before the add actor command. You'll also want to add a wait command of however long the animation is after it.

Share this post


Link to post
Share on other sites
  • 0

Sorry guys, forced myself to go to sleep after an incredible derp moment 8 hours ago.

 

I'll give that a shot, Racheal~

That worked! I had to set the scope to None, otherwise the animation played on the summoner, then the zombie's spawn location. But, it played an animation before the zombie's appearance~ I really appreciate all the help Duncan and Rachael~

Share this post


Link to post
Share on other sites
  • 0
This thread is being closed, due to being solved. If for some reason you would like this thread re-opened, please report this post and leave a message why. Thank you.

Share this post


Link to post
Share on other sites
Guest
This topic is now closed to further replies.

  • Recently Browsing   0 members

    No registered users viewing this page.