Help with Battle Mechanics

gokuby

Veteran
Veteran
Joined
Nov 2, 2015
Messages
96
Reaction score
14
First Language
German
Primarily Uses
N/A
Heyho guys, after unfortiantly loosing my first project, I decided to give it an other try and revamped it, now I decided to add some mechanics and features, which were unavaible at the time I was finished with that part.

So, I need your help with 2problems, one is about the plugin YEP_RowFormation and the next one is about a bleeding state wich ramps up in damage and an execute skill, which will do more damage, the longer the targed has been bleeding.

1. Row formation:

I'm currently using 4 rows, now I want to give the first row taunt, and when all battlers in row 1 die, row 2 gets taunt and so on...

How I've tried it:

<Physical Taunt><Custom Row Condition>if ($gameTroop.rowAliveSize(1) = 0) { condition = true; } else if ($gameParty.rowAliveSize(1) = 0){ condition = true; } else condition = false; </Custom Row Condition>2. Bleeding/Execute:

Now that one will be tricky I guess, the bleeding state should do more damage every round AND the counter should be resetted when the state expires(is removed), NOT when the state is reapplied.

The number of turns should then be useable for the damage calculation of a skill.

I used Yanflys toxic state tutorial as a basis and adjusted the code.

my first attempt:

<Custom Apply Effect>if ($gameVariables.value(1) < 1) { $gameVariables.value(1) = 1; }</Custom Apply Effect><Custom Regenerate Effect>$gameVariables.value(1) += 1;var x = $gameVariables.value(1);var value = Math.floor(x*user.mhp*0.05*50/(100+user.def)*-1);user.gainHp(value);</Custom Regenerate Effect><Custom Remove Effect>$gameVariables.value(1) = 1;</Custom Remove Effect>Since states can be applied to multiple targets, this will be impossible to work out I guess.

Second try:

<Custom Apply Effect>if (this._bleedTurn <= 1) { this._bleedTurn = 1;</Custom Apply Effect><Custom Regenerate Effect>var x = this._bleedTurn;var value = Math.floor(x*user.mhp*0.05*50/(100+user.def)*-1);user.gainHp(value);this._bleedTurn += 1;</Custom Regenerate Effect><Custom Remove Effect>this._bleedTurn = 1;</Custom Remove Effect>Not working as well, also "this._bleedTurn" won't be able to affect something else than this state, or?

The skill would simply look like this:

Code:
<damage formula>var y = $gameVariables.value(1)value = a.atk * y</damage formula>
 

kiriseo

Veteran
Veteran
Joined
Oct 27, 2015
Messages
229
Reaction score
74
First Language
German
It's late here, so I just leave some things here for now.

When I've got enough sleep and nobody else already answered your questions, I'll look through your code again.

$gameTroop.rowAliveSize(1) = 0When you want to compare two values, never use one equals sign.

With only one, it will not compare the values.

In this case, js tries to set $gameTroop.romAliveSize(1) to 0

Instead use

$gameTroop.rowAliveSize(1) == 0Regarding your Bleed state

For your first approach:

<Custom Apply Effect>if ($gameVariables.value(1) < 1) { $gameVariables.value(1) = 1; // That won't work. To assign a value to a $gameVariable you have to use } // $gameVariables.setValue(variableID, value)</Custom Apply Effect><Custom Regenerate Effect>$gameVariables.value(1) += 1;var x = $gameVariables.value(1);var value = Math.floor(x*user.mhp*0.05*50/(100+user.def)*-1);user.gainHp(value);</Custom Regenerate Effect><Custom Remove Effect>$gameVariables.value(1) = 1; // Here the same as above</Custom Remove Effect>Your second approach

Code:
<Custom Apply Effect>if (this._bleedTurn <= 1) { this._bleedTurn = 1;} // Don't forget to close every bracket/parenthesis you're opening.</Custom Apply Effect><Custom Regenerate Effect>var x = this._bleedTurn;var value =  Math.floor(x*user.mhp*0.05*50/(100+user.def)*-1);user.gainHp(value);this._bleedTurn += 1;</Custom Regenerate Effect><Custom Remove Effect>this._bleedTurn = 1;</Custom Remove Effect>
 
Last edited by a moderator:

gokuby

Veteran
Veteran
Joined
Nov 2, 2015
Messages
96
Reaction score
14
First Language
German
Primarily Uses
N/A
Firstly, thanks for your helpful respond ;)

The row system is now working as intended.

The bleed state however doesn't work at all:

I edited my first try, and it's still the same error as usual, probably cause of the

if ($gameVariables.value(1) < 1) {...}
Code:
ReferenceErrorInvalid left-hand side in assignment
The branked in my second attempt was probably just lost during copy/pasting, there the state does 0 damage and the enemie becomes unkillable.
 

kiriseo

Veteran
Veteran
Joined
Oct 27, 2015
Messages
229
Reaction score
74
First Language
German
Firstly, thanks for your helpful respond ;)

The row system is now working as intended.

The bleed state however doesn't work at all:

I edited my first try, and it's still the same error as usual, probably cause of the

if ($gameVariables.value(1) < 1) {...}
Code:
ReferenceErrorInvalid left-hand side in assignment
The branked in my second attempt was probably just lost during copy/pasting, there the state does 0 damage and the enemie becomes unkillable.
if ($gameVariables.value(1) < 1) {...}That isn't the cause for the error you'r receiving.

Here is the edited version I have currently on my test project that is working.

<Custom Apply Effect>if ($gameVariables.value(1) < 1) { $gameVariables.setValue(1, 1);} </Custom Apply Effect><Custom Regenerate Effect>$gameVariables.setValue(1, $gameVariables.value(1) + 1);var x = $gameVariables.value(1);var value = Math.floor(x*user.mhp*0.05*50/(100+user.def)*-1);user.gainHp(value);</Custom Regenerate Effect><Custom Remove Effect>$gameVariables.setValue(1, 1);</Custom Remove Effect>The only problem you'll get with this approach; If you use the state for another target while it is still active on the first target, the variable count goes up for both.

And when the state goes off on one enemy, the counter will reset, too.
 
Last edited by a moderator:

gokuby

Veteran
Veteran
Joined
Nov 2, 2015
Messages
96
Reaction score
14
First Language
German
Primarily Uses
N/A
jup, works, thanks, thats a huge step to the finished system.

I wonder if the problem could be solved by combining my two approaches, I need one locale variable(to find out if the enemie/battler has already been affected by the state and to keep the global variables apart) and global variables(for the turn count and identification).

Edit: I did it only for maximum three affectable targets, cause of space and clarity reasons, the concept would allow unlimited(or in my case 14) targets

<Custom Apply Effect>if (this._Bleeding <= 1) { if ($gameVariables.value(1) == 0) { $gameVariables.setValue(1, 1); this._Bleeding = 1; } else if ($gameVariables.value(2) == 0) { $gameVariables.setValue(2, 1); this._Bleeding = 2; } else if ($gameVariables.value(3) == 0) { $gameVariables.setValue(3, 1) this._Bleeding = 3; } #and so on...}</Custom Apply Effect><Custom Regenerate Effect> if (this._Bleeding == 1) { $gameVariables.setValue(1, $gameVariables.value(1) + 1); var x = $gameVariables.value(1); this._Bleeding += 1; } else if (this._Bleeding == 2) { $gameVariables.setValue(2, $gameVariables.value(2) + 1); var x = $gameVariables.value(2); this._Bleeding += 1; } else if (this._Bleeding == 3) { $gameVariables.setValue(3, $gameVariables.value(3) + 1); var x = $gameVariables.value(3); } var value = Math.floor(x*user.mhp*0.05*50/(100+user.def)*-1);user.gainHp(value);</Custom Regenerate Effect><Custom Remove Effect>if (this._Bleeding == 1) { $gameVariables.setValue(1, 0); } else if (this._Bleeding == 2) { $gameVariables.setValue(2, 0); } else if (this._Bleeding == 3) { $gameVariables.setValue(3, 0) }this._Bleeding = 0</Custom Remove Effect>there is still an error(possibly many more;D) in there, but would something like that work?
 
Last edited by a moderator:

kiriseo

Veteran
Veteran
Joined
Oct 27, 2015
Messages
229
Reaction score
74
First Language
German
 
there is still an error(possibly many more;D) in there, but would something like that work?
I had no (syntax) error, but there were two problems.

if (this._Bleeding <= 1) { ...}will return false, 'cause you never initialized _Bleeding.

So it will be undefined

Instead use:

if (!this._Bleeding || this._Bleeding < 1) {...}Now the code inside the brackets will be used even if _Bleeding is undfined.

The second Problem I encountered; when I tested it with only two enemies, $gameVariables #3 also got set to 1.

But I found a much simpler approach.

Instead of using $gameVariables, this approach gives the targeted enemy a _BleedTurn variable.

You can then use that variable for the damage formula tag for your Execute skill.

This is the Bleed State:

<Custom Apply Effect>if (!user._BleedTurn || user._BleedTurn < 1) {user._BleedTurn = 1;}</Custom Apply Effect><Custom Regenerate Effect>var x = user._BleedTurn;var value = Math.floor(x*user.mhp*0.05*50/(100+user.def)*-1);user.gainHp(value);user._BleedTurn += 1;</Custom Regenerate Effect><Custom Remove Effect>user._BleedTurn = 0;</Custom Remove Effect>Note: user is the actor/enemy that has the state, as you can see in your formula for the damage value here.

This is the Execute skill:

<damage formula>var y = target.isStateAffected(11) ? target._BleedTurn : 0; // You have to replace the 11 with the ID of your Bleed State.value = a.atk * y</damage formula>I made this so that the skill does the 0 damage if the target is not affected by my Bleed State (ID 11).

Else the damage is atk * the bleed turn of the target
 
Last edited by a moderator:

gokuby

Veteran
Veteran
Joined
Nov 2, 2015
Messages
96
Reaction score
14
First Language
German
Primarily Uses
N/A
Awesome, works perfect, thank you very much!

Does the ": 0" mean, set to zero if state 11 is not affected?

And would it be possible to do something like "all._BleedTurn" that counts every variable together?

I had something like that in mind:

if (enemie.isStateAffected(7){ if (all._BleedTurn > 1 && all._BleedTurn < 5) { $gameActors.actor(6).addState(201); } else if (all._BleedTurn >= 5 && all._BleedTurn < 10) { $gameActors.actor(6).addState(202); } else if (all._BleedTurn >= 10) { $gameActors.actor(6).addState(203); }}Last question to this topic, I'm sorry for bothering you, is there a way to set the state "regeneration" based on the stats of the caster?

Edit: Got it:

Code:
<Custom Regenerate Effect>var value = Math.floor(origin.atk * 3);user.gainHp(value);</Custom Regenerate Effect>
 
Last edited by a moderator:

kiriseo

Veteran
Veteran
Joined
Oct 27, 2015
Messages
229
Reaction score
74
First Language
German
Awesome, works perfect, thank you very much!

Does the ": 0" mean, set to zero if state 11 is not affected?
Exactly that.

This

var y = target.isStateAffected(11) ? target._BleedTurn : 0;is like

var y;if (target.isStateAffected(11)) {y = 1;} else {y = 0;}
And would it be possible to do something like "all._BleedTurn" that counts every variable together?
I had something like that in mind:

if (enemie.isStateAffected(7){ if (all._BleedTurn > 1 && all._BleedTurn < 5) { $gameActors.actor(6).addState(201); } else if (all._BleedTurn >= 5 && all._BleedTurn < 10) { $gameActors.actor(6).addState(202); } else if (all._BleedTurn >= 10) { $gameActors.actor(6).addState(203); }}
A few questions.

You want to give an Actor a specific state in relation to the _BleedTurn of every enemy?

And where do you want that code? In the Bleed State? Or another skill?
 
Last edited by a moderator:

gokuby

Veteran
Veteran
Joined
Nov 2, 2015
Messages
96
Reaction score
14
First Language
German
Primarily Uses
N/A
Thats correct, I would like to integrade the code into the bleed state, so it's like a continual changing passive.
 

kiriseo

Veteran
Veteran
Joined
Oct 27, 2015
Messages
229
Reaction score
74
First Language
German
Ok.

The Bleed State changes the passive with every occurence of the <Custom Regenerate Effect> ?

I found a solution for a problem I had with my first idea in here :

http://forums.rpgmakerweb.com/index.php?/topic/54603-end-of-battle-events/

For the approach I have in mind, you can use a $gameVariable.

For this to work, you'll also need Yanflys BaseTroopEvent Plugin.

For that plugin, use the default parameter



Now create a Common Event like this one here



For the next step add this to the first troop's Battle Event.



Now, every troop you'll create in the future will have this event.

For your Bleed State, I have this:

Code:
<Custom Apply Effect>if (!user._BleedTurn || user._BleedTurn < 1) {  user._BleedTurn = 1;  $gameVariables.setValue(1, $gameVariables.value(1) + 1);}</Custom Apply Effect><Custom Regenerate Effect>var x = user._BleedTurn;var value =  Math.floor(x*user.mhp*0.05*50/(100+user.def)*-1);user.gainHp(value);user._BleedTurn += 1;var gVariable = $gameVariables.value(1);if (gVariable > 1 && gVariable < 5) { $gameActors.actor(6).addState(201);}else if (gVariable >= 5 && gVariable < 10) { $gameActors.actor(6).addState(202);}else if (gVariable >= 10) { $gameActors.actor(6).addState(203);}$gameVariables.setValue(1, gVariable + 1);</Custom Regenerate Effect><Custom Remove Effect>user._BleedTurn = 0;</Custom Remove Effect>
 

gokuby

Veteran
Veteran
Joined
Nov 2, 2015
Messages
96
Reaction score
14
First Language
German
Primarily Uses
N/A
This won't be needed, since I will make the actor lose the "stacks" he gained from that enemie, if it stops bleeding. The berserker will be a fairly difficult class to play, so the player should be punished, if he/she isn't able to count ;D

Tested it several times now, the variable will be set to 0 after battle.

This is the state now (of cause it isn't balanced atm):

<Custom Apply Effect>if (!user._BleedTurn || user._BleedTurn < 1) {user._BleedTurn = 1;}</Custom Apply Effect><Custom Regenerate Effect>var x = user._BleedTurn;var value = Math.min(origin.atk, Math.floor(x*0.2*origin.atk*100/(100+user.def)*-1));user.gainHp(value);user._BleedTurn += 1;$gameVariables.setValue(121, $gameVariables.value(121) + 1);var gVariable = $gameVariables.value(121);if (gVariable < 1) {$gameActors.actor(5).removeState(201);$gameActors.actor(5).removeState(202);$gameActors.actor(5).removeState(203);}else if (gVariable > 1 && gVariable < 5) {$gameActors.actor(5).addState(201);$gameActors.actor(5).removeState(202);$gameActors.actor(5).removeState(203);}else if (gVariable >= 5 && gVariable < 10) {$gameActors.actor(5).addState(202);$gameActors.actor(5).removeState(201);$gameActors.actor(5).removeState(203);}else if (gVariable >= 10) {$gameActors.actor(5).addState(203);$gameActors.actor(5).removeState(201);$gameActors.actor(5).removeState(202);}</Custom Regenerate Effect><Custom Remove Effect>$gameVariables.setValue(121, $gameVariables.value(121) + 1 - user._BleedTurn);user._BleedTurn = 0;var gVariable = $gameVariables.value(121);if (gVariable < 1) {$gameActors.actor(5).removeState(201);$gameActors.actor(5).removeState(202);$gameActors.actor(5).removeState(203);}else if (gVariable > 1 && gVariable < 5) {$gameActors.actor(5).addState(201);$gameActors.actor(5).removeState(202);$gameActors.actor(5).removeState(203);}else if (gVariable >= 5 && gVariable < 10) {$gameActors.actor(5).addState(202);$gameActors.actor(5).removeState(201);$gameActors.actor(5).removeState(203);}else if (gVariable >= 10) {$gameActors.actor(5).addState(203);$gameActors.actor(5).removeState(201);$gameActors.actor(5).removeState(202);}</Custom Remove Effect>By the way, wouldn't it be much easier to do this?

Bleed.png

This should be it.

Thanks for your help with my class concept and for showing me some JavaScript ;)

By the way, can you recommend a way to learn JavaScript(literature, program, tutorial)?
 
Last edited by a moderator:

kiriseo

Veteran
Veteran
Joined
Oct 27, 2015
Messages
229
Reaction score
74
First Language
German
This won't be needed, since I will make the actor lose the "stacks" he gained from that enemie, if it stops bleeding.
Well, that is a piece of info that you should've told beforehand :p

By the way, wouldn't it be much easier to do this?

Bleed.png
That depends on what else you want to do with the All_Bleeding variable besides that.

With the Common Event approach, you can also do other things you want to happen after every fight.

By the way, can you recommend a way to learn JavaScript(literature, program, tutorial)?
I would suggest that you look through the Javascript Learning section in this forum.

There you'll find threads like this. I'll recommend the sites under Beginners Guide to Javascript.

If you want to write your own scripts, there are also tutorials on youtube.

Like Janrae Mendoza's or SumRndmDde's.
 
Last edited by a moderator:

gokuby

Veteran
Veteran
Joined
Nov 2, 2015
Messages
96
Reaction score
14
First Language
German
Primarily Uses
N/A
Well, that is a piece of info that you should've told beforehand  :p
Yeah, sorry^^

Wasn't 100% sure, how I will handle this, so I just left it open.

Writing own scripts will come later eventually, for now I just want to utilize the lunatic mode on my own,

since there is a lot of work to remain to be done, and I don't want to flood the forum with requests^^
 

Users Who Are Viewing This Thread (Users: 0, Guests: 1)

Latest Threads

Latest Posts

Latest Profile Posts

Who loves the Final Fantasy series?~
Weather and time system twin release. Now with weather icons and possibility to add them in your custom clock!
Kingdom Under Fire: The Crusaders is finally being ported to PC. I loved playing that game on the original Xbox.
A friend told me to stop making nomnom or gulping noise when eating or drinking. Plot twist of my life. I thought people can't hear that!

Forum statistics

Threads
94,411
Messages
920,758
Members
124,207
Latest member
AshleyBrowney
Top