Hi! I'm using Yanfly's Target Core plugin, and I need to make a custom target scope for skill. This skill can only target alive allies who have equipped a weapon from a group of specific weapon types (sword, axes, spears...). Can you help me accomplish this effect?
MV Custom Target Scope help
Javascript/Plugin SupportSomeone more familiar with some of the intricacies of JavaScript might have something more elegant for you, but this should work:
Where:
slot_id is the slot number of wielded weapons (in your database->Types->Equipment Types).
xx, yy, zz, as many different cases as you want to have, are the weapon types you want affected (also in Types->Weapon Types).
Code:
<Custom Target Eval>
for (var i = 0; i < $gameParty.aliveMembers().length; i++)
{
if (!$gameParty.aliveMembers()[i].equips()[slot_id])
continue;
var add=false;
switch($gameParty.aliveMembers()[i].equips()[slot_id].wtypeId)
{
case xx:
case yy:
case zz:
add=true;
}
if (add)
targets.push($gameParty.aliveMembers()[i]);
}
</Custom Target Eval>
slot_id is the slot number of wielded weapons (in your database->Types->Equipment Types).
xx, yy, zz, as many different cases as you want to have, are the weapon types you want affected (also in Types->Weapon Types).
I tried using the code, but it doesn't work... take a look:
The skill only targets alive characters, and doesn't care about the weapon. However, I'm able to move the cursor to select another actor (Though it stays the cursor as if I'm targeting everyone) Also, If I use it, it doesn't do anything.
I hope you can fix this 😍
BTW, this is the code I've placed at the notebox if it can help you:
Code:
<Custom Target Eval>
for (var i = 0; i < $gameParty.aliveMembers().length; i++)
{
if (!$gameParty.aliveMembers()[i].equips()[1])
continue;
var add=false;
switch($gameParty.aliveMembers()[i].equips()[1].wtypeId)
{
case 1:
case 2:
case 3:
case 4:
case 12:
case 14:
case 15:
case 18:
add=true;
}
if (add)
targets.push($gameParty.aliveMembers()[i]);
}
</Custom Target Eval>
Sorry, I presumed a bit of coding information you might not know. For the slot_id, the list in the code starts at 0 whereas the numbers in your database start at 1, so it needs to be the database number minus 1.
So if Weapon is your first equipment slot, you should be looking at
So if Weapon is your first equipment slot, you should be looking at
equips()[0]This sounds like it might be an issue of scope - do you have the skill scope as 1 ally or all allies? Also, double check that your plugins (especially any Yanfly plugins) are in the correct order according to his instructions.
That shouldn't have anything to do with your targeting, you would have to post a screenshot of the skill to see what it's supposed to do.
OK, I fixed all you mentioned and the skill seems to work as it should. However, the cursor still appears on top of every actor, without caring if the skill has any effect on them. I'd like the cursor to show only on characters who meet the requirements of the skill if that's possible for you to do.
Thank you in advance <3.
Have you checked the things I said last time about this? This has nothing to do with me, this is something not working correctly in your game.
Most specifically, again, check the order of your plugins against the order Yanfly says to put them in. If you have done that, you can post a screenshot of your plugin manager and a screenshot of your skill and I'll see if I see anything wrong...but you can test it yourself by turning off every plugin except Target Core and verifying that looks correct, then turning them back on one at a time.
Original thread: https://forums.rpgmakerweb.com/threads/custom-target-scope-help.136583/