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,799
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,799
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

I wonder... If I develop my own game hacks, does it count as beating the game my own way?
First 12 minutes of gameplay.

bio-Synthetica's Database plugin is complete. Players will be able to find and unlock various tutorials and lore as they reach certain points. There are 5 categories of files you can unlock: Audio Clips, Data Files, Bestiary, Earth History, and Tutorials.

1653160049600.png

Thank you Dsiver for this amazing plugin! :kaothx:
My favorite kind of progress? Reverse progress! First, change some small feature of your game. Second, go back through and change 6,000 tiny things related to that minor alteration just to get your game playable again. What fun!

Forum statistics

Threads
122,006
Messages
1,145,844
Members
160,273
Latest member
CardFighter_Key
Top