# 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

I've got good news and bad news. The good news is, there aren't any bad news to report. The bad news is, there aren't any good news to report.

Or as others say, yesterday was uneventful.

I am curious that can you "understand/get the point" about what does this place do generally?
(ARPG game)
If anyone knows any C# programmers, please send them my way.
Chilling at night in a tavern.

After 'multiple breakdowns', it's finally over. 10/10 will do this again.
Ever notice that villains can reform and become better people, but heroes can only ever die... or live long enough to see themselves become villains?

Isn't that interesting?