Dynamic Traits and Effects

TakaDynasty

Apologetic Lurker
Veteran
Joined
Dec 21, 2016
Messages
41
Reaction score
8
First Language
English
Primarily Uses
Yep, that did it! Haha, I figured it'd be something simple in the end... Thanks for the help.
 

Shaz

Veteran
Veteran
Joined
Mar 2, 2012
Messages
39,966
Reaction score
13,602
First Language
English
Primarily Uses
RMMV
No worries.  I think I used the codes/numbers in the Ace version, but the way plugins allow you to use text as arguments made me think it might be more readable by using the names.  I didn't make that clear in the instructions, so I've edited them.
 

lonewolph

Veteran
Veteran
Joined
Oct 25, 2015
Messages
211
Reaction score
14
First Language
English
Im trying to add a skill via an event but its not working. Im using this plugin command
AddTrait actor 1 TRAIT_SKILL_ADD 8


Whats wrong?
 

Shaz

Veteran
Veteran
Joined
Mar 2, 2012
Messages
39,966
Reaction score
13,602
First Language
English
Primarily Uses
RMMV
What is the skill type, and is your actor or class set up to use that skill type?
 

Engr. Adiktuzmiko

Chemical Engineer, Game Developer, Using BlinkBoy'
Veteran
Joined
May 15, 2012
Messages
14,682
Reaction score
3,000
First Language
Tagalog
Primarily Uses
RMVXA
Im trying to add a skill via an event but its not working. Im using this plugin command
AddTrait actor 1 TRAIT_SKILL_ADD 8


Whats wrong?


You should just use the "Change Skills" event command instead of using plugins for adding skills via events. :)
 

Johan

Villager
Member
Joined
Feb 23, 2017
Messages
14
Reaction score
2
First Language
Swedish
Primarily Uses
RMMV
Hey there!
Is this possible to add Element_rate by variables?

On my game (test project) I have disable auto-lvl_ing, anytime when you have enough variable you can then use "level tree"
there you can spend some point for each row for total 3 row (Row 1: Actor Param, Row 2: different var, Row 3: Element resist ??? ).

As you can see on Row3, I need so you can add Element Resist, but I'm stuck :/
You can track every param / ex via variables DB, but Element is not there :(

Have searched everywhere, but could only find 2 somewhat good forum that "may work";
FROG
Shaz (this forum)
I have only 1 Actor & 1 Class.
For Element, I use standard: Element ID 02 (Fire).
Plugin that I use exept this one --> Yanfly StatusMenuCore (to see how much element I have) & MainMenuManage for Debug variable test.

For Plugin Command;
AddTrait actor 1 TRAIT_ELEMENT_RATE 2 $gameVariables.value(212)

This code is correct, except last one that I was trying to test out how to "add value" and not set.

GetTrait var class id traitCode dataId = Doesn't add from variables to Element, but rather Element to Variables :(

when I have 1 variable, nothing happens, when the variable is 2.1 it will be 200%, 3,1 = 300% and so on...
Did test to use script set 2.4 tex, but still 200% :/
''''

Was planning to add between value 1-5(0) for each Element for everytime you want to lvl up.
Would be weird to have 100% more for each :p prefer more like 1= 1%, 2=% and so on...
 

Shaz

Veteran
Veteran
Joined
Mar 2, 2012
Messages
39,966
Reaction score
13,602
First Language
English
Primarily Uses
RMMV
Object id and values can be formulae as long as they have no spaces
Unless I am misunderstanding you, you can already do this. The values are what MV already uses, not something I've just made up. If it doesn't fit in with your project, you will have to add a layer of logic in between, so your players see what you want them to see, but then you convert it to what the plugin (and MV system) expect.
 

WickedWolfy

Touch Fluffy Tail!
Veteran
Joined
Nov 27, 2017
Messages
114
Reaction score
49
First Language
En
Primarily Uses
RMMZ
This will be very useful for me very soon.
Thank you.

Script question: (please forgive my lack of knowledge here, I have not had enough time to look at all the details)
When determining what to assign and where, how does the assignment actually work?
I think the trait model is an array of 4 parameters and then it is "assigned" to an actor.

Can you elaborate the "assignment" for us wizards-still-in-training, please. =3
 

Shaz

Veteran
Veteran
Joined
Mar 2, 2012
Messages
39,966
Reaction score
13,602
First Language
English
Primarily Uses
RMMV
If you look in your database, you will see that any actor, class, weapon, armor, enemy or state can have a list of traits. And skills and items can have a list of effects.

This is simply a way to change that list in-game.
 

WickedWolfy

Touch Fluffy Tail!
Veteran
Joined
Nov 27, 2017
Messages
114
Reaction score
49
First Language
En
Primarily Uses
RMMZ
If you look in your database, you will see that any actor, class, weapon, armor, enemy or state can have a list of traits. And skills and items can have a list of effects.

This is simply a way to change that list in-game.
Yes. I meant in code. As in $gameActors.actor(10).[assignsomehow]({code: Game_BattlerBase.TRAIT_EQUIP_ATYPE, dataId: 01, null })
As much as I've looked at the code, I am not catching the glue that puts the two together. Dumping the object, when I have it, does not help either.
If its something you can kind of explain - I would appreciate it. If you think its too long and cumbersome to explain, I will just continue poking.

Either way I appreciate your work.
 

Shaz

Veteran
Veteran
Joined
Mar 2, 2012
Messages
39,966
Reaction score
13,602
First Language
English
Primarily Uses
RMMV
No, it doesn't do it like that. traits and effects are properties of the database objects, and they are arrays that contain the settings for each trait/effect. All I'm doing is adding, removing or changing entries in those arrays.

This is the line:
Code:
obj.traits.push(newTrait);
obj could be any of those database objects I listed that can have traits. It could be something like $dataActors[10] or $dataWeapons[15].

And this line:
Code:
obj.effects.push(newEffect);
obj could be any of those database objects I listed that can have effects. It could be something like $dataItems[5] or $dataSkills[8].


Look at the functions starting on lines 109 and 151, and on 364.
 

WickedWolfy

Touch Fluffy Tail!
Veteran
Joined
Nov 27, 2017
Messages
114
Reaction score
49
First Language
En
Primarily Uses
RMMZ
I'll read more through code. Sorry for being a newb. As I've mentioned, I am still trying to learn most structures and most of the time making assumptions.
Per this one, I was thinking that a Actor class has a reference to all of the contained Traits, as in one-to-many relationship.
From what I think I understood from your response, its the other way around - Database of Traits contains Actors is needs to modify. And I have a feeling I am still wrong

Either way, don't want to plague the thread with my lack of knowledge. I will continue poking at the code.
Thanks for your educating a newbie. =)
 

Shaz

Veteran
Veteran
Joined
Mar 2, 2012
Messages
39,966
Reaction score
13,602
First Language
English
Primarily Uses
RMMV
If you open the database in the editor, you will see the following: An actor contains an array of trait objects. A class contains an array of trait objects. A weapon contains an array of trait objects. An armor item contains an array of trait objects. A state contains an array of trait objects. A skill contains an array of effect objects. An item contains an array of effect objects.

My plugin simply alters the contents of the array.

When the game wants to see what traits the actor has, it looks at the $dataActors object trait array as well as the $dataClasses object trait array. It also looks at the trait array of any weapon or armor that is equipped, and any state that is applied to the actor. These are not the actor's traits - they are traits of the class, weapon, armor or state. When the class, weapons, armor or state changes, the previous traits are removed and the new traits are applied.

I suggest you go to the Help file (F1 from the editor) and look at the sections on the database structure.
 
Last edited:

itachi11115

Villager
Member
Joined
Jun 12, 2018
Messages
14
Reaction score
0
First Language
English
Primarily Uses
RMMV
Can this be used to give a specific class a specific trait for a specific weapon? For instance, one of my classes is Monk, and can fight unarmed or with polearms. I want to make it so that once they master the monk class, the attack element of their unarmed attacks changes to Chi, but their polearm attacks remain physical
 

Shaz

Veteran
Veteran
Joined
Mar 2, 2012
Messages
39,966
Reaction score
13,602
First Language
English
Primarily Uses
RMMV
This can be used to give and remove traits, but it is not automatic based on certain conditions. YOU tell it when to apply a trait, and YOU tell it when to remove it. It will not monitor for something being equipped and unequipped and apply/remove traits accordingly.

Can you not just apply the trait to the weapon directly? This would only work if that specific class is the only one that can equip that particular weapon. But if that's the case, you should be able to do it without a plugin.
 

41728280

Veteran
Veteran
Joined
May 31, 2020
Messages
239
Reaction score
71
First Language
Chinese
Primarily Uses
RMMV
Hi, Shaz, for example, I want to set up a consumable so that any member can use it to increase the types of weapons that can be equipped.
AddTrait class 1 TRAIT_EQUIP_WTYPE 3
In this way, it is only added to the class of a specific ID. How to determine that it is the user to increase? Just like ordinary consumables.
I really need this plugin, please help
 

Shaz

Veteran
Veteran
Joined
Mar 2, 2012
Messages
39,966
Reaction score
13,602
First Language
English
Primarily Uses
RMMV
You would need to get the actor id that the item was used on, then the class id.

I can't think of how to do that off the top of my head, but I know it's been asked before, so you might be able to find it by searching.

Basically once you know the actor id, you'd put something like the following into the plugin command where the class id is meant to go:

$gameActors.actor(id)._classId
 

41728280

Veteran
Veteran
Joined
May 31, 2020
Messages
239
Reaction score
71
First Language
Chinese
Primarily Uses
RMMV
You would need to get the actor id that the item was used on, then the class id.

I can't think of how to do that off the top of my head, but I know it's been asked before, so you might be able to find it by searching.

Basically once you know the actor id, you'd put something like the following into the plugin command where the class id is meant to go:

$gameActors.actor(id)._classId
Well, I don't know what to search at all, I read through Google Translate, and I don't understand JS.
If you can think of it, or any friend who can do it, please help me. My game system needs this feature very much.
 

Shaz

Veteran
Veteran
Joined
Mar 2, 2012
Messages
39,966
Reaction score
13,602
First Language
English
Primarily Uses
RMMV
$gameParty.targetActor()._classId

Assuming you use the item from the menu and not in battle (maybe it also works in battle - I was searching for a 'from menu' option).
 

41728280

Veteran
Veteran
Joined
May 31, 2020
Messages
239
Reaction score
71
First Language
Chinese
Primarily Uses
RMMV
$gameParty.targetActor()._classId

Assuming you use the item from the menu and not in battle (maybe it also works in battle - I was searching for a 'from menu' option).
I did not find any useful information. I wonder if this is the correct and complete code format?
AddTrait $gameParty.targetActor()._classId TRAIT_EQUIP_WTYPE 3
If you enter this way, the game will make an error when using this item and display
TRAIT EQUIP WTYPE is not defined
Oh, it sucks not to understand the code. . .
 

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

Latest Threads

Latest Profile Posts

I'm a bit conflicted. One the one hand, it's quite visually cool to make bodies of water that the player can interact with by going into it. However obscuring the player character from a gameplay perspective is pretty bad. Hmm... There's the option to make the area around the player visible, but then that kind of defeats the purpose of submerging them. :unsure:
Stream will be live shortly with some Darkest Dungeon! Feel free to drop by!
Another two plugins done! One being an on map grid inventory.
busy with my newborn child, can't even touch pc at all ;_;
Make a Game in RPG Maker MZ: Episode 6 Starts NOW! Let's map some caves!

Forum statistics

Threads
104,294
Messages
1,005,346
Members
135,809
Latest member
Lavos
Top