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,228
Reaction score
11,142
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,228
Reaction score
11,142
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 Posts

Latest Profile Posts

Forgot to add this to my stream thumbnail collection, nothing to see here. Move along. :kaoswt:

It's been a while again, eh.
It's all over! ep 27 now I got find some other long RPG to play, any reccomendations?
Shaz wrote on Avery's profile.
I need some of whatever you've been drinking for the last few weeks!
Although I love your awesome tutorials and always want more, I sure hope you're not going to burn yourself out.
Has anyone else ever thought about how the title of Gym Leader is usually hereditary? Usually the gym leaders child or sibling becomes the next gym leader. Not always, but usually. Pokémon nepotism

Forum statistics

Threads
129,955
Messages
1,206,522
Members
171,170
Latest member
misang
Top