Formulating effects

1st of all, sorry for my bad english

and 2nd i hope i post on the right part of the forum

Hey guys i need help on formulating some formula. i have the concept of the formula but i dont know how to implement

~Concept 01. Target:ENEMY ---skill name: ????

if actor 'X' is in the party then

   if actor 'X' is in the state'A' then

        target will receive (a.agi + actor'X' 's def) - b.def

    else if actor x is in the state'B' then

        target will receive  (a.agi + actor'X' 's atk) -b.def

    else

         target will receive (a.agi) - b.def

~Concept 02 Target:SELF ---skill name: Rage

    if 'user' is in the state'A' then

          remove state'A' and add state'B'

      else if 'user' is in the state'B' then

          remove state'B' and add state'C'

      else if 'user is in the state'C' then

          remove state'C' and add state'D'

      else

          add state'A'

~Concept 03 Target:SELF(maybe) --skill name: Call spirit

   if game.variable'X' is > 5 then

          game.variable'X' + 0

     else 

          game.variable'X' + 1

~Concept 04 Target:ENEMY --skill name: Asura Strike

   if game.variable'X' is = 5 then

       target will receive (game.variable'X' *(a.atk+a.matk) - b.def

                            and game.variable'X' = 0

   else if game.variable'X' is = 4 then

       target will receive (game.variable'X' *(a.atk+a.matk) - b.def

                            and game.variable'X' = 0

   else if game.variable'X' is = 3 then

       target will receive (game.variable'X' *(a.atk+a.matk) - b.def

                            and game.variable'X' = 0

   else if game.variable'X' is = 2 then

       target will receive (game.variable'X' *(a.atk+a.matk) - b.def

                            and game.variable'X' = 0

   else if game.variable'X' is = 1 then

       target will receive (game.variable'X' *(a.atk+a.matk) - b.def

                            and game.variable'X' = 0

   else

       target will receive NOTHING

~Concept 05 Target: ALL ALLY ---skill name: Guardian's  Grace

    if party.size is >= 4

        10% of the each ally's maxhp will heal

    else if party.size = 3

         14% of the each ally's maxhp will heal

    else if party.size = 2

         19% of the each ally's maxhp will heal

    else if party.size = 1

         28% of the each ally's maxhp will heal

~Concept 06 Target: EVERYONE (is this possible?) ---skill name: ???

    if the target is ally then

          damage become heal (a.matk/2)

    else 

          damage is = to (a.matk*2-b.def)

~Concept 07 Target: ENEMY ---skill name: Thief's luck  

                   random.a(0...25)

                    random.b(0...25) 

                    random.c(0...25)

                   random.d(0...25)

      damage is = to random.a + random.b +random.c +random d +a.atk - b.def

~Concept 08 Target: ENEMY ---skill name: Coin Barrage

     if Gold is <= 100 then

          damage is = to 0

     else 

          Gold - 100

         and Damage is = to 100*(a.atk/50)

~Concept 09 Target: ENEMY --skill name: Electric discharge

     game.varible'x' +1

      if game.varible'x' is = to 3 then

            {

            game.varible - 3,

            random.a(1...3)

                if random.a = 3 then

                     { 

                     damage = a.matk*1.5*3 - b.mdef

                      'user's' current hp - damage/10

                      }

                else

             else

              damage = a.matk*1.5 - b.mdef 

               'user's' current hp - damage/10

           }

                                                                                                             ..THANK YOU!...

to all who will answer. please explain a little bit :")
Several of those concepts are possible by making the skill call a common event and then copy your concept logic into that common event.

In those cases where you want to change the damage amount, you'll just have to change those concept logics into a ruby code and place that code into the damage formula field - there is a topic with on how to use the damage formula for more complex checks and changes.

Just search for "damage formula" on the forum - sorry my links are on another computer, can't point you to them at the moment.
Several of those concepts are possible by making the skill call a common event and then copy your concept logic into that common event.

In those cases where you want to change the damage amount, you'll just have to change those concept logics into a ruby code and place that code into the damage formula field - there is a topic with on how to use the damage formula for more complex checks and changes.

Just search for "damage formula" on the forum - sorry my links are on another computer, can't point you to them at the moment.
I mean i dont know how to express those concept into ruby codes? Btw thank you for the reply.
Here's a Damage Formula code options tutorial by Fomar.

http://cobbtocs.co.uk/wp/?p=271

It explains things like how to use condition true/false, else/if, checking attacker/defender IDs, random numbers, add/remove states/buffs, and a bunch of things. All in the damage formula. (Note that the damage formula box is limited to 100 characters only. You need a script to pass the 100 char limit)
yes, the formula box is limited.

so how will i make the Concept 1,2,4 and 9?

i there any tutorial for making script formula. i just visit fomar's blog, and i think it a little bit complicated

sorry i am new in ruby. I know java and C++ but ruby is very far! T_T
yes, the formula box is limited.

so how will i make the Concept 1,2,4 and 9?

i there any tutorial for making script formula. i just visit fomar's blog, and i think it a little bit complicated

sorry i am new in ruby. I know java and C++ but ruby is very far! T_T
Eventing isn't ruby, and several of your concepts are done by eventing.

I suggest that you just start making the common event for concept 2 by placing exactly that logic into a common event in the database, and then have a skill call that common event.

In other cases your concept's logic is unneccessarily complex. For concept 4 for example you don't need any conditional branches, because the damage formula is identical in all branches.

You might have to limit that if X can become higher than 5, but otherwise you only have to make sure that the damage value is the last value by a construct like the following:

dmg = [your damage formula]; $game_variable[X] = 0; dmg

Or in other words: stop thinking in circles how difficult a language might be and start by working on the events, as you only have a limited number of commands in the events anyway...
last question.

how about the concept 2? i will use common event?
last question.

how about the concept 2? i will use common event?
Yes, you need to as a skill can only call a common event - troop events or map events can't be called (unless you get really tricky with scripts and switches, but that wouldn't help here).

However, if you have more than one actor that can use the skill, you'll have to add logic for identifying the skill user as regularly the call for a common event doesn't transfer any data to that event.

Usually in those change-state-skills that isn't the case as those states usually represent special abilities of a special actor, but if that skill can be used by several actors then you need another temporary state that's added as part of the damage formula, have the common event check which actor has that state and then remove it and change that actor's other states.

Edit:

Alternatively you can store the skill user's ID into a variable by the damage formula and use that variable instead of a state
for example i have this on the script editor..

class Game_Battler < Game_BattlerBase

  def custom_formula_fireball(a, 😎

    if a.state?(12);(a.add_state(12) + a.add_state(9)); else; 0;end;

  end

 

end

 

how will i call it? 

i will use common event that can call the custom_formula_fireball after that? how will i call the common event? $game_commonevent[X]????

 

your answer is very helpful :") thank you
you do not use the script editor for damage formulas, you place the formula inside the damage formula field of the skill in the database.

you call a common event by using the "call common event" feature for the skill in the database.

NOTHING you placed here requires you to open the script editor to do it. Most of the things can even be done without typing into the keyboard, but just using the mouse and clicking on the buttons provided by the editor.

That's why I said to just start making the common event in the database - most of your questions will be answered by just seeing the buttons available in the editor.

Just remember one thing: If you open the script editor while trying to implement the concepts described above, then you're probably already at the wrong place.
Thank you :") 

request for close topic. 
This thread is being closed, due to being solved. If for some reason you would like this thread re-opened, please report this post and leave a message why. Thank you.


Please use the report button for requests to close/open topics, no need to make extra posts.

Original thread: https://forums.rpgmakerweb.com/threads/formulating-effects.16426/