Danitinkis

Deadly and sexy
Veteran
Joined
Dec 31, 2016
Messages
122
Reaction score
66
First Language
Spanish
Primarily Uses
RMMV
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?
 
Last edited:

ATT_Turan

Forewarner of the Black Wind
Veteran
Joined
Jul 2, 2014
Messages
1,159
Reaction score
634
First Language
English
Primarily Uses
RMMV
Someone more familiar with some of the intricacies of JavaScript might have something more elegant for you, but this should work:
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>
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).
 
Last edited:

Danitinkis

Deadly and sexy
Veteran
Joined
Dec 31, 2016
Messages
122
Reaction score
66
First Language
Spanish
Primarily Uses
RMMV
Someone more familiar with some of the intricacies of JavaScript might have something more elegant for you, but this should work:
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>
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).
I tried using the code, but it doesn't work... take a look:
1621221916719.png
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 :kaoluv:
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>
 

ATT_Turan

Forewarner of the Black Wind
Veteran
Joined
Jul 2, 2014
Messages
1,159
Reaction score
634
First Language
English
Primarily Uses
RMMV
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 equips()[0]

However, I'm able to move the cursor to select another actor (Though it stays the cursor as if I'm targeting everyone)
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.
Also, If I use it, it doesn't do anything.
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.
 
Last edited:

Danitinkis

Deadly and sexy
Veteran
Joined
Dec 31, 2016
Messages
122
Reaction score
66
First Language
Spanish
Primarily Uses
RMMV
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 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.
 

ATT_Turan

Forewarner of the Black Wind
Veteran
Joined
Jul 2, 2014
Messages
1,159
Reaction score
634
First Language
English
Primarily Uses
RMMV
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.
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.
 

Latest Threads

Latest Posts

Latest Profile Posts

Man, this quick One Map game is causing unprecedented amounts of trouble.
I always end up having issues with things i'd never expect.

Capture.PNG

Those friggin mountains man xD
Time for my daily walk/jog ''Literally starts raining while I open the door''
I just discovered there's a giant jellyfish in the Ace RTP. My day is made.

Forum statistics

Threads
112,401
Messages
1,068,057
Members
146,053
Latest member
komradiv
Top