Jump to content
Lavar

Help making Yanfly Command Equip work for only one slot

Recommended Posts

It's not possible with a modification of this script.  All this script does is allow you to enter the Equip Scene during the Battle Scene, by calling the Equip Scene and setting up rules for going back to the Battle Scene.  AFAIK, you can't pass any restrictions or modifications into the Equip Scene through the scene call (someone who knows more may correct me on this).

Edited by ekomega

Share this post


Link to post
Share on other sites

@eko: actually.... yanfly limit the equip scene to the actor that call it only. by disabling pageup and pagedown handle when called from battle. (also he set up menu actor beforehand so it will become the actor that call the command equip.

 

@lavar: Did you want the command equip only shown to certain actor (means only eric and natalie can change equipment). or only shown to one/more slot battle (means whoever in slot 1 and 2 in party can change equip. other slot can't). if above version it's easy. use this:

 

 


class RPG::BaseItem
  def battle_equip?
    return false if !@note[/<battle_equip>/i]
    return true if @note[/<battle_equip>/i]
  end
end

 

class Game_Actor < Game_Battler
  def battle_equip?
    return false if check_battle_equip
    return true
  end
  def check_battle_equip
    return true if actor.battle_equip?
    return true if $data_classes[@class_id].battle_equip?
    return true if $imported["YEA-ClassSystem"] &&
                   $data_classes[@subclass_id] &&
                   $data_classes[@subclass_id].battle_equip?
    equips.each do |equip|
      next if !equip
      return true if equip.battle_equip?
    end    
    states.each do |state|
      return true if state.battle_equip?
    end
    return false
  end
end

 

class Window_ActorCommand < Window_Command
  def add_equip_command
    text = YEA::COMMAND_EQUIP::COMMAND_TEXT
    add_command(text, :equip, @actor.battle_equippable?) if @actor.battle_equip?
  end
end # Window_ActorCommand

 

 

 

give notetags to actor

<battle_equip>

to make it able change equip in battle. actually it also work notetagging class, subclass (if using yanfly class script), equipment (this might have some problem. since equipment can be changed/removed), states (same with equipment).

so you could make stripper class which can change her armor in front of enemy :D.

Edited by estriole

Share this post


Link to post
Share on other sites

@Estriole I need only one slot to be changable.

In my game, there are orbs instead of shields, which lets you use different magic, and I want players to be able to change that in battle, but ONLY that.

Share this post


Link to post
Share on other sites

It's not possible with a modification of this script.  All this script does is allow you to enter the Equip Scene during the Battle Scene, by calling the Equip Scene and setting up rules for going back to the Battle Scene.  AFAIK, you can't pass any restrictions or modifications into the Equip Scene through the scene call (someone who knows more may correct me on this).

You can always hardcode the restriction.

Once the `on_item_ok` method is called (meaning, you changed equips), just go back to the battle.

Share this post


Link to post
Share on other sites

I dunno if this works at 100% but, theoretically, it should.

 

Make one Common Event that always occurs when you start a battle, when that event occurs, it will change every char to a different class. That new class only can equip orbs. Done.

Battle ends, change to previous class.

 

The only problem that I can see that can give you problems is the gear equipped pre-battle, you probably will have to tweak the common event to give temporarily the same buffs as the gear equipped and take them later when the battle ends and re-equip everything automatically[Change Equipment at Event Commands with the Conditional Branch and variables! Yes, it asks you a ton of work to see it working if you don't want to follow the previous advice given lol].

Edited by Triper

Share this post


Link to post
Share on other sites

try this:

 

class Window_ActorCommand < Window_Command
  def add_equip_command
    can_change_equip_slot = 1
    text = YEA::COMMAND_EQUIP::COMMAND_TEXT
    add_command(text, :equip, @actor.battle_equippable?) if $game_party.battle_members.index(@actor) == can_change_equip_slot
  end
end # Window_ActorCommand

if you set different slot. change the can_change_equip_slot

 

edit: sorry. didn't read it properly... i think i misunderstood the 'slot' you mean. you mean equip slot. i think party slot. :D.

you could try giving states that seal other type equipment when using command equip.

 

wait a minute i will search where to put that.

 

 

class Scene_Battle < Scene_Base
  alias state_add_before_command_equip command_equip
  def command_equip
    $game_party.battle_members[@status_window.index].add_state(99)
    state_add_before_command_equip
    $game_party.battle_members[@status_window.index].remove_state(99)
  end
end # Scene_Battle

change the 99 to state you set in database. make the state seal other type of equipment EXCEPT the one you're allowed to change.

 

hope this help. sorry for my misunderstanding :D.

Edited by estriole
  • Like 1

Share this post


Link to post
Share on other sites

you could try giving states that seal other type equipment when using command equip.

The request is to only allow you to change one equip (as opposed to changing multiple equip) at a time.

Can you explain how to achieve this using your solution?

Edited by Tsukihime

Share this post


Link to post
Share on other sites

Ok thank you.

 

try this:

 

class Window_ActorCommand < Window_Command
  def add_equip_command
    can_change_equip_slot = 1
    text = YEA::COMMAND_EQUIP::COMMAND_TEXT
    add_command(text, :equip, @actor.battle_equippable?) if $game_party.battle_members.index(@actor) == can_change_equip_slot
  end
end # Window_ActorCommand

if you set different slot. change the can_change_equip_slot

 

edit: sorry. didn't read it properly... i think i misunderstood the 'slot' you mean. you mean equip slot. i think party slot. :D.

you could try giving states that seal other type equipment when using command equip.

 

wait a minute i will search where to put that.

 

 

class Scene_Battle < Scene_Base
  alias state_add_before_command_equip command_equip
  def command_equip
    $game_party.battle_members[@status_window.index].add_state(99)
    state_add_before_command_equip
    $game_party.battle_members[@status_window.index].remove_state(99)
  end
end # Scene_Battle

change the 99 to state you set in database. make the state seal other type of equipment EXCEPT the one you're allowed to change.

 

hope this help. sorry for my misunderstanding :D.

In the second code, I get an error at line 192: NameError occured. Undefined method 'command_equip' for class 'Scene_Battle'. When I delete the command_equip at the end of the line, it fixes that, but then it says Error at line 193: SyntaxError occured. Unexpected tIDENTIFIER, expecting keyword_end def command equip. Any fix?

Share this post


Link to post
Share on other sites

strange. it should work. make sure you put my code BELOW yanfly command equip script. if you put it above. def command_equip still not made yet. so it's not possible to alias it.

 

if it didn't work... then nevermind using the script. i think you'll be fine by giving states to actor every start of turn. from troop event command.

made the span turn. then make it 0+1*x turn. add state to all party member. also i don't think you need to make the state permanent since dead actor didn't have command selection. and when the actor revived. it will start of another turn and the state will be added.

 

@hime: using state

example. you have this equip slot

Weapon

Shield

Armor

Accessory

 

you just want shield able to change. other equipment don't. just make the state that seal weapon,  armor, accessory.

but DON'T seal the shield. so when using command equip. other equipment slot cannot be changed.

of course if you use yanfly equip engine and extend the equip slot. i think we need your effect manager to seal the 'other' type equipment. since it cannot be chosen from event command.

 

but the OP said he change shield to orb. so i guess my suggestion should work :D.

Share this post


Link to post
Share on other sites

When you change your equip just return to the battle scene and disable the equip command for that turn.

Share this post


Link to post
Share on other sites

oh my god. I feel so stupid. I put the second code IN the command equip script. But it worked. The thread may be locked now.

Share this post


Link to post
Share on other sites

also i think yanfly have cooldown feature. so after changing equip you cannot immediately change it again.

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.

×
Top ArrowTop Arrow Highlighted