Bloser
2019-05-26T17:38:21Z
is it possible to create a custom Attribute and if so how can you do it ?
asking for curiosity[:laugh:]
Utso
2019-05-28T10:01:15Z
On the most basic level, you just need to pick a number (a power of two, specifically) to represent your attribute and use that in your scripts. In constants.lua, the current attributes are listed:
ATTRIBUTE_EARTH		=0x01		--地
ATTRIBUTE_WATER		=0x02		--水
ATTRIBUTE_FIRE		=0x04		--炎
ATTRIBUTE_WIND		=0x08		--风
ATTRIBUTE_LIGHT		=0x10		--光
ATTRIBUTE_DARK		=0x20		--暗
ATTRIBUTE_DEVINE	=0x40		--神
So your new one would go at 0x80, for example. You could also define a new constant in this file to make your code more readable, but it's not strictly necessary and the tradeoff is that your cards won't work without that edit. May or may not be worth it depending on your use case.

This way any effects you make with that attribute should work, but it's not quite perfect. Cards like Abyssal Designator that include declaring an attribute won't pick up on your new attribute because YGOPro itself is hardcoded to only go up to and excluding 0x80 when listing the options there. The name of the attribute will also be displayed as "???" everywhere in the program, which as far as I'm aware is another thing that can't be easily fixed.
Bloser
2019-05-28T16:12:43Z
Originally Posted by: Utso 

On the most basic level, you just need to pick a number (a power of two, specifically) to represent your attribute and use that in your scripts. In constants.lua, the current attributes are listed:

ATTRIBUTE_EARTH		=0x01		--地
ATTRIBUTE_WATER		=0x02		--水
ATTRIBUTE_FIRE		=0x04		--炎
ATTRIBUTE_WIND		=0x08		--风
ATTRIBUTE_LIGHT		=0x10		--光
ATTRIBUTE_DARK		=0x20		--暗
ATTRIBUTE_DEVINE	=0x40		--神
So your new one would go at 0x80, for example. You could also define a new constant in this file to make your code more readable, but it's not strictly necessary and the tradeoff is that your cards won't work without that edit. May or may not be worth it depending on your use case.

This way any effects you make with that attribute should work, but it's not quite perfect. Cards like Abyssal Designator that include declaring an attribute won't pick up on your new attribute because YGOPro itself is hardcoded to only go up to and excluding 0x80 when listing the options there. The name of the attribute will also be displayed as "???" everywhere in the program, which as far as I'm aware is another thing that can't be easily fixed.



Thanks man i kind of already new how to make it but i wanted to be sure,and i asked myself if maybe there is a more elegant way of doing it.But thanks[:laugh:]
Users browsing this topic