CharcoalKidd

Villager
Member
Joined
Mar 3, 2015
Messages
27
Reaction score
10
First Language
English
Primarily Uses
I'm writing a script, but I can't figure out how to gray out a skill. I'm trying to gray out any skill that has a TP cost higher than another variable I've previously determined. I've trying friggin' around with "enable?(skill)" under Window_SkillList, but that hasn't yielded anything. Suggestions?
 
Last edited by a moderator:

Shaz

Global Moderators
Global Mod
Joined
Mar 2, 2012
Messages
42,447
Reaction score
14,813
First Language
English
Primarily Uses
RMMV
I've moved this thread to RGSSx Script Support. Please be sure to post your threads in the correct forum next time. Thank you.


Show us your script. If we can't see how you've written it, how can we tell you how to change it?


I do think enable?(skill) is the place you need to make your change, so if it's not working, chances are you've done something wrong in there.
 

CharcoalKidd

Villager
Member
Joined
Mar 3, 2015
Messages
27
Reaction score
10
First Language
English
Primarily Uses
I was more wondering about if there were general good solutions to that kind of function, but okay, point taken. The rest of my script is messy and uses game variables and stuff, because I'm groping my way through scripting blindly. But the idea is that I gave the player a lot of extra action times, and I want the game to deplete TP as they select skills, and then not use TP when the skills are activated, so their choices in the moment will be more apparent. Otherwise they can select skills until they run out of action times, and then they only activate as far as the TP stretches. So I made $game_variable[7] equal to the Actor's TP at the beginning of the turn, and it subtracts the TP cost of the skill from that variable when the player selects it. I had something like this to gray out the skills that have a cost higher than the dummy TP variable;

 
class Window_SkillList < Window_Selectable
 
  def enable?(item)
    @actor && @actor.usable?(item) && $game_variables[7] > @actor.skill_tp_cost(skill)
  end
end

But nothing changed from the former problematic situation. I haven't touched the Window_SkillList script for anything else. 
 

Shaz

Global Moderators
Global Mod
Joined
Mar 2, 2012
Messages
42,447
Reaction score
14,813
First Language
English
Primarily Uses
RMMV
It's no different because @actor.usable? already does a test to see if the actor has enough TP to use the skill. So if $game_variables[7] is equal to or greater than the skill TP cost in the database, you will not see a difference. At a quick look, I think you would only see a difference if $game_variables[7] is lower than the TP cost AND lower than the actor's TP.


Have you taken into account the fact that the player could "undo" a move? They can select a skill, you can remove the TP, and when they move onto the next actor, they could ESC to go back and select another skill for the previous actor. If they do that, do you give them back the TP you've just taken from them? Not really expecting or requesting an answer - just pointing out that's the way it works, so you need to make sure you've considered it (even if you decide to do nothing about it)
 
Last edited by a moderator:

CharcoalKidd

Villager
Member
Joined
Mar 3, 2015
Messages
27
Reaction score
10
First Language
English
Primarily Uses
The place I change $game_variables[7] is when the player selects the skill from the menu, as opposed to when the game subtracts TP from the actor, which seems to be after all the moves are assigned. So for the first move, $game_variables[7] is the same as the actor's TP, but for the second action of that same actor, the TP is still the same whilst the variable changes. In theory, anyway. 

And yes, when a player cancels a move, I could just add the value back to the variable under the prior_command bit of whichever script that's from (I don't know off the top of my head). Save the value subtracted in a local variable or something. 
 

Latest Threads

Latest Posts

Latest Profile Posts

Hike was successful guys! I made it to the top!
Add Film-like Visual Effects During Test-Play, Deploy Games with Electron | RPG Maker News #69

brain broken as soon as i figure out whats wrong with my game im taking a long nap
Hey guys anyone is interested in playing my game? Just PM me and I'll give you a Steam key! Here's my latest video! ->
cst.PNG
What would you assume this thing was/is?

Forum statistics

Threads
112,182
Messages
1,066,418
Members
145,777
Latest member
rag1993
Top