One thing I forgot last time is that for the purpose of the command I posted a confused battler is still technically allowed to use all their skills
(the game will just replace their actions in battle, but the player is allowed to make a party member cure their own confusion outside of combat through the skill menu for example). Complete paralysis is covered by the function though.
If you want to check for confusion too the entire command could look like this instead:
!battler.isConfused() && battler.canUse($dataSkills[ID])
1. Can you put multiple skills in the index and if so, how?
The function only allows to check for one skill at once.
However in Javascript you can always combine multiple conditions into one using
&& ("and"-operator, all linked conditions must be fulfilled) or
|| ("or"-operator, at least one condition must be fulfilled):
battler.canUse($dataSkills[12]) && battler.canUse($dataSkills[13])
would require the battler to be able to use both skill 12 and 13 to fulfill the condition for example.
If you have multiple skills to test and don't want to copy the same condition for every one of them, the recommended way to shorten it would be to use an array:
Spoiler
- You replace the variable part of your condition with - well - a variable (in this case the variable part would be the ID of your skill)
- Then you cycle through all the IDs you want to test, using the variable.
Arrays also have a simple way to test conditions against all their contents through either
every (all elements have to pass the condition) or
some (at least one element has to pass the condition)
The result might look a bit weird, but something like this should work:
[1, 2, 3, 11, 12, 13, 20].every(function(skillId) { return battler.canUse($dataSkills[skillId]); })
("skillId" is just the name of the variable here. It acts as a placeholder for each array element passed through the condition function and does not have to be changed)
2. Can you also check for skill-types (like magic, techniques etc) instead of specific skills?
If you want to check if a specific skill type is sealed, you can use
battler.isSkillTypeSealed(ID)
but this will only check for that specific feature, not if the corresponding skills are prohibited through other means.
If you want to check if a battler could use all or at least any skill of a specific type, you could use the array command from the spoiler above and apply it to all skills:
Spoiler
$dataSkills.filter(function(skill) { return skill && skill.stypeId === ID; }).every(function(skill) { return battler.canUse(skill); })
Note:
- array.filter( ... ) is a reduced array with only the elements that passed the first condition function (skills that exist and have the right skill type).
- ID should be replaced by the wanted skill type ID in the database.
- every can be replaced with some if you only need the battler to be able to use any one of the skills
- Because the $dataSkills array contains actual skill objects rather than numbers, you don't need to translate them into skills using $dataSkills[...] later in the condition functions.
3. And how would that command look like with items instead of skills (since you mentioned that)?
You can use $dataItems[ID] instead of $dataSkills[ID] for items. It's a bit uncommon to use it for enemies since those don't have their own inventory by default and would use the partys though.
(This post has become a bit Javascripty, but I hope it helps anyways^^)