different damage with different weapon-types

freebooter

Veteran
Veteran
Joined
Oct 20, 2017
Messages
104
Reaction score
5
First Language
German
Primarily Uses
RMMV
Hey guys,
I would like to implement the following: I have 3 different kinds of weapon: hit, cut, pierce. Depending on the enemy and the weapon-type the actor uses, the damage should vary.

For example: If the actor attacks an Orc with a pierce weapon he makes normal damage. But if he attacks with the same pierce weapon a skeleton, he makes less damage because pierce is not the optimal weapon against skeletons.

I know that there are many parameters to set in the skills and weapon-tabs. Maybe there is an easy way to implement my idea. But as a noob I just cannot figure it out.

Thanks for your help!
 

MMMm

Veteran
Veteran
Joined
Dec 23, 2016
Messages
410
Reaction score
374
Primarily Uses
N/A
Create three new elements in your project under the types menu. Then assign your new elements to weapons. Then give resistances or weaknesses to these elements to your enemies.
 

gstv87

Veteran
Veteran
Joined
Oct 20, 2015
Messages
2,186
Reaction score
1,162
First Language
Spanish
Primarily Uses
RMVXA
that's exactly the same scheme I have.
pierce does less damage against skeletons (because, bones), golems (because, armor) and magic creatures (because, aether)

you should not only make specific weapon types, but also specific enemy types, such as basic humanoid, basic undead, basic golem, etc.... so that they all share the same resistances and bonus, and when creating new enemies you just copy the properties over from other enemies of the same class.
that way, the players will learn that the same weapon has the same effect against the same enemy type.
 

freebooter

Veteran
Veteran
Joined
Oct 20, 2017
Messages
104
Reaction score
5
First Language
German
Primarily Uses
RMMV
Create three new elements in your project under the types menu. Then assign your new elements to weapons. Then give resistances or weaknesses to these elements to your enemies.
Thanks for your quick answer!
 

freebooter

Veteran
Veteran
Joined
Oct 20, 2017
Messages
104
Reaction score
5
First Language
German
Primarily Uses
RMMV
that's exactly the same scheme I have.
pierce does less damage against skeletons (because, bones), golems (because, armor) and magic creatures (because, aether)

you should not only make specific weapon types, but also specific enemy types, such as basic humanoid, basic undead, basic golem, etc.... so that they all share the same resistances and bonus, and when creating new enemies you just copy the properties over from other enemies of the same class.
that way, the players will learn that the same weapon has the same effect against the same enemy type.
Sounds like a good idea. How do you set an enemy type?
 

gstv87

Veteran
Veteran
Joined
Oct 20, 2015
Messages
2,186
Reaction score
1,162
First Language
Spanish
Primarily Uses
RMVXA
simply make a group of common features you'd want in a type of enemy, and keep them separated.
if you have to fix an enemy that's failing or doesn't quite fit into the gameplay, you always bring the common properties over, and edit accordingly.

basic undead, with standard resist/weakness and drops

nuevo-3.jpg

Generic Undead = basic undead + warrior & mage skills and exclusive drops.

nuevo-2.jpg

Skeleton Archer
Generic Undead minus knight skills & mage skills, plus, can't guard, armed with a bow, and uses archer skills.

nuevo-1.jpg

other undeads are armed differently, or yield more XP or drops.
my Generic enemies are also built into the gameplay, and they're a mix of mage and warrior.
it's a trick I picked up from the basic code: all events are characters and all characters are characterbase, but enemies are not players, and events are not battlers.
 
Last edited:

freebooter

Veteran
Veteran
Joined
Oct 20, 2017
Messages
104
Reaction score
5
First Language
German
Primarily Uses
RMMV
interesting, thanks for that.
 

SweetMeltyLove

Veteran
Veteran
Joined
May 4, 2015
Messages
113
Reaction score
155
First Language
English
Primarily Uses
RMVXA
@gstv87 You could make it even simpler if you use a passive states script (Yanfly has one). Then you just need to make states with the elemental affinities, like an Undead or a Bug state, and add it as a passive to the enemy. This way it's very easy to change numbers later, you only need to change the elements in one state, instead of finding every Undead enemy and changing one by one
 

gstv87

Veteran
Veteran
Joined
Oct 20, 2015
Messages
2,186
Reaction score
1,162
First Language
Spanish
Primarily Uses
RMVXA
I'm using a combination of passive states, custom code, and custom enemies for the whole thing.
it wouldn't just do with "add a plugin for it".

besides,.... I swore I'll never use yanfly.
everyone uses yanfly..... where's the fun on solving the problem if you're just pasting the solution in?
the game will be the same as everyone else's using the same solution.
and, I can list myself in the credits, as opposed to yanfly.
 

SweetMeltyLove

Veteran
Veteran
Joined
May 4, 2015
Messages
113
Reaction score
155
First Language
English
Primarily Uses
RMVXA
I'm using a combination of passive states, custom code, and custom enemies for the whole thing.
it wouldn't just do with "add a plugin for it".

besides,.... I swore I'll never use yanfly.
everyone uses yanfly..... where's the fun on solving the problem if you're just pasting the solution in?
the game will be the same as everyone else's using the same solution.
and, I can list myself in the credits, as opposed to yanfly.
I would if I had infinite time to make my game
 

freebooter

Veteran
Veteran
Joined
Oct 20, 2017
Messages
104
Reaction score
5
First Language
German
Primarily Uses
RMMV
Hi guys,
another question concerning the weapons. There is the basic attack-skill with the damage formula, which is used for each weapon. Each weapon the same damage formula. But I would like to distinguish between melee- and shooting-weapon. The damage formula of the first should be based on strength, the second formula on agi.
As I have no experience in scripting I have to ask: is there a way to put kind of "if" - "else" formula inside the damage formula, so that the formula is different for melee- and shooting weapons?
Thanks for your help!
 

gstv87

Veteran
Veteran
Joined
Oct 20, 2015
Messages
2,186
Reaction score
1,162
First Language
Spanish
Primarily Uses
RMVXA
there is a function that returns the default attack skill for everyone.
that's set for every battler (and, actor, indirectly)
you should make another function that would override that, based on actor ID.
it's not hard to do, but it might interfere with plugins if you do it without knowing.

I'll point you towards
Code:
Game_BattlerBase.prototype.attackSkillId = function() {
    return 1;
};
which means, "upon request of Attack ID, return 1" which means "point to skill n 1 of the skill list"
that's for everyone, enemies and friendlies.
if you make it return "whatever a notetag specifies", then you can customize that for every actor.
 

freebooter

Veteran
Veteran
Joined
Oct 20, 2017
Messages
104
Reaction score
5
First Language
German
Primarily Uses
RMMV
hm... I was thinking of something like to check the element type of the weapon:

IF element-type=gun OR element-type=bow THEN formula_1
IF element-type=slice OR element-type=hit THEN formula_2

Is there a way to do it something like that?
 

gstv87

Veteran
Veteran
Joined
Oct 20, 2015
Messages
2,186
Reaction score
1,162
First Language
Spanish
Primarily Uses
RMVXA
the formula length is limited, so depending on how many checks you need, it might not fit into the formula.
you can rig up a simple fix, by putting a call to a custom function in the formula itself, and use that function (which can be as large as you want) to decide what formula to use.
in that function, you can specify actorIDs, weapon types and whatever combination you want.

as long as you return one number that can be used by the skill formula, you're good.
 

freebooter

Veteran
Veteran
Joined
Oct 20, 2017
Messages
104
Reaction score
5
First Language
German
Primarily Uses
RMMV
ok, think I got it. Thanks!

As far as I know the space for damage formula in MV is quite large. So my formula should fit in. My formula no looks like that, but during game test the actor always deals 0 damage.

if (angriffselement=fernkampf or angriffselement=pulverwaffe) a.atk * (100/(100 + b.def)); else a.atk+100;

What is not clear to me is
1) how to deal with the variable "angriffselement". In English I think it's just "element". Do I need to use something like a $-sign?
2) is the syntax of the line correct?
3) does anybody know if "angriffselement" is the right name of the variable in German? Because in the tab "Weapon" it's called "angriffselement" but in the tab "Types" it's called "elemente".
 

gstv87

Veteran
Veteran
Joined
Oct 20, 2015
Messages
2,186
Reaction score
1,162
First Language
Spanish
Primarily Uses
RMVXA
I believe the elements are refered to as listOfElements[number] rather than by name.
also,
Code:
a.atk * (100 / (100 + b.def))
   20 * (100 / (100 + 155))
   20 * (100 / 255)  << 0.39 rounds to integer.
   20 * (0) << zero
try
a.atk * (100.0 / (100.0 + b.def))

100.0 would make both results Float numbers, and they'll consider the decimals.
whenever you have a division, make sure one of the operators is Float
 

freebooter

Veteran
Veteran
Joined
Oct 20, 2017
Messages
104
Reaction score
5
First Language
German
Primarily Uses
RMMV
Thanks for the hint with the decimals.
Do you know where I can look up the exact command for getting the element-type of a weapon?
 

gstv87

Veteran
Veteran
Joined
Oct 20, 2015
Messages
2,186
Reaction score
1,162
First Language
Spanish
Primarily Uses
RMVXA
do a broad search for elementId in rpg_objects
you'll see it often tied to item().damage since "damage" is also an object... backtrack from there.
it's hard to tell in MV, because items are all related to the database, which is modified by the editor, on the editor's side.
you can't see the call to database.tems.list[ID] because that's coded inside the editor.
you can only see the call to (item.damage) or (the collection of attack elements from weapons) which all refer to the database, which (from the game's point of view) is an established thing.
 

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

Latest Threads

Latest Posts

Latest Profile Posts

Husband has roped me into playing one of his PSO2 characters. Productivity is now negative.
Tileset A is lava! Don't burn D:
as MZ come out what you guys think about.....Some particles engine :3c?
Who wants to sing this song with me?~

Decided to submit my games to the Monday Night Stream. Figured it might be a fun way to get some traction.

Forum statistics

Threads
100,703
Messages
978,544
Members
132,320
Latest member
LavaWave
Top