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.
Weapon Shop Display (Weapon 1 instead of Weapon 2)

0 Members and 1 Guest are viewing this topic.

pokeball CDAOfflineFemale
**
Rep:
Level 63
Newby
This seems like something that has probably been answered before.
But searching here and on google comes up with a whole bunch of shop related things that I already know.  ::)

Anyway, in my game I've got characters using the two sword style and their second weapon is actually important and cannot be un-equipped.

But when I go to buy a weapon from a shop, it displays how much better the weapon is than my weapon in the weapon 2 slot, that doesn't work for my game.

I was told that the engine does not differentiate between Weapon 1 or 2 and that the only way I could get it to show Weapon 1 and only Weapon 1 was through a script.

Thanks for reading and I hope you can help.

*
Rep:
Level 97
2014 Most Unsung Member2014 Best RPG Maker User - Engine2013 Best RPG Maker User (Scripting)2012 Most Mature Member2012 Favorite Staff Member2012 Best RPG Maker User (Scripting)2012 Best 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
What maker is this for? VX or VXA?

pokeball CDAOfflineFemale
**
Rep:
Level 63
Newby
VX, so RGSS2.

Thanks.

*
Rep:
Level 97
2014 Most Unsung Member2014 Best RPG Maker User - Engine2013 Best RPG Maker User (Scripting)2012 Most Mature Member2012 Favorite Staff Member2012 Best RPG Maker User (Scripting)2012 Best 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
Try pasting the following code into its own slot, below Materials but above Main.

Code: [Select]
class Window_ShopStatus
  def weaker_weapon(actor)
    return actor.weapons[0]
  end
end

Mind you, that would always return weapon 1 for all actors, even if you had another dual wielding actor where you want the shop to actually show the weaker weapon. If you wanted it so that the restriction only applied to a particular actor, you could do something like this:

Code: [Select]
class Window_ShopStatus
  alias cdarulez_weakwep_3ed7 weaker_weapon
  def weaker_weapon(actor, *args, &block)
    if actor.id == 1
      return actor.weapons[0]
    else
      cdarulez_weakwep_3ed7(actor, *args, &block)
    end
  end
end

And you would change the

Code: [Select]
if actor.id == 1

line to the ID of the actor with the unreplacable second weapon, so if that was actor 1, the above would be fine, but if it was actor 5, then the line would need to be:

Code: [Select]
if actor.id == 5
« Last Edit: February 01, 2012, 09:12:19 PM by modern algebra »

pokeball CDAOfflineFemale
**
Rep:
Level 63
Newby
Beautiful, works perfectly.

Thanks MA.  :lol:

*
Rep:
Level 82
Since there's a hint that there might be more than 1 character with this particular requirement, and to save having to make if/elsifs for each actor, i figured it might be worth having a quicker way of handling that:

Code: [Select]
class Window_ShopStatus
  alias cdarulez_weakwep_3ed7 weaker_weapon
  def weaker_weapon(actor, *args, &block)
    if [1, 5].include?(actor.id)
      return actor.weapons[0]
    else
      cdarulez_weakwep_3ed7(actor, *args, &block)
    end
  end
end

Then it's just a matter of putting in the desired actor id's in the array (between the square brackets) in this line:

Code: [Select]
if [1, 5].include?(actor.id)

So here we have actors 1 and 5 set to have their 2nd weapon not being used as wanted. If you wanted actors 2 and 4 instead, you would change [1, 5] to [2, 4]. If you wanted to have actors 2, 4 and 7 it would be [2, 4, 7], and so on.

Of course, if there is only 1 actor using this unchangeable 2nd weapon, then you'd only need modern's version. This just lets you use as many actors as you want without having to do the extra repeating leg work.
(Why do I always feel like it's the end of the world and I'm the last man standing?)

pokeball CDAOfflineFemale
**
Rep:
Level 63
Newby
Thanks Logan :) But MA script on it's own covers my needs.

But thanks anyway ;)