First I want to make a spoiler for this, because it's rather long
Spoiler
This is not good :Look at the original method below:
I don't really know what you want, but that is not a healthy alias, because the original method will always executed before your code, I mean it may produce something that you didn't want, (err.. How can I explain this?)
Instead, you should do it like this :
But to give return in your code, we(you) should know what should happen, I mean if this condition is true, do we need to call the original method or not? If yes, then we don't need to give the return. But that's not only it, take a look again at the original method of item_apply
It also got so some conditional checks and this is the most important :
As you can see, things can become complicated, if by any chance your code also involving execute an action or else, the actor may do two actions in a row and we don't want that to be happened unless that is your purpose, that's why we put return in your additional code. But if we put return in the last line of your additional code, you also need to write a code for the actor to do an execute action or something like that, so he/she didn't end without doing nothing.
But all of that is you who know what happen actually(how can we know right? 🙂 ) In fact, I got confused ? So ignore this post if this is all a wrong suggestion, and I'm sorry about that.. 🙂
alias :heartfire_rmw :item_apply #-------------------------------------------------------------------------- # * Apply Effect of Skill/Item #-------------------------------------------------------------------------- def item_apply(user, item) heartfire_rmw(user, item) <= This can be dangerous! if user.actor? and item.is_a?(RPG::Skill) and RMW:
😛airs.has_key?(item.id) and RMW:
😛airs[item.id].include?(user.id) puts "More Activation Process Here" end endend
Code:
#-------------------------------------------------------------------------- # * Apply Effect of Skill/Item #-------------------------------------------------------------------------- def item_apply(user, item) @result.clear @result.used = item_test(user, item) @result.missed = (@result.used && rand >= item_hit(user, item)) @result.evaded = ([email protected] && rand < item_eva(user, item)) if @result.hit? # What happen if this is true? unless item.damage.none? @result.critical = (rand < item_cri(user, item)) make_damage_value(user, item) execute_damage(user) end item.effects.each {|effect| item_effect_apply(user, item, effect) } item_user_effect(user, item) end end
Code:
alias :heartfire_rmw :item_apply #-------------------------------------------------------------------------- # * Apply Effect of Skill/Item #-------------------------------------------------------------------------- def item_apply(user, item) if user.actor? and item.is_a?(RPG::Skill) and RMW::Pairs.has_key?(item.id) and RMW::Pairs[item.id].include?(user.id) puts "More Activation Process Here" return <= this ensure that if the code here is done, we don't need to do the original method end heartfire_rmw(user, item) <= This can be dangerous! endend
Code:
if @result.hit? # What happen if this is true? unless item.damage.none? @result.critical = (rand < item_cri(user, item)) make_damage_value(user, item) execute_damage(user) <= this thing end item.effects.each {|effect| item_effect_apply(user, item, effect) } item_user_effect(user, item)
Okay now this :
it should be greyed out and this :
whether a list of skill can be enabled regardless of their nature requirements through the script?
Is a two different thing. To simply greying out an item/skill in window,
As I said in that thread, Window_ItemList has the enable? method. This is what determines if it's selectable or greyed out.
That was Shaz telling at you, and yes
enable? method in Window_ItemList is the actual code to determine if the item is greyed out or not, it got nothing to do with if the item is ACTUALLY CAN be used or not, it just simply makes you cannot access it. If you want an example, just overwrite this :
#-------------------------------------------------------------------------- # * Display in Enabled State? #-------------------------------------------------------------------------- def enable?(item) # $game_party.usable?(item) <= comment it for now true # <= put true here endNow even logically the item cannot be used, it will not greyed out and if you try to press 'confirm' it won't play buzzer, though the functionality of that item is vague and usually things will get uncontrollable/messy(what is the word), That's why
items_conditions_met? method is needed, and $game_party.usable?(item) actualy calling this method
def usable?(item) return skill_conditions_met?(item) if item.is_a?(RPG::Skill) # <= this for skills return item_conditions_met?(item) if item.is_a?(RPG::Item) # <= this for items return false endYou can ignore this, it just a little explanation about
enable? method
Spoiler
Now thing that you should know again, is
enable? method in Window_ItemList and Window_SkillList is not same, but it's similar. Take a look at the enable? method code they has, the different is, if for item basically it will check if there's an actor or not in the party, then it will check wether the item is usable or not, but for skill, it not just checking wether there's an actor or not in the party, it will check if CERTAIN actor is exist or not, if we talk about certain I mean he/she that has the skill, right after that it will check wether the skill is usable or not(involving MP needed and etc).
Let's get to the point..
What you want is greying out the skill in Window_SkillList if certain actor is not exist in battle(or possibly dead?)
Is this some kind like
Party Skill/or Combination Skill, so if actor
X is not exist or dead, then actor
Y can't cast the skill?
Okay the fact is I don't really know what you want(I'm sorry
🙁 ), But I think the logic is quite simple, just greying out that skill if the actors that is needed were not exist, or dead, because if that skill is greyed out, the player would cannot access that skill regardless anything, so you don't need to worry about the natural requirement condition met or anything like that..
It probably will something like this(If I'm not wrong, because I don't test this)
alias milena_enable? enable?def enable?(item) if item.id == # your skill id(party combination skill id) return false if $game_party.battle_members[1].state?(death_state_id) # just who is in the index 1 milena_enable?(item) # check the natural requirement condition of that skill(you know, the skills_condition_met? method) else return milena_enable?(item) # return original method if the skill is not your err.. Party Combination skill endend Even after $game_party.battle_members[1].state?(death_state_id) is not true, means the skill is not greyed out, we still need to check the nature requirement of that skill, hence call the original method
milena_enable?(item), we don't want the skill is executed even the actor MP is Zero(the player will yell Hey Bro, I Found A Bug oh yeah great, and blah blah.. ).
That code above is just an overview about this matter, you may(actually must) tweak it into your liking. Big sorry if all I had post in here is something a wrong..
Hope this can help you a bit. )