Allow a skill to target both dead and alive allies

LGardner

Veteran
Veteran
Joined
Dec 23, 2018
Messages
38
Reaction score
6
First Language
English
Primarily Uses
RMMV
I have a simple cure spell. It should be able to target one ally, either dead or alive, and restore some HP [and remove the knockout state if the ally is dead]. Could somebody please create a plugin for this, or direct me to one if one exists? I have looked without success.

I use almost all Yanfly plugins, so the plugin should not conflict with those.
 

Soulrender

Jack Of All Trades
Veteran
Joined
Jan 12, 2019
Messages
1,307
Reaction score
769
First Language
Poland
Primarily Uses
RMMV
It can be done without plugin - I see it that way:
#1 Create 3 spells:
- One for healing alive friend (scope: 1 ally (Alive) )
- Second for healing dead friend (scope: 1 ally (Dead) )
- Third spell set empty (scope: All Alies), for now, but we will return to it.

#2 Create common event (name it whatever you want) for this answer let's call it UBER_HEALING and use following conditional branch (with else)
(use "script" option in 4th tab)

if $gameActors.actor($gameParty._targetActorId).isStateAffected(1)
and in event use Force Action select spell for healing dead friend, else Force Action spell for healing alive friend.

#3 Now return to skills tab in database and in effect table for third healing spell use Common Event: UBER_HEALING.

Remember! It's only idea, not ready solution.
 

LGardner

Veteran
Veteran
Joined
Dec 23, 2018
Messages
38
Reaction score
6
First Language
English
Primarily Uses
RMMV
Seems like a great solution. However, I think something is wrong with the execution. When I target a dead ally, the caster (Lets call him Bob) targets himself (although the spell should definitely target (Ally) Dead. The target of the force action should be Last Target, right? Can anyone think why this might be failing? I have triple checked that I copied the code exactly, and the common event definitely invokes the right skill for the right condition. Maybe the "last target" is stored AFTER it defaults back to an alive target, because the common event skill still has the scope of "1 Ally"? Thanks for the reply, it seems a good solution if I can get it to work.
 

Zetech

Villager
Member
Joined
Sep 24, 2017
Messages
18
Reaction score
0
First Language
French
Primarily Uses
RMMV
For your request, you need Yanfly Target Core :

Write this in the comment of your skill :

<Custom Target Eval>
for(var i = 0 ; i < gameParty.battleMembers().lenght ; i++){
targets.push(gameParty.battlerMembers()[ i]);
}
</Custom Target Eval>

Now, add the effect you want : remove knockback state and heal the amount of HP you want

But, please check "gameParty.battleMembers()" to refer the actors in battle. If my syntax is wrong, just modify my code and that will work fine I guess
 
Last edited:

LGardner

Veteran
Veteran
Joined
Dec 23, 2018
Messages
38
Reaction score
6
First Language
English
Primarily Uses
RMMV
Th
For your request, you need Yanfly Target Core :

Write this in the comment of your skill :

<Custom Target Eval>
for(var i = 0 ; i < gameParty.battleMembers().lenght ; i++){
targets.push(gameParty.battlerMembers()[ i]);
}
</Custom Target Eval>

Now, add the effect you want : remove knockback state and heal the amount of HP you want

But, please check "gameParty.battleMembers()" to refer the actors in battle. If my syntax is wrong, just modify my code and that will work fine I guess

Thank you very much for your help.

I am not sure how to modify the code, as I am not very experienced using such things. I'm also not sure how to check "gameParty.battleMembers" to refer to the people in battle. What do you mean by this?

I have tried editing the code you put [I changed lenght to length, and tried with battler and battleMembers for the second part] but nothing worked.

This is what I currently have in the skill's Notebox:

<Custom Target Eval>

for(var i = 0; i < gameParty.battleMembers().length ; i++){

targets.push(gameParty.battleMembers()[ i]);

}

</Custom Target Eval>

In effects I have:

Recover HP - 15%
Remove State - Knockout 100%

The scope of the skill is "1 Ally".

I am sorry I am not capable of finding the problem in the syntax - if you let me know what I should change, that would be very helpful.
 

Zetech

Villager
Member
Joined
Sep 24, 2017
Messages
18
Reaction score
0
First Language
French
Primarily Uses
RMMV
Yes, it's "length" and not "lenght", my english is terrible ahah
I think I have found my mistake in this piece of code :

for(var i = 0; i < gameParty.battleMembers().length ; ++i){

I have also check and gameParty.battleMembers() is the correct syntax to refer to all actors in battle

Oh, last thing : I can't write this on the post (because it's a command or something like that) but it's : upload_2019-3-1_16-51-56.png and not [ i] x)
 

LGardner

Veteran
Veteran
Joined
Dec 23, 2018
Messages
38
Reaction score
6
First Language
English
Primarily Uses
RMMV
Yes, it's "length" and not "lenght", my english is terrible ahah
I think I have found my mistake in this piece of code :

for(var i = 0; i < gameParty.battleMembers().length ; ++i){

I have also check and gameParty.battleMembers() is the correct syntax to refer to all actors in battle

Oh, last thing : I can't write this on the post (because it's a command or something like that) but it's : View attachment 110545 and not [ i] x)

Thanks so much. It is still not working for me - I have attached a couple of screenshots, perhaps you can tell me where I am going wrong. Yanfly's Target Core is enabled, in the right place in the plugin list, and turned on. I also had the idea [as I said, I am new at this] than when you wrote "i" you expect me to substitute it with an unused variable in my game - I tried that [with the number 5] and it also didn't work. I am trying to understand the code, but I am not sure what the length refers to, or the ++i sign. But if it works I will be happy regardless!

B9JrYxc.png


And, as not all the note is visible:

LjAaY9v.png


I tried it like this, and also in this form [just in case i is meant to be an unassigned variable]:

<Custom Target Eval>

for(var 5 = 0; 5 < gameParty.battleMembers().length; ++5){

targets.push(gameParty.battleMembers()[5]);

}

</Custom Target Eval>

So where am I going wrong? :D
 

Soulrender

Jack Of All Trades
Veteran
Joined
Jan 12, 2019
Messages
1,307
Reaction score
769
First Language
Poland
Primarily Uses
RMMV
This should work
Code:
<Custom Target Eval>
    for(var i = 0; i < gameParty.battleMembers().lenght; i+=1){
        targets.push(gameParty.battleMembers()[i]);
    }
</Custom Target Eval>
 

Zetech

Villager
Member
Joined
Sep 24, 2017
Messages
18
Reaction score
0
First Language
French
Primarily Uses
RMMV
No problem, this is just programming things and a lotta people use rpg maker to avoid coding and be focus on game design and game art ;)

In this piece of code, "i" is just a iterator to focus all the battler during the skill. Don't touch it, it will get automatically a value while running.

Well, I think I have found another mistake in my code :

Code:
<Custom Target Eval>
for(var i = 1; i <= gameParty.battleMembers().length; ++i){
    targets.push(gameParty.battleMembers()[i]);
}
</Custom Target Eval>

I think the target eval didn't work because of the initialization of i = 0. The actor ID 0 doesn't exist because it start at 1, so the code was not effective.
 

caethyril

^_^
Global Mod
Joined
Feb 21, 2018
Messages
2,957
Reaction score
2,292
First Language
EN
Primarily Uses
RMMZ
Assuming this is a correct approach, you should just need a $ in front of gameParty:
Code:
<Custom Target Eval>
for (var n = 0; n < $gameParty.battleMembers().length; n++) {
  targets.push($gameParty.battleMembers()[n]);
}
</Custom Target Eval>
 
Last edited:

LGardner

Veteran
Veteran
Joined
Dec 23, 2018
Messages
38
Reaction score
6
First Language
English
Primarily Uses
RMMV
Soulrender, your approach unfortunately did not work. I corrected the spelling of "length", also with no luck. :/ The player steps forward, but no animation or healing takes place. That is equally true when used on a dead or alive actor.

Zetech, same situation.

Caethryil, interestingly, your approach causes ALL alive party members to be cured when the spell is used on a living member. When used on a dead member, it seemed to cause two party members to be cured [including the dead member]. So, it has succeeded in working in dead AND alive targets, but the targeting needs some work.

Thank you all so much for your help on this.
 

caethyril

^_^
Global Mod
Joined
Feb 21, 2018
Messages
2,957
Reaction score
2,292
First Language
EN
Primarily Uses
RMMZ
Yup, I wondered whether something like that would happen...item/skill scope can be tricky. xP

Not sure how best to do this with Yanfly's plugins, but I discovered one of Kadokawa's plugins called DeadOrAliveItem.js that sounds perfect! It adds two extra scopes via notetags: single ally (dead/alive) and all allies (dead/alive). I use the Steam version and found the plugin in my RMMV install folder, under dlc/KadokawaPlugins. If you can't find it and you're using the standalone version then this thread may help: https://forums.rpgmakerweb.com/index.php?threads/cant-find-the-kadokawa-plugins-folder.55399/
 

LGardner

Veteran
Veteran
Joined
Dec 23, 2018
Messages
38
Reaction score
6
First Language
English
Primarily Uses
RMMV
Yup, I wondered whether something like that would happen...item/skill scope can be tricky. xP

Not sure how best to do this with Yanfly's plugins, but I discovered one of Kadokawa's plugins called DeadOrAliveItem.js that sounds perfect! It adds two extra scopes via notetags: single ally (dead/alive) and all allies (dead/alive). I use the Steam version and found the plugin in my RMMV install folder, under dlc/KadokawaPlugins. If you can't find it and you're using the standalone version then this thread may help: https://forums.rpgmakerweb.com/index.php?threads/cant-find-the-kadokawa-plugins-folder.55399/

Thank you for the digging. I was very excited to try this, even more so when I found I already had it installed! I also use Steam.

Unfortunately, it doesn't work. I tried it at the bottom of my plugin list, then at the top [suspecting a conflict]. Same in both cases. If I target a dead ally, it heals the caster. I am not sure if the issue is that it's a skill rather than an item... But I think there's a problem with Yanfly's Battle Core compatibility too [unfortunately completely necessary for my project, which is based around Yanfly plugins, but this thread suggests they can't work together: https://forums.rpgmakerweb.com/inde...-deadoraliveitem-pre-order-dlc-plugins.49678/.] Looking into the problem further also led me to this thread similar to my own:

https://forums.rpgmakerweb.com/inde...x-item-that-heals-basically-everything.48783/

Unfortunately, this user's goal was a little simpler [restore all, not restore target] but the solution may lie somewhere in that thread, or at least a clue to it. I am still trying different things with no success. I tried combining the Deadoralive with a common event [leading to two separate skills, as suggested at the start of this thread] and it also didn't work.

Edit: I don't have the coding knowledge to know exactly how to work something, but would something like this be possible like a common event?

store targeted user's id as a variable
remove knocked out status on party member with that ID
heal that party member

to bypass the targeting system? Or would it just run into the same problem and save the wrong target's id, because it wouldn't let the user truly target a dead person? Could possibly just save all knocked out party member's IDs, but then it would also revive them when targeting a living person, and would have problems if there's more than one knocked out at a time... Ugh. I don't really know what I'm talking about, just making suggestions in the hope someone smarter and more experienced than me can realise a way to make it work :D
 
Last edited:

caethyril

^_^
Global Mod
Joined
Feb 21, 2018
Messages
2,957
Reaction score
2,292
First Language
EN
Primarily Uses
RMMZ
Oh, yes, confirmed. Drat. >_<

I've just written a little compatibility plugin that seems OK after a few quick tests, see here or the attached file: view file (Google Drive).
 

Attachments

  • CaeX_YEPDeadOrAlive.js
    1.8 KB · Views: 9

LGardner

Veteran
Veteran
Joined
Dec 23, 2018
Messages
38
Reaction score
6
First Language
English
Primarily Uses
RMMV
Thank you so much for taking the time to do that. Unfortunately, it's still not letting me target anyone. I've tried with spell scope set to One Ally or One Ally [Dead], same results.

Plugin order is Yanfly Battle Engine Core, then DeadorAliveItem, then your plugin. I've tried changing the order of the last two plugins to no avail.

At this point, I am wondering whether to make an artificial "knockout" state in order to fool the targeting system into thinking knocked out people are alive. I could have a common event each round giving knocked out users the state and removing their prior knockout state. Might that work? I am worried about how to get the new state to act the same, graphically.

Did you try your plugin out as a skill, and as the <scope:oneDeadOrAlive> notetag? I would be happy to send my project, or any screenshots, but I appreciate you've already spent a lot of time on this...

Edit: The knockout state I mentioned DOES work as a kind of messy fix. However, graphically it is not seamless, and obviously I would need to work out how to enter Game Over if all actors had that state. It would also involve a lot of recoding as enemies will continue to attack knocked out actors etc. So I think it isn't really feasible.
 
Last edited:

caethyril

^_^
Global Mod
Joined
Feb 21, 2018
Messages
2,957
Reaction score
2,292
First Language
EN
Primarily Uses
RMMZ
Ah, I tried out a few more plugins and it looks like Yanfly's Selection Control conflicts with it too! Selection Control lets you target enemies and/or allies with the same skill, so Yanfly's put all the selection processing on the enemy target window, meaning it completely bypasses my fix. I think I've got a solution, though; same link as before if you want to try it out: view file

Be sure to load my patch after Selection Control. Also, remember to save your project after making plugin changes and before testing~ :kaothx:

If that doesn't work for you, maybe post a list/screenshot of all the plugins you're using? I'm not sure which other Yanfly plugins might be worth checking for conflicts. :kaoswt:

Edit: also, yes, I've been testing using the default Heal skill with three cases: no notetag, <scope:oneDeadOrAlive>, and (after changing its scope in the editor to All Allies) <scope:allDeadOrAlive>.
 

Attachments

  • CaeX_YEPDeadOrAlive.js
    3.4 KB · Views: 43
Last edited:

LGardner

Veteran
Veteran
Joined
Dec 23, 2018
Messages
38
Reaction score
6
First Language
English
Primarily Uses
RMMV
Ah, I tried out a few more plugins and it looks like Yanfly's Selection Control conflicts with it too! Selection Control lets you target enemies and/or allies with the same skill, so Yanfly's put all the selection processing on the enemy target window, meaning it completely bypasses my fix. I think I've got a solution, though; same link as before if you want to try it out: view file

Be sure to load my patch after Selection Control. Also, remember to save your project after making plugin changes and before testing~ :kaothx:

If that doesn't work for you, maybe post a list/screenshot of all the plugins you're using? I'm not sure which other Yanfly plugins might be worth checking for conflicts. :kaoswt:

Edit: also, yes, I've been testing using the default Heal skill with three cases: no notetag, <scope:oneDeadOrAlive>, and (after changing its scope in the editor to All Allies) <scope:allDeadOrAlive>.

IT WORKS! You are a lifesaver. Really, I cannot thank you enough. :) As a sidenote, I tried it initially this time before the DOA plugin and it didn't work - but trying it placed after the DOA plugin does. That might be worth putting in the plugin information, which says to place it after the Yanfly scripts but not where to place it in relation to DOA. Anyhow, thank you so much for your help - I really can't believe how much effort you put into solving my problem. I'm so happy it's fixed now :). Hopefully other people will also be able to get some use out of your compatibility fix - it must have also been reacting to the Selection Control, as you said. The good news is I am using most of the other Yanfly plugins, so we know there's no compatibility issues elsewhere with them :). Thank you also to everyone else who offered solutions.
 

Latest Threads

Latest Profile Posts


AABS laser beams features:
1,Shoot penetrating laser beams for player's normal attack
2,Beam's width/damage/comsumes/loot can be controlled by events/variables with great flexibility
3,Beam can rebound to walls or certain regionID
4,Can play SE when shooting beams
5,Beam's images can be solid images or animated ones.
Surprising nobody, it turns out "next Friday" for the next Jump into Javascript has become "possibly Sunday if you're lucky" XD
Folks, if anyone sends you a message inviting you to add their API to your game, please report them. We don't want people spamming our members asking them to add stuff to their games for their own (or others') benefit. We've updated the forum rules to confirm this.
I'm listening to iiluminaughtii talking about the secrets behind shady businesses and scams. Meanwhile I'm writing a fanfic about Sephiroth from FF7, one specifically for my stepmom. I'll get to give it to her, too, because my boss said I could take the holidays off! Dec. 22-27 I will be in Orlando, and maybe Fort Myers too, visiting my dad and stepmom!
Of course, I bought a handful of games on the Steam Black Friday sale. Will I try them? Will I complete any? Who knows...

Forum statistics

Threads
117,015
Messages
1,103,833
Members
152,911
Latest member
WakeNBake
Top