How do I make an attack have the chance of triggering a State?

Jihanger

Psychotic Alien
Member
Joined
Aug 25, 2019
Messages
9
Reaction score
6
First Language
Portuguese(Bra)
Primarily Uses
RMVXA
I'm wondering if it's possible to do what I have in mind.

I have the Thunder Weapon from the standard spells apply Thunder Force, which adds elemental thunder damage. I want that while Thunder Force is active, the player has a chance of getting another State called "Hyped Up" when he attacks normally. "Hyped Up" has a 1/3 chance of triggering a second action for the turn, and even a third but at a much lower chance.

Is this possible through solely the database? If not, is there a way to do it without scripts?
 

BrentBAM

Veteran
Veteran
Joined
Jul 22, 2020
Messages
92
Reaction score
52
First Language
English
Primarily Uses
RMVXA
You can try entering this into the damage formula of the skill.

a.add_state(id); a.atk * 4 - b.def * 2

And then enter the number of the state into id.

but I think it adds the state after the attack...
 
Last edited:

BrentBAM

Veteran
Veteran
Joined
Jul 22, 2020
Messages
92
Reaction score
52
First Language
English
Primarily Uses
RMVXA
For the other effects a script might be needed.
 

Binder28

Veteran
Veteran
Joined
Sep 15, 2020
Messages
106
Reaction score
30
First Language
Portuguese
Primarily Uses
RMVXA
Create a variable (Lets call it "Hyped Up") that rolls from 1 to 3 everytime the actor uses the skill "atack" and on 1 you put to trigger the "Hyped up" state and on 2 and 3 you put nothing. Now you have a way of doing it...the difficult is triggering this mid battle.

Create a battle event (on troops) with a conditional branc. The conditional branch must be "If charachter has "Thunder Force". Then you put the variable up, with another conditional branch for each random number...it should be something like this:

Conditional Branch: [charachter] is Thunder force aflicted:
---@>Control Variables:[Hyped Up] = Random (1...3)
-----@> Conditional Branch: Variable [ThunderForce] ==1
-----@> Change State [Charachter] + [Hyped Up]
-----@> Control Variables: [Hyped Up] =0 (Trust me...if you don't do this, you can be stuck on a loop)

On Variables 2 and 3 just put "@> Control Variables: [Hyped Up] =0"

And there you go...you got this...but only on one troop...thats where scripting comes into place...I recomend Base troop Events by Yanfly so you just need to put this on the first Troop slot and this will repeat trhough all battles...I hope this is what you wanted...and good night



Edit: Sorry...it just ocurred to me that I forgot to make it trigger by an atack...do all of this on a common event and make a normal atack call the event...you don't need to put this on troops if you do this.
 
Last edited:

Jihanger

Psychotic Alien
Member
Joined
Aug 25, 2019
Messages
9
Reaction score
6
First Language
Portuguese(Bra)
Primarily Uses
RMVXA
You can try entering this into the damage formula of the skill.

a.add_state(id); a.atk * 4 - b.def * 2

And then enter the number of the state into id.

but I think it adds the state after the attack...
This will help with somethings else, thank you!


Create a variable (Lets call it "Hyped Up") that rolls from 1 to 3 everytime the actor uses the skill "atack" and on 1 you put to trigger the "Hyped up" state and on 2 and 3 you put nothing. Now you have a way of doing it...the difficult is triggering this mid battle.

Create a battle event (on troops) with a conditional branc. The conditional branch must be "If charachter has "Thunder Force". Then you put the variable up, with another conditional branch for each random number...it should be something like this:

Conditional Branch: [charachter] is Thunder force aflicted:
---@>Control Variables:[Hyped Up] = Random (1...3)
-----@> Conditional Branch: Variable [ThunderForce] ==1
-----@> Change State [Charachter] + [Hyped Up]
-----@> Control Variables: [Hyped Up] =0 (Trust me...if you don't do this, you can be stuck on a loop)

On Variables 2 and 3 just put "@> Control Variables: [Hyped Up] =0"

And there you go...you got this...but only on one troop...thats where scripting comes into place...I recomend Base troop Events by Yanfly so you just need to put this on the first Troop slot and this will repeat trhough all battles...I hope this is what you wanted...and good night



Edit: Sorry...it just ocurred to me that I forgot to make it trigger by an atack...do all of this on a common event and make a normal atack call the event...you don't need to put this on troops if you do this.

Tested it out, instead of making a different If clause for each random number, I put the "Control Variables [Hyped Up] = 0 " on the Else clause, I think this works out, no loops happened, except 1/3 was too much because it triggered up to 4 times in a row (not always). thank you very much!

Edit: just noticed I had Action Times+ on the Thunder force state, that's why it was triggering lots of times in a row.
 

Latest Threads

Latest Posts

Latest Profile Posts

Newbie, please be gentle
reworkMZ.png
To keep myself motivated to make the MZ SF tiles normal and usable modern tiles I like to make tiny maps and toggle between the options :3
Character selection in games be like
Special Tractor Operation! :kaojoy:
Current status screens for Shadows of the Earth: The Vrila'an Legend. Need to do something about the color scheme lol
Captura de pantalla (259).pngCaptura de pantalla (260).png

Forum statistics

Threads
122,083
Messages
1,146,341
Members
160,368
Latest member
slotgacorunsurtoto
Top