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

#### Jihanger

##### Psychotic Alien
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
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
For the other effects a script might be needed.

#### Binder28

##### Veteran
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
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 Profile Posts

>Wake up in the night
>Can't sleep
>Draw little freak
>Come up with pancake based puns for attacks
>Back to bed
UHHHHH. What is this and how did someone find my game on here?

my game has distinct areas where travel through what are known as "battle stations" these are more or less areas to explore and fight. occasionally, you'll stumble across secret rooms with sidequests ready to be taken. this area is in the high school attic of all places... but how do ya get there is the question.
Redoing my intro scene for the 10 millionth time is pain
So this flat Earther named Mike Hughes build his own rocket to prove that the Earth was flat. But on liftoff he still had the ladder he climbed up to the rocket laying against it. Needless to say things didn't go as planned.