Specific item boosts toward specific team members, script maybe?

evmaster

Cats are the best.
Veteran
Joined
Sep 1, 2015
Messages
511
Reaction score
730
First Language
English
Primarily Uses
RMMV
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.
 

HumanNinjaToo

The Cheerful Pessimist
Veteran
Joined
Apr 18, 2013
Messages
1,089
Reaction score
498
First Language
English
Primarily Uses
RMMV
I think you would call $gameActors.actor(actorId)
 

evmaster

Cats are the best.
Veteran
Joined
Sep 1, 2015
Messages
511
Reaction score
730
First Language
English
Primarily Uses
RMMV
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?
 

Aesica

undefined
Veteran
Joined
May 12, 2018
Messages
1,293
Reaction score
1,175
First Language
English
Primarily Uses
RMMV
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
 

HumanNinjaToo

The Cheerful Pessimist
Veteran
Joined
Apr 18, 2013
Messages
1,089
Reaction score
498
First Language
English
Primarily Uses
RMMV
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.
 

evmaster

Cats are the best.
Veteran
Joined
Sep 1, 2015
Messages
511
Reaction score
730
First Language
English
Primarily Uses
RMMV
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.
 

Aesica

undefined
Veteran
Joined
May 12, 2018
Messages
1,293
Reaction score
1,175
First Language
English
Primarily Uses
RMMV
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.
 

evmaster

Cats are the best.
Veteran
Joined
Sep 1, 2015
Messages
511
Reaction score
730
First Language
English
Primarily Uses
RMMV
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

:Enditemgaintest.png
 
Last edited:

Trihan

Speedy Scripter
Veteran
Joined
Apr 12, 2012
Messages
2,337
Reaction score
1,495
First Language
English
Primarily Uses
RMMV
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)
 

evmaster

Cats are the best.
Veteran
Joined
Sep 1, 2015
Messages
511
Reaction score
730
First Language
English
Primarily Uses
RMMV
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?
 

Trihan

Speedy Scripter
Veteran
Joined
Apr 12, 2012
Messages
2,337
Reaction score
1,495
First Language
English
Primarily Uses
RMMV
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);
 

evmaster

Cats are the best.
Veteran
Joined
Sep 1, 2015
Messages
511
Reaction score
730
First Language
English
Primarily Uses
RMMV
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);

?
 

Trihan

Speedy Scripter
Veteran
Joined
Apr 12, 2012
Messages
2,337
Reaction score
1,495
First Language
English
Primarily Uses
RMMV
In place of the "targetActor.addParam(stat, 10);" line.
 

evmaster

Cats are the best.
Veteran
Joined
Sep 1, 2015
Messages
511
Reaction score
730
First Language
English
Primarily Uses
RMMV
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?)
 

Trihan

Speedy Scripter
Veteran
Joined
Apr 12, 2012
Messages
2,337
Reaction score
1,495
First Language
English
Primarily Uses
RMMV
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] + "!");
}
 

evmaster

Cats are the best.
Veteran
Joined
Sep 1, 2015
Messages
511
Reaction score
730
First Language
English
Primarily Uses
RMMV
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. ^^;
 

Trihan

Speedy Scripter
Veteran
Joined
Apr 12, 2012
Messages
2,337
Reaction score
1,495
First Language
English
Primarily Uses
RMMV
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?
 

evmaster

Cats are the best.
Veteran
Joined
Sep 1, 2015
Messages
511
Reaction score
730
First Language
English
Primarily Uses
RMMV
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 }?
 

Trihan

Speedy Scripter
Veteran
Joined
Apr 12, 2012
Messages
2,337
Reaction score
1,495
First Language
English
Primarily Uses
RMMV
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.
 

evmaster

Cats are the best.
Veteran
Joined
Sep 1, 2015
Messages
511
Reaction score
730
First Language
English
Primarily Uses
RMMV
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!
 

Users Who Are Viewing This Thread (Users: 0, Guests: 1)

Latest Threads

Latest Profile Posts

What does your project folder look like?
I was told that an iPhone can provide a personal internet hotspot...You learn something new everyday!
Will probably never use MZ. Buys it anyway
Been playing Star Ocean: The Last Hope, the remastered version on PS4. I like it. Seems others think it's garbage, but I like these cutesy, silly, and tropey characters. Having waaaay more fun with it than SO: Integrity and Faithlessness.

Forum statistics

Threads
100,458
Messages
976,161
Members
132,082
Latest member
nwr
Top