It is currently 16 Apr 2024, 13:37
   
Text Size

Create a Characteristic

Moderator: CCGHQ Admins

Create a Characteristic

Postby 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"
User avatar
Zambooo
 
Posts: 242
Joined: 01 Jul 2012, 21:33
Has thanked: 19 times
Been thanked: 17 times

Re: Create a Characteristic

Postby 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
sweetLu
 
Posts: 181
Joined: 16 Jul 2014, 01:24
Has thanked: 21 times
Been thanked: 22 times

Re: Create a Characteristic

Postby 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 ;)
User avatar
Zambooo
 
Posts: 242
Joined: 01 Jul 2012, 21:33
Has thanked: 19 times
Been thanked: 17 times

Re: Create a Characteristic

Postby 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.
_______________________________
Community Wad - Community Wad Website - How to Help and Report Bugs
Discord: discord.gg/4AXvHzW
User avatar
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

Postby Zambooo » 09 Mar 2015, 19:14

Can I create a Custom Badge for my Custom Characteristic? :D

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.
User avatar
Zambooo
 
Posts: 242
Joined: 01 Jul 2012, 21:33
Has thanked: 19 times
Been thanked: 17 times

Re: Create a Characteristic

Postby 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.

  • 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
    That would get the level up manager (assuming its cardname is "_MANAGER_LEVEL_UP") for oPlayer. Replace oPlayer with EffectController() to get the player who controls the creature with level up.
  • 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
    There are probably better ways to do it, but without knowing the reason you want to do it, I'm not sure how to make it work better. If you'd like to look at a set of functions I made for retrieving a player's manager token and handling chests on them, you can look in the lol file CW_EXILE_FUNCTIONS.LOL in the functions folder of the Community Wad. I made those to handle exile, obviously, but the manager retrieval functions will work for any other manager if you just change the name in the functions. Just make sure if you decide to include the functions in the CW that you let me handle that bit. :) I'd like them to be standardized. I've made quite an effort to make the functions and constants I did for exile a format that other function files could follow and could help keep things clean.
_______________________________
Community Wad - Community Wad Website - How to Help and Report Bugs
Discord: discord.gg/4AXvHzW
User avatar
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

Postby Xander9009 » 09 Sep 2016, 11:10

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.
Was this in the wrong thread?
_______________________________
Community Wad - Community Wad Website - How to Help and Report Bugs
Discord: discord.gg/4AXvHzW
User avatar
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

Postby Huggybaby » 10 Sep 2016, 20:38

Spam, I'm about to delete him.
User avatar
Huggybaby
Administrator
 
Posts: 3205
Joined: 15 Jan 2006, 19:44
Location: Finally out of Atlanta
Has thanked: 696 times
Been thanked: 594 times


Return to Programming Talk

Who is online

Users browsing this forum: No registered users and 11 guests


Who is online

In total there are 11 users online :: 0 registered, 0 hidden and 11 guests (based on users active over the past 10 minutes)
Most users ever online was 4143 on 23 Jan 2024, 08:21

Users browsing this forum: No registered users and 11 guests

Login Form