New here at RGSS3 (Ace).

Jachan

Veteran
Veteran
Joined
May 23, 2015
Messages
94
Reaction score
4
First Language
Sign Language
Primarily Uses
RMMV
Bgillisp suggested me to post a new topic instead to derail.

Is that how we write this way? I mean to form the final formula with multiple totals from few previous formulas? Like this?

Base1 = form the formula of hero's attack power here

Base2 = form the formula of enemy's defense power here

Base3 = some formulas that could be useful of special effects (like, boosted damage if slime-type, for example)

Total = Base1 * Base3 - Base2

Right? if so, then it's alright to create some unexisted results (Base#) until hit the final result (Total)? I want to know it, so I don't have to form the whole in just one line (one whole formula with many parentheses that could make you lost the counts).

If there is any important tip for me to understand (like, do not input the certain sign in it ( +=, -=, =) or something), i would like to know this too. Thanks.

I could want to study RGSS3 but i just want to complete my big project here as quick as possible is all. I never had completed any single project I have made because I am too lazy, XD

Anyway... Is it possible for me to create the multiple formulas before the finalization damage to deal against the target?
 
Joined
Jan 23, 2014
Messages
161
Reaction score
19
First Language
English
Here's some code to get you started

You'll need to insert this into your scripts Below Materials but Above Main


class Game_Battler < Game_BattlerBase

#Time to define some custom damage

def custom_damage_boost_def(a,b,boost)
base1 = a.atk * 4
base2 = b.def * 2

damage = (base1 * boost) - base2

return damage
end

def custom_damage_boost(a,
base1 = a.atk * 4
base2 = b.def * 2
boost = a*luk * 3
damage = (base1 * boost) - base2

return damage
end

end 
Now in your skill formula you can now write "a.custom_damage_boost_def(a,b,num)"*

or "a.custom_damage_boost(a,b)" up to you!

*Num is whatever you want it to be, an integer or a stat

Another good reference that helped me a lot is here:  http://cobbtocs.co.uk/wp/?p=271

Good luck!
 

Jachan

Veteran
Veteran
Joined
May 23, 2015
Messages
94
Reaction score
4
First Language
Sign Language
Primarily Uses
RMMV
Yes, I see it. Thanks again!

*look through that link* Oh wow! Thanks a lot! :D

Can I bother to ask you one tiny thing? What's the big difference between += and =? I did looked across some lunatic scripts Yanfly made and found += while you suggested = instead... So I am little confused to compare between those...
 
Joined
Jan 23, 2014
Messages
161
Reaction score
19
First Language
English
Yes, I see it. Thanks again!

*look through that link* Oh wow! Thanks a lot! :D

Can I bother to ask you one tiny thing? What's the big difference between += and =? I did looked across some lunatic scripts Yanfly made and found += while you suggested = instead... So I am little confused to compare between those...
For example: damage += boost means this: damage = damage + boost 

I'm not sure, what =? means.
 

dungeon diver

[ TRASH ELEMENTAL ]
Veteran
Joined
May 11, 2015
Messages
56
Reaction score
13
First Language
English
Primarily Uses
Yes, I see it. Thanks again!

*look through that link* Oh wow! Thanks a lot! :D

Can I bother to ask you one tiny thing? What's the big difference between += and =? I did looked across some lunatic scripts Yanfly made and found += while you suggested = instead... So I am little confused to compare between those...
= is an assignment, while += is an assignment with an operation included.

Say x is initialized as 4.

x = 2 would return x as 2.

x += 2 would return x as 6, because before being assigned the value of 2 is added to x's value. Since 4+2=6, this returns 6.
 

Jachan

Veteran
Veteran
Joined
May 23, 2015
Messages
94
Reaction score
4
First Language
Sign Language
Primarily Uses
RMMV
Purple, i didn't mean this =?, hahaha. I mean = itself with a question mark as a signal of the end of my question. XD

Ah okay.

Diver, oh i see! Thanks!

So, I just saw one new as -=... since Diver gave the example, I would say that it will return as 2 instead 6, as to subtract / reduce instead to add / boost, right?

Come to thought, I did skipped this one... what does this one do? ==, a double =...? not "=?", lol
 

dungeon diver

[ TRASH ELEMENTAL ]
Veteran
Joined
May 11, 2015
Messages
56
Reaction score
13
First Language
English
Primarily Uses
Purple, i didn't mean this =?, hahaha. I mean = itself with a question mark as a signal of the end of my question. XD

Ah okay.

Diver, oh i see! Thanks!

So, I just saw one new as -=... since Diver gave the example, I would say that it will return as 2 instead 6, as to subtract / reduce instead to add / boost, right?

Come to thought, I did skipped this one... what does this one do? ==, a double =...? not "=?", lol
== is used to compare instead of assign, usually in a conditional or loop.

I forget how ruby handles it exactly (if it brings up an error or goes ahead with the syntax) but "if x=3", for example, leads to a logical error because instead of comparing x to 3 the interpreter assigns 3 to the variable x.
 

Jachan

Veteran
Veteran
Joined
May 23, 2015
Messages
94
Reaction score
4
First Language
Sign Language
Primarily Uses
RMMV
so... single = will be used on non-loop / non-conditional either while double will be used instead?
 

Jachan

Veteran
Veteran
Joined
May 23, 2015
Messages
94
Reaction score
4
First Language
Sign Language
Primarily Uses
RMMV
Bump...

Am I correct... or incorrect? .__."
 

♥SOURCE♥

Too sexy for your party.
Veteran
Joined
Mar 14, 2012
Messages
693
Reaction score
411
Primarily Uses
Hello!

Double equal sign (==) is always used to compare, while single equal sign (=) is always used to assign:

Code:
x = 2if x == 2  p 'x is 2'end
 

Jachan

Veteran
Veteran
Joined
May 23, 2015
Messages
94
Reaction score
4
First Language
Sign Language
Primarily Uses
RMMV
Oh I think I get you... single = is like... overwriting the variable while double = is to check and see if it's equal to the non-variable number or not, without overwriting it. If so, then yeah I get you! I already wrote that kind of coding in different language which is very often. XP
 

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

Latest Threads

Latest Posts

Latest Profile Posts

Couple hours of work. Might use in my game as a secret find or something. Not sure. Fancy though no? :D
Holy stink, where have I been? Well, I started my temporary job this week. So less time to spend on game design... :(
Cartoonier cloud cover that better fits the art style, as well as (slightly) improved blending/fading... fading clouds when there are larger patterns is still somewhat abrupt for some reason.
Do you Find Tilesetting or Looking for Tilesets/Plugins more fun? Personally I like making my tileset for my Game (Cretaceous Park TM) xD
How many parameters is 'too many'??

Forum statistics

Threads
105,865
Messages
1,017,059
Members
137,575
Latest member
akekaphol101
Top