Board index Programs with AI or Rules Enforcement Magic: The Gathering - Duels of the Planeswalkers Programming Talk
Create a Characteristic
Moderator: CCGHQ Admins
Create a Characteristic
by Zambooo » 08 Mar 2015, 21:44
I wanted to code Venerated Teacher, and it is impossible without a proper "Level Up" CHARACTERISTIC. Can I create one?
It shouldn't even have to handle the level up abilities etc., I just wanted to "mark" a card just to know if it has "Level Up"
It shouldn't even have to handle the level up abilities etc., I just wanted to "mark" a card just to know if it has "Level Up"
Re: Create a Characteristic
by sweetLu » 08 Mar 2015, 22:13
Riiak has come up with a set up custom characteristic mod but I cannot find it atm. There is an alternative way if you do not want to recode all cards with level up abilities. You could create a list of card names of cards with level up (I do not think there are cards that grant level up to other cards). Then when Venerated Teacher enters the battlefield just check the cardnames of creatures you control against your list of level up creatures. The same concept is used for phyrexian mana and planeswalkers I believe.
Edit - Here is the custom characteristics mod. Just had to get to his wiki:
http://mtg.dragonanime.org/index.php?ti ... _Functions
Edit - Here is the custom characteristics mod. Just had to get to his wiki:
http://mtg.dragonanime.org/index.php?ti ... _Functions
Re: Create a Characteristic
by Zambooo » 08 Mar 2015, 22:59
Total cards with "Level Up" are 25, the coded ones are probably like 5, so I wouldn't even mind recoding them all XD
PS: thank you, I'll read the wiki tomorrow
PS: thank you, I'll read the wiki tomorrow
Re: Create a Characteristic
by Xander9009 » 09 Mar 2015, 02:09
Here's a thread from awhile back in which he explains to me how to use them. They're not too difficult. viewtopic.php?f=63&t=14021
Anyway, you could actually code Venerated teacher for the most part. Just make a list of card names since there aren't too many. Using a custom characteristic is a better way to go for sure. Just saying it would be more or less possible.
Anyway, you could actually code Venerated teacher for the most part. Just make a list of card names since there aren't too many. Using a custom characteristic is a better way to go for sure. Just saying it would be more or less possible.
_______________________________
Community Wad - Community Wad Website - How to Help and Report Bugs
Discord: discord.gg/4AXvHzW
Community Wad - Community Wad Website - How to Help and Report Bugs
Discord: discord.gg/4AXvHzW
-
Xander9009 - Programmer
- Posts: 2905
- Joined: 29 Jun 2013, 07:44
- Location: Indiana, United States
- Has thanked: 121 times
- Been thanked: 445 times
Re: Create a Characteristic
by Zambooo » 09 Mar 2015, 19:14
Can I create a Custom Badge for my Custom Characteristic?
Also (I know it's not mandatory, but..) how could I create a custom manager for an Ability such as 'Level Up', if the ability itself requires a "personal" mana cost? Can I "pass" that mana cost in any way to my characteristic manager?
Also (I know it's not mandatory, but..) how could I create a custom manager for an Ability such as 'Level Up', if the ability itself requires a "personal" mana cost? Can I "pass" that mana cost in any way to my characteristic manager?
Last edited by Zambooo on 09 Mar 2015, 20:53, edited 1 time in total.
Re: Create a Characteristic
by Xander9009 » 09 Mar 2015, 20:04
No custom badges, sadly. The badges are hardcoded.
As for passing the level up cost to a manager, you could do that. It could be a bit complicated, and there might be easier ways depending on what exactly you're wanting to do, but one way to do it which would be rather complex but also very versatile would be the following.
As for passing the level up cost to a manager, you could do that. It could be a bit complicated, and there might be easier ways depending on what exactly you're wanting to do, but one way to do it which would be rather complex but also very versatile would be the following.
- On the manager token, when it's created, make an ObjectDC with RSN_ObjectDC().
- Within the chest, make a subchest (to avoid interence with things that affect many cards, it's just generally good practice to only use one register on an objects base ObjectDC). Do that by making a lol file with one line only. That line will be the constant name you want to use for the chest and the number, which should start with your number prefix. Something like LEVEL_UP_REGISTER = 909002 is what would be in mine since 909 is my prefix and I haven't used 909002 for anything.
- In the manager, make that subchest with RSN_ObjectDC():Make_Chest(LEVEL_UP_REGISTER). Now, you've got a chest which nothing else should interfere with.
- When a creature with level up enters the battlefield, store its level up cost in that subchest. RSN_ObjectDC() is the function for getting EffectSource's ObjectDC. To get another card's ObjectDC, you need to use RSN_GetObjectDC(CardPointer).
- To get the card pointer, you'll need to use a filter which filters by the manager token's name and then retrieve the first instance.
- Code: Select all
local oFilter = ClearFilter()
oFilter:Add( FE_CARD_NAME, OP_IS, "_MANAGER_LEVEL_UP" )
oFilter:Add( FE_CONTROLLER, OP_IS, oPlayer )
local iCount = oFilter:EvaluateObjects()
if iCount > 0 then
oManager = oFilter:GetNthEvaluatedObject(0)
end
- Now that oManager is the manager token, you can get the chest with RSN_GetObjectDC(oManager). That will return the manager ObjectDC, but you need your level up chest, so you'd need
- Code: Select all
local LevelUpChest = RSN_GetObjectDC(oManager):Get_Chest(LEVEL_UP_REGISTER)
- Now that you have the chest, you'll need to store the mana cost. That's best done by making a new subchest for each card, and then storing the card's cost in 6 registers within the chest. You can make a unique subchest for each card by using EffectSource():GetRef(). That should return a unique number for each card that uses it.
- Code: Select all
--Test cost is {2}{U}. Order: CWUBRG
--0: C - 2
--1: W - 0
--2: U - 1
--3: B - 0
--4: R - 0
--5: G - 0
local LevelUpChest = RSN_GetObjectDC(oManager, true):Get_Chest(LEVEL_UP_REGISTER)
if LevelUpChest ~= nil then
local ESLevelUpChest = LevelUpChest:Make_Chest(EffectSource():GetRef())
if ESLevelUpChest ~= nil then
ESLevelUpChest:Set_Int(0, 2) --{2}
ESLevelUpChest:Set_Int(2, 1) --{U}
end
end
- Now, get that information from another card or the manager. The first thing you need is a pointer for the card you want to retrieve. I'll assume you got that somehow and it's stored in LevelUpCreature. To get that creature's level up cost from whatever card you're working on, you'd use this.
- Code: Select all
--Test cost is {2}{U}. Order: CWUBRG
--0: C - 2
--1: W - 0
--2: U - 1
--3: B - 0
--4: R - 0
--5: G - 0
local LevelUpChest = RSN_GetObjectDC(oManager, true):Get_Chest(LEVEL_UP_REGISTER)
if LevelUpChest ~= nil then
local ESLevelUpChest = LevelUpChest:Get_Chest(LevelUpCreature:GetRef())
if ESLevelUpChest ~= nil then
CCost = ESLevelUpChest:Get_Int(0) --{C}
WCost = ESLevelUpChest:Get_Int(1) --{W}
UCost = ESLevelUpChest:Set_Int(2) --{U}
BCost = ESLevelUpChest:Set_Int(3) --{B}
RCost = ESLevelUpChest:Set_Int(4) --{R}
GCost = ESLevelUpChest:Set_Int(5) --{G}
end
end
--CCost is 2
--UCost is 1
--All others are 0
_______________________________
Community Wad - Community Wad Website - How to Help and Report Bugs
Discord: discord.gg/4AXvHzW
Community Wad - Community Wad Website - How to Help and Report Bugs
Discord: discord.gg/4AXvHzW
-
Xander9009 - Programmer
- Posts: 2905
- Joined: 29 Jun 2013, 07:44
- Location: Indiana, United States
- Has thanked: 121 times
- Been thanked: 445 times
Re: Create a Characteristic
by Xander9009 » 09 Sep 2016, 11:10
Was this in the wrong thread?Mamed9 wrote:Brynn. Ive sent celso.junior a PM now - if theres no reply within the next two weeks, Ill just create a github repo, so maybe others can contribute.
_______________________________
Community Wad - Community Wad Website - How to Help and Report Bugs
Discord: discord.gg/4AXvHzW
Community Wad - Community Wad Website - How to Help and Report Bugs
Discord: discord.gg/4AXvHzW
-
Xander9009 - Programmer
- Posts: 2905
- Joined: 29 Jun 2013, 07:44
- Location: Indiana, United States
- Has thanked: 121 times
- Been thanked: 445 times
-
Huggybaby - Administrator
- Posts: 3209
- Joined: 15 Jan 2006, 19:44
- Location: Finally out of Atlanta
- Has thanked: 704 times
- Been thanked: 595 times
8 posts
• Page 1 of 1
Who is online
Users browsing this forum: No registered users and 11 guests