Darkskull

Veteran
Veteran
Joined
Sep 14, 2016
Messages
95
Reaction score
15
First Language
English
Primarily Uses
Hey all! I'm not certain if this can be done with or without the use of .js, so for now this question will be asked here. If it turns out that .js scripts are the only way to do what I'm looking for, I'll ask a moderator to move the topic.

So! I'm looking to have an RNG mechanic in my game. That is, when a certain event occurs, one of the (alive) party members has something happen to them randomly.

For instance, let us say "Fred" is in position 2 in the party.

"Fred has dysentery"

A message box would pop up, and Fred, having randomly been selected, gains a state and has his health lowered.

Do you know a way to do this with the base game that I'm just not seeing? Affecting party members based on selecting a random living member of the party?
 

Poryg

Dark Lord of the Castle of Javascreeps
Veteran
Joined
Mar 23, 2017
Messages
4,178
Reaction score
10,800
First Language
Czech
Primarily Uses
RMMV
$gameParty.members()[slot - 1, because they begin from 0].addState (whatever).
Then you'd also do \P[1] or \P[2] in the message box to display his name.
 

Darkskull

Veteran
Veteran
Joined
Sep 14, 2016
Messages
95
Reaction score
15
First Language
English
Primarily Uses
@Poryg

Awesome!

What would be the code for changing HP/MP/A variable? :)
 

Poryg

Dark Lord of the Castle of Javascreeps
Veteran
Joined
Mar 23, 2017
Messages
4,178
Reaction score
10,800
First Language
Czech
Primarily Uses
RMMV
$gameParty.members()[0]._hp = x;
mp is similar
$gameVariables.setValue(id, value)
 

Darkskull

Veteran
Veteran
Joined
Sep 14, 2016
Messages
95
Reaction score
15
First Language
English
Primarily Uses
Thank you! That's just about it I think. Awesome :)

Edit: Does anything weird happen if the chosen actor is already dead?
 

Latest Threads

Latest Profile Posts

Test game. Find something broken. Fix. Re-test game. Broken thing fixed but new thing broken that wasn't before. What?!?! Uhg! :kaoangry:
I watched this youtube video of this reporter that went to a Flat Earth Conference. And there was just a whole lot of stupid in one room.
What?! You want 2 more hours of a playthrough? Well you got it! Come hang out with us while we dive even deeper into the awesome game Kindred Novel by BirdBunch! :LZSjoy:
Well, shoot. I didn't mean for the title screen to be there in my previous post.
Can everyone here just forget about that until I'm actually ready to formally announce it?

Forum statistics

Threads
122,071
Messages
1,146,279
Members
160,350
Latest member
rayhanalka
Top