Specific item boosts toward specific team members, script maybe?

Trying to have an item give more stat increases to a specific person than everyone else when used. I want only certain characters gaining more bonus stats/effects from an item that can be used from everyone.

So I created the item, made a common event for item. I figure it may use a IF SCRIPT and then ELSE

But I don't know script. If anyone has a better idea, I'm all ears.
Thanks for reading.
I think you would call $gameActors.actor(actorId)
I tried using $gameActors.actor(actorId) but replaced it like this $gameActors.actor(3) because I thought ID was the list number of the Actor. Am I doing something wrong?
Trying to have an item give more stat increases to a specific person than everyone else when used. I want only certain characters gaining more bonus stats/effects from an item that can be used from everyone.

So I created the item, made a common event for item. I figure it may use a IF SCRIPT and then ELSE

But I don't know script. If anyone has a better idea, I'm all ears.
Thanks for reading.

I'd use an event structure like this, assuming it's a permanent stat boost item meant to be used outside battle only:

Code:
If : Script : !$gameParty.inBattle()
  If : Script : $gameParty._menuActorId === 5
     // big stat boost for specific actor (5 in this case)
  Else
    // lesser stat boost for anyone else
  End
End
I tried using $gameActors.actor(actorId) but replaced it like this $gameActors.actor(3) because I thought ID was the list number of the Actor. Am I doing something wrong?
Not sure without seeing exactly how you wrote it out.

But @Aesica gave you basically exactly how it could be written.
Yes, permanent boost stat item meant to be used outside battle only. Thanks so much Aesica. ♥

I edited the script and made this branch

◆If:Script:$gameParty._menuActorId === 3
◆Control Variables:#0034 JohnAttackStat += 10
◆Text:None, Window, Bottom
: :Bigger stat here
◆
:Else
◆Text:None, Window, Bottom
: :Gained random stat here
◆
:End

but this may seem silly, but I don't see an Event Command for raising an Actor's stat. I only see an Event Command on Page 2 for like Hp and MP stat raising. So I tried setting up a variable that had the Actor's game data for attack that I wanted to change but that didn't seem to work either. I'm not sure where to begin to increase a member's stat with an event command. I figure it's variables but not sure how.

Could someone please kindly point me in the direction of a link or how to do this?

Really appreciate the help everyone. I will let you know if I get this working.
You can add (or subtract) stats via change paramter under the actor section in common events. Stick the actor id in a variable and you can use it in the common event.
Forgive my ignorance but I'm still having trouble understanding how to make this work. I've never used variables this way before.

Would it be alright if you could please post the coding for the common event again and let me know which parts to change?

The problem I am having is that only one message for stat gain is showing. Only one message shows for everyone. (I have not seen the special message for specific characters displaying a better stat gain)


I'd use an event structure like this, assuming it's a permanent stat boost item meant to be used outside battle only:

Code:
If : Script : !$gameParty.inBattle()
  If : Script : $gameParty._menuActorId === 5
     // big stat boost for specific actor (5 in this case)
  Else
    // lesser stat boost for anyone else
  End
End


But what I am using is this for the common event

◆If:Script:!$gameParty.inBattle()
◆If:Script:$gameParty._menuActorId === 3
◆Control Variables:#0034 = Actor ID of the party member #3
◆Change Parameter:{JohnID#}, Attack + 10
◆Text:None, Window, Bottom
: :John gained 10 stats
◆
:Else
◆Text:None, Window, Bottom
: :Gained random stat here for everyone else here
◆
:End
◆
:End
itemgaintest.png
If you want to be even more efficient with this, try this as a single script command:

Code:
if (!$gameParty.inBattle()) {
  let stats = ["HP", "MP", "ATK", "DEF", "MATK", "MDEF", "AGI", "LUK"];
  let targetActor = $gameParty.targetActor();
  let stat = targetActor.actorId() === 1 ? 2 : Math.randomInt(stats.length);
  targetActor.addParam(stat, 10);
  $gameMessage.add(targetActor.name() + " gained 10 " + stats[stat] + "!");
}

Replace the === 1 with === whatever ID John has in the actor database.

(use targetActor() rather than _menuActorId because at the point where the common event is executed, that variable has no value; this is why you kept seeing the "else" message in your code)
If you want to be even more efficient with this, try this as a single script command:

Code:
if (!$gameParty.inBattle()) {
  let stats = ["HP", "MP", "ATK", "DEF", "MATK", "MDEF", "AGI", "LUK"];
  let targetActor = $gameParty.targetActor();
  let stat = targetActor.actorId() === 1 ? 2 : Math.randomInt(stats.length);
  targetActor.addParam(stat, 10);
  $gameMessage.add(targetActor.name() + " gained 10 " + stats[stat] + "!");
}

Replace the === 1 with === whatever ID John has in the actor database.

(use targetActor() rather than _menuActorId because at the point where the common event is executed, that variable has no value; this is why you kept seeing the "else" message in your code)


Thanks so much! This works!

I think I know how to edit a bit of this. I think my message is between the " "
if I wish to edit what the message says, correct? Just not sure how I would give a random number or constant (say +3 in a stat instead of 10) for every other character though.

I assume the 10 in targetActor.addParam(stat, 10); is the +10 for all characters?
Thanks so much! This works!

I think I know how to edit a bit of this. I think my message is between the " "
if I wish to edit what the message says, correct? Just not sure how I would give a random number or constant (say +3 in a stat instead of 10) for every other character though.

I assume the 10 in targetActor.addParam(stat, 10); is the +10 for all characters?

Yeah, if you want to change the message that's shown you edit the part in the $gameMessage.add line.

You're correct that the 10 in the addParam is for the amount to raise the stat by. If you wanted to have it as 10 for John and 1-3 for everyone else, for example, you'd instead do:

Code:
targetActor.actorId() === 1 ? targetActor.addParam(stat, 10) : targetActor.addParam(stat, Math.randomInt(2) + 1);
Thank you so much!

Edit: Oh btw, where would I place
targetActor.actorId() === 1 ? targetActor.addParam(stat, 10) : targetActor.addParam(stat, Math.randomInt(2) + 1);

?
In place of the "targetActor.addParam(stat, 10);" line.
Thanks! Though I'm having trouble making it work. Now both characters have the same message however. What am I doing wrong?

◆Script:if (!$gameParty.inBattle()) {
: : let stats = ["HP", "MP", "ATK", "DEF", "MATK", "MDEF", "AGI", "LUK"];
: : let targetActor = $gameParty.targetActor();
: : let stat = targetActor.actorId() === 3 ? 2 : Math.randomInt(stats.length);
: : targetActor.actorId() === 3 ? targetActor.addParam(stat, 10) : targetActor.addParam(stat, Math.randomInt(2) + 1);
: : $gameMessage.add(targetActor.name() + " gained 10 " + stats[stat] + "!");
: :}



Would the script be for a separate actor message this? (Message for everyone else who does not get special boosts from item)

$gameMessage.add(targetActor.actorId() + " gained a few stats in " + stats[stat] + "!");

If so, where would I place this one? I really appreciate the help!

Edit1: (Do I just press space bar to line them up I guess?)
Oh, you need to change the message as well. One sec.

Change the script to this:

Code:
if (!$gameParty.inBattle()) {
  let stats = ["HP", "MP", "ATK", "DEF", "MATK", "MDEF", "AGI", "LUK"];
  let targetActor = $gameParty.targetActor();
  if (targetActor.actorId() === 1) {
    let stat = 2;
    let raise = 10;
  } else {
    let stat = Math.randomInt(stats.length);
    let raise = Math.randomInt(2) + 1;
  }
  targetActor.addParam(stat, raise);
  $gameMessage.add(targetActor.name() + " gained " + raise + " " + stats[stat] + "!");
}
If I may ask, where would I write the extra messages? The one for the bonus stat increased for specific character and the other message that displays for everyone else.

If that's not possible, that's fine. I pretty much have what I want, just wanted it tweaked a little more. Thanks so much for your help!

Edit1: I just tried the new code out and I got this error

SyntaxError

Unexpected end of input

I'm not sure what to make of it. ^^;
If I may ask, where would I write the extra messages? The one for the bonus stat increased for specific character and the other message that displays for everyone else.

If that's not possible, that's fine. I pretty much have what I want, just wanted it tweaked a little more. Thanks so much for your help!
If you copy it exactly as I wrote it in that post, it'll display the appropriate amount and stat for each character by itself. Or did you want an extra bit in the message if it was a specific-character bonus?
If you copy it exactly as I wrote it in that post, it'll display the appropriate amount and stat for each character by itself. Or did you want an extra bit in the message if it was a specific-character bonus?

I just copied and pasted the code again to test. Again I got the same error. I'm not sure what I am doing wrong.

By extra message I mean like

"John likes this item, gained 10ATK (or whatever stat I want to increase)

and everyone else's message "Actor Gained random stat + 1, 2 or 3 (


I'll copy and paste it again and edit my post to update if I get it working

Edit1: Nope, still getting the same error. Unexpected end input, isn't that for the }?
Oh, I wonder if the "let" only works in the block. Let me test something. I'm away to bed now so I'll pick this up with you tomorrow to go over how to personalise the message.
Sure! It's no rush. I'm really grateful. Even if you don't reply till a week later, I'd still be grateful Ha. Have a goodnight!

Original thread: https://forums.rpgmakerweb.com/threads/specific-item-boosts-toward-specific-team-members-script-maybe.124060/