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,159
Reaction score
10,751
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,159
Reaction score
10,751
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

A woman gave me her number without me even asking for it. Then she left because she had other patients to see.
oh, hey, I forgot about all this!

my old project got abandoned after I started working too much on stuff I'd already worked on - plus, starting to hate the story I wrote for it. Then, well, a lot of serious life **** went down. I ended up moving across the country, cutting off some people, etc. - **** was rough.

So, uh, I guess I'm back for now? Funny how things work.
I'm glad I'm sticking to my guns on having fighting game mechanics in my game, from what I've read, it's not for everyone. but for the most part, I've made it so you don't have to use them motion inputs for attacks if you don't want to.
And my project's just entered the Lunar New Year Sale 2022... Let's see if it reaches it's goal of $ 7,77.
Ohmygoodness I played Dicey Dungeons for the first time last night. Gave me SO MANY IDEAS for how to fix Heidi.

Forum statistics

Threads
118,725
Messages
1,118,234
Members
155,869
Latest member
RuerXIII
Top