Can I get someone to modify/fix this script generated by ChatGPT? It does not work on its own

I tried having ChatGPT generate a script where an enemy troop is able to target all dead actors (not troops) so the enemy can resurrect the party after the main protagonist snaps the boss out of the evil corruption the main villain and final boss bestowed upon her. However, what ChatGPT gave me does not work. It does not target dead party members. Or at least the remove death and recover HP 100% is not being applied.

The script it gave me (The comments have been modified by me) is:

Ruby:
#==============================================================================
# ** Skill_ResurrectAllDeadEnemies
#------------------------------------------------------------------------------
#  This script allows a skill to target all dead enemies for resurrection.
#  Place the <ResurrectAllDeadEnemies> tag in the skill's note box.
#==============================================================================
#  Generated by ChatGPT Model:gpt-3.5-turbo-16k
#  Prompt initiated by: Moltres Rider
#==============================================================================
# ** Prompt
#------------------------------------------------------------------------------
#   Generate a ruby script **in RPG Maker VX Ace format** that allows a skill
#   to target all dead enemies so a boss can resurrect the player's party at
#   a certain point in the fight.
# - The script should be accompanied by a tag that I would need to put in
#   the skill's note box stating that that skill targets all dead enemies.
#==============================================================================
# ** Instructions
#------------------------------------------------------------------------------
#  To use this script, follow these steps:
#  1. Open your RPG Maker VX Ace project.
#  2. Go to the Database and navigate to the Skills section.
#  3. Select the skill you want to target all dead enemies with.
#  4. In the skill's note box, add the following tag: `<ResurrectAllDeadEnemies>`
#  5. Save your project.
#==============================================================================
# ** Credit
#------------------------------------------------------------------------------
#   Credit: Moltres Rider and Linear Pair of Angles Productions in the credits
#   It would also be a good idea to credit ChatGPT and OpenAi as well
#==============================================================================
#                                ,.                                     
#                               .:                                     
#                              ;X                                       
#                            i2X                                       
#                           rZr                                         
#                          iai                                         
#                         X@0                                       :i:
#                       .Z@@S                                 .;XSX7i, 
#                      :WBW00                              .;S2Sr,.     
#          i7         iM00MZBZ    i:                   :XZB@MZ         
#         ;S7        iMMBMZrXBMX:Xi                 raBBW@@B;           
#        2XX:       ;MMa7:  ;M8ZX,               raWWW0BB8Z2           
#       20rr       ia2: ..i:r;X;              ,X0WWB@WBZ2287           
#      .@a::.,::::;i:::;rXXX:Z2             :a@MMMMMB8Z80B@@   ,.       
#       2,.,::i;r;7;r2aZ8Za2WW            i8MMMMM@B88ZZ2aZ88Srr:.       
#      r;;:ii;;i;ZX;;ZB7;2ZWWi         .iBMMMMBa7rii::iXX7:             
#     r;r;rrri;802i;;iriZZ0B8   .i  .:7BMMW2r::ir7SZB@@S,               
#    XWXi;;;iX@8SrX:iiiW00BZ0   ri i;XZ2i::rXZ8B0BW@WX             .   
#   ,rZZ;rX;i8X:aZ; :7;WWZ2a0, iSri::i;SWMMMMWB88800,             r   ,.
#   aS7;:,:iii.ii:i72a,a82SZWZ rX;;8@MMM@8Z008XS2Z0,             i7  iS
#   .28ZZ2Z777XXXSZZ8;,;MMM80X 7r:;ZWMM@WWWWMMM80@7         ..   Sr ;Sr
#     :0BW02SaaZ808Zri 2M0SS,  SiXW2XX7SS22ZZ008Z8,          r  rX:i7ai
#       ,  :80BB8Za;i. XS2WX   2;8MM@WW@M@WBB2,           .  :r:7r;XaX 
#         r@B0ZZa2;i. BMMMZ   XSXWMM8M02WM@8,        .,ir7.  ,rir22Z;   
#        a@8Zaa27ii  BMMMMS  72S80W@MBaS@M0   :;;:rXS2aaS.  ,iiSZX;     
#       aBZaa27;ii i@M82BMX;S2XZ0WBW0aSa8ar.:iii:;;7;i:,  ,;;X8X       
#      rB2S7;ii;i ZMMMZ7i,iZ27aBMWZX;:,,,,i;r;;i;ii::,:,i;7S0Z:         
#      7;iiii;;i .Z82riii;iXZ8B0Si.,,i;r;ii;rr;;;;;;:;rX288Zi           
#      7r;;;rr;::ir,,,;;r;;:;rr:::;ir7r;r:::i;8BBBB0BBBZ2;             
#      7rr;r;rii:;:::..;rr;;;;iiii:rXX;;rrii:r7i.... .                 
#      iX;r;r;;:;7;:i:::r;r;;iii;7aZX77;;rri;7                         
#      .X7;r;rrr77;rii::irii;7X2ZB0827XXrr;:;;                         
#       .7;i;;;;r7;;r;;i;rS2ZZ088S7;SaX7XXX7XX,                         
#        .X;:i:::77r;rrri70BB8aa22Xi XZaXXXX7XXSa,                     
#         WZZ2aaZZZX7;r;;;Z2r 8@0aa:  :SZZZ2Za2X2,                     
#        S@aaZa00BB8SXr77Xr,.:iii0aX        ZMZZS;                     
#        SW2aX7.    082XXXSXr:  i; ;;       SMBZ8a:                     
#        002ZSX    .@Z2Z7XS,;XXSX:iX,     ,:ir ,8;ri                   
#      S@WS28Sai   ,@Z22XX  :.  :::     :22Xr  ri rX                   
#   ,:iaZZ8W8X,    .BZ2aX;              .:..rXX7;7r.                   
# ,XaX7  :i Si    ;0BSaZS2.                .7:                         
# ., ,i;Xi :X   .iB@0ZW8Xr                                             
#    ;Xi :X;  rXXX, ;Xr2r                                               
#        .    rr,:.;7  Xi                                               
#                ;;. ,;,                                               
#==============================================================================

class Game_Action
  alias skill_resurrect_all_dead_enemies_make_targets make_targets
  def make_targets
    if @subject.is_a?(Game_Actor) && item && item_resurrects_all_dead_enemies?
      return Array.new($game_troop.dead_members)
    else
      return skill_resurrect_all_dead_enemies_make_targets
    end
  end

  def item_resurrects_all_dead_enemies?
    item && item.note.include?("<ResurrectAllDeadEnemies>")
  end
end

However, it does not work. The skill with the tag has a remove death and recover HP effect set but nothing happens when the boss uses the move.


Those who are willing, feel free to add your name to the credit section of the comments at the top as the editor or fixer or whatever.


Help will be appreciated. Doubt I will get help being that the issues I have been facing have gotten nothing so far but I hope that at least someone here can fix this script.
I don't know Ruby that well and am kinda like "why make chatgpt generate code and ask others to fix it", but I can see that the array is not picking up party members at all, but rather the troop members. Also, are those functions even real and not something the AI invented?

(edit: also, is credit warranted for only initiating prompts? Because anybody could do so 😅)
Well, I have been dealing with an issue for several days now and I have gotten barely any help so I tried to take matters into my own hands and tried to get Ai to do it for me. Only for it to fail just like everything else has this last several days. It was a last resort/pursue all avenues thing.

I figured that having what it gave me in my post would at least be a starting point in case anybody wanted to create something from scratch (I know I did not mention that).

I am a man who refuses to leave things unresolved. I am a fixer. I used to work IT at a mental health center and I would never give up fixing a computer regardless of how bad clients messed them up. I would sit there all day trying to fix a computer if I had to. It is why I am reaching out to the forums for help regarding the issue with my game.

I assume the commands are real. Game does not crash at least with the script.
Still says something along the lines of game troop and not game party though. Does a force action skill with remove death and full heal, targeting enemies (party is opposing side to boss after all) not do the trick?
No it does not. That has been tried to death. I have a number of posts in the VX Ace support board for that. Again with little help.

I tried what was offered but did not work
😴the one about commands being ignored? Are you using any scripts that could possibly interfere with this?
😴the one about commands being ignored? Are you using any scripts that could possibly interfere with this?

No not really. I do use some scripts but most of those are visuals, level cap adjusters, map generator from PNG images, screenshot stuff, and the likes.

There is untargetable state by @kyonides which modifies defined states to be untargetable but it does not prevent removal of death state.

I looked over his code and do not see anything alarming. I may not know ruby but I am somewhat familiar on how code tends to look like. I can make slight tweaks to some scripts.

Other common events that use the same commands work. Just not this one. It will not even works as battle event commands.

While you cannot see code, here is a list of scripts. I carefully name them so the names should tell you what they do
1691948939443.png



Maybe someone will come along and give something that works.
Did you take a look at the target manager one? Maybe that helps with this skill? Regarding the command bug I am not sure though.
The target manager one I added to try to fix the issue. It was not there before and the problem existed before that was added.

While it did not have the option to do what a particular website said it did (target dead enemies), it does have things that I needed for other skills. Like a 10 hit combo (rather than 9 as max) for a bowling move (referencing 10 frames in a game)
Regardless, tried googling it, turns up more than one option like Yanfly's lunatic targets or possibly scripts from Tsukihime or Fomar to help with targeting the dead enemies.
I do not really want to get into lunatic level scripts because you might as well script something yourself at that point. It is basically using a script to write a script.

You actually put lengthy code into the skill's note box.

It was something that I already came across.

Unless I know literally exactly what to put in that note box. I cannot use it.

There is one on Reddit but that is for MV, not VX Ace.
In my case I'm afraid you've potentially achieved the opposite of what you intended: I would happily have tried to help you figure out something you were trying for yourself (I was at an event yesterday and couldn't respond to your post until it was no longer visible in my feed) but on principle I refuse to provide any assistance with anything relating to AI, so you've gone on my "do-not-help" list.
To be fair, the language itself is confusing since the scope terms "enemy" and "ally" should be relative to troop and actors using the skill. In the scripts it uses "opponent" and "friend".
The problem with Rpg maker - STILL - is that you can target [Allies (dead)] but there is no scope for [enemies (dead)]
Which has always sucked for wannabe Necromancer classes.

So even if you inflict confuse or reflect, the opponents_unit.dead_members simply isn't in the code. The Skill CAN'T target anything. Luckily, that's literally all that's missing. It's kinda aggravating the developers have never bothered to fix it. But maybe there's a good reason for it.

As for your script, you don't want to edit the make_targets method, but the targets_for_friends just below it in Game_Action.
And all you really need to do is replace.
friends_unit.dead_members
with
item.note.include?("<ResurrectAllDeadEnemies>") ? opponents_unit.dead_members : friends_unit.dead_members


With the <tag> in the skills notebox and the scope set to [all allies (dead)], you can force an enemy troop to use the skill on their dead opponent.
Edit: Likewise, the actors can also use this tagged skill to revive their dead opponents as well.


Tested.
To be fair, the language itself is confusing since the scope terms "enemy" and "ally" should be relative to troop and actors using the skill. In the scripts it uses "opponent" and "friend".
The problem with Rpg maker - STILL - is that you can target [Allies (dead)] but there is no scope for [enemies (dead)]
Which has always sucked for wannabe Necromancer classes.

So even if you inflict confuse or reflect, the opponents_unit.dead_members simply isn't in the code. The Skill CAN'T target anything. Luckily, that's literally all that's missing. It's kinda aggravating the developers have never bothered to fix it. But maybe there's a good reason for it.

As for your script, you don't want to edit the make_targets method, but the targets_for_friends just below it in Game_Action.
And all you really need to do is replace.
friends_unit.dead_members
with
item.note.include?("<ResurrectAllDeadEnemies>") ? opponents_unit.dead_members : friends_unit.dead_members


With the <tag> in the skills notebox and the scope set to [all allies (dead)], you can force an enemy troop to use the skill on their dead opponent.
Edit: Likewise, the actors can also use this tagged skill to revive their dead opponents as well.


Tested.



I do not see anything in my script that says
friends_unit.dead_members

The screenshot that you posted seems to be an entirely different script.

I am so confused.


Edit: I see that it is under Game_Action.


One question. Does making this change make it impossible for an ally to resurrect all allies? I have skills and items that resurrect all allies.
No. Not really. Basically this <ResurrectAllDeadEnemies> note tag + Scope:[All Allies (dead)] = Scope:[All Enemies (dead)].

You wanted the troop to target dead actors. So the skill needs a [Enemy (dead)] scope. Because the actors are the "enemy" to the Troop who is using the spell.
This notetag is a way to create that scope which the database editor doesn't offer.

Skills only have 1 scope. So you'll just need a different Revive Skill, without the tag, to target just dead allies as normal.
Okay Thank You Very Much!

_______________________________________________________

Everybody else, please forgive me for trying to use Ai to create a script. I did not know what I was getting into with that and I am sorry if it offended any experts. I won't ask Ai to create one again.


_____________________________________________________


Edit: That change is not working for me! The enemy still does not resurrect the actors! Now the attack with the note tag does literally nothing. I have the skill set to remove the death state and to recover all HP and it is set to "all allies (dead) but even with that change in Game_Action, it still is not working.

I am at wits end about this!

Does anybody have any other advice?
and you placed the <ResurrectAllDeadEnemies> tag in that skill's notebox?
It worked for me.

Edit: Make sure you've Saved the project after making changes to the scripts before doing a test battle.
Yes I did. It is not working

Now the attack with the note tag does literally nothing.

I have no clue what is going on here because I tried two dozen fixes that work for other people but not me. I am clueless. It is as if everything related to resurrection is disabled in RPG Maker beyond a certain point in the fight even with a debug attack on an actor that instantly does enough damage to instantly jump to that part of the fight.

For the record, I am testing it in-game, not in battle test and I am saving it after I add the required stuff. But literally nothing has worked so far.

1691961486010.png


1691961529412.png


With this setup it is not working
It's possible another script has a duplicate method of the one you edited. So you'd have to apply those changes to that script.

You can right click the script list > find > search for "targets_for_friends".
The default scripts should only show 2 entries there in Game_Action
@coyotecraft so kindly got it fixed for me in a PM conversation. It is working now.

I had to modify a few lines in @kyonides 's Untargetable State script

That is where the conflict was.

Original thread: https://forums.rpgmakerweb.com/threads/can-i-get-someone-to-modify-fix-this-script-generated-by-chatgpt-it-does-not-work-on-its-own.160272/