It is currently 23 Sep 2018, 23:33
   
Text Size

Please help -- land assignment and coding for 2 cards

User-made mods in DLC (Downloadable Content) form.
Get MTG cards here for your DotP that aren't available anywhere else!

Moderators: Xander9009, CCGHQ Admins

Please help -- land assignment and coding for 2 cards

Postby nivmizzet1 » 22 Mar 2013, 15:35

Hi everyone, first post here so please go easy.

I just bought DOTP 2013 on steam solely for the purpose of modding to play my own custom decks offline -- I've had DOTP 2013 on xbox since release and use that for online play.

First of all, I'd like to thank TheFiremind for all of the instructionals and other stuff such as card dlcs and the Localised program -- they've been extremely helpful in getting started with all this modding stuff.

Using TheFiremind's test deck I've managed to create my own deck -- a very basic black/white deck -- for which I also coded two new cards -- Altar's Reap (I used code from goblin grenade and sign in blood) and Death Grasp (I used code from blaze and corrupt, I think). The deck works like a charm, so I decided to try making my first fully custom deck (in the sense that it is shaped exactly how I want it, rather than working within limits) that needed a few more new cards than my test deck did. Unfortunately, I've come to an impasse in my attempt.

There are a couple of issues I've come across that I don't think are related. First, there are two cards that I can't figure out how to code/where to pinch code from; and second, I'm having problems with land when I load the deck in game. The two cards that I'm having trouble coding are Mortician Beetle and Ghoulcaller's Chant. I have Mortician Beetle working in game by using code from blood artist and blood connoisseur, but I need to change the trigger. Currently, the trigger is set to whenever a creature dies (i.e. it's the blood artist trigger), while it needs to be whenever a player sacrifices a creature. I have no idea how this could be achieved, and can't think of a similar ability that's already in the game. This is what I have:
Last edited by nivmizzet1 on 22 Mar 2013, 15:53, edited 5 times in total.
nivmizzet1
 
Posts: 544
Joined: 21 Mar 2013, 10:10
Has thanked: 84 times
Been thanked: 19 times

Re: Please help -- land assignment and coding for 2 cards

Postby nivmizzet1 » 22 Mar 2013, 15:36

OK, whenever I try to post code the forum tells me: "Your post looks too spamy for a new user, please remove off-site URLs." even though the post contains no off-site URLs at all...


So I'll leave the code for now -- maybe I can pm it or something if anybody that's willing to help me needs it.


So on to Ghoulcaller's Chant. I really have no clue where to even start with htis card. I thought the code for Naya Charm would be a logical starting place, as it has multiple choices which includes a graveyard recursion ability, just like ghoulcaller's chant. However, I just don't have the experience to modify that code properly, I just get lost in it. I *would* post what I have so far, but I can't.


Finally, on to the land issue. My deck list specifies 39 cards, with 3 being land. This is exactly the same as I have in my test deck, but for some reason when I load it up in the game some of the cards in the list just aren't there (e.g. I'll have 4x something in the list, but only 2x will show up in game, or in some cases none of the copies at all -- this is the case for terramorphic expanse). Filling the space instead (to make up 60 cards) is land -- the land count is at 31(!). I don't understand, because the lands were working fine in earlier tests with the same deck, the only difference being changes to cards in the list. I think the problem started when I tried adding a badly coded card (an attempt at one of the above cards), but the problem didn't go away after I removed the card, so I don't know. I *would* post my deck list for people to see if the problem lies therein, but this site won't allow that.


Help with any of these problems would be greatly appreciated!!
Last edited by nivmizzet1 on 22 Mar 2013, 15:42, edited 3 times in total.
nivmizzet1
 
Posts: 544
Joined: 21 Mar 2013, 10:10
Has thanked: 84 times
Been thanked: 19 times

Re: Please help -- land assignment and coding for 2 cards

Postby thefiremind » 22 Mar 2013, 16:28

For Mortician Beetle, the trigger to use is "SACRIFICE" and the TriggerObject() contains the sacrificed creature. But Mortician Beetle doesn't care about who sacrifices what EDIT: no, wait, what did I say... it does care about something: it must be a creature!
Code: Select all
    <TRIGGER value="SACRIFICE" simple_qualifier="another">
    return TriggerObject():GetCardType():Test( CARD_TYPE_CREATURE ) ~= 0
    </TRIGGER>
The "another" tag can be there or not, I'd add it because if you sacrifice the Beetle itself, you can be sure that it won't be there to take the counter.

For Ghoulcaller's Chant, you are right when you say that the code for modal cards is complicated if you look at a Charm... there are a lot of things going on: keeping track of the availability of different kinds of possible targets, allowing a single <FILTER> block to filter different things... Ghoulcaller's Chant should result much easier than a Charm. Try this code:
Code: Select all
    <PLAY_TIME_ACTION>
    local player = EffectController()
    if player ~= nil then
       local has_creature = AtLeastOneTargetFromDefinition(0)
       local has_2_zombies = AtLeastNTargetsFromDefinition(1, 2)
       player:BeginNewMultipleChoice()
       if has_creature ~= 0 then
          player:AddMultipleChoiceAnswer( "CARD_QUERY_OPTION_GET_CREATURE" )
       else
          player:AddMultipleChoiceAnswer( "CARD_QUERY_OPTION_GET_CREATURE", false )
       end
       if has_2_zombies ~= 0 then
          player:AddMultipleChoiceAnswer( "CARD_QUERY_OPTION_GET_TWO_ZOMBIES" )
       else
          player:AddMultipleChoiceAnswer( "CARD_QUERY_OPTION_GET_TWO_ZOMBIES", false )
       end
        player:AskMultipleChoiceQuestion( "CARD_QUERY_MC_CHOOSE_MODE" )
    end
    </PLAY_TIME_ACTION>
    <PLAY_TIME_ACTION>
    local decision = Object():GetMultipleChoiceResult()
    EffectDC():Set_Int(3, decision)
    --MTG():MessageAllPlayers( "PLAYER_MESSAGE_GHOULCALLERS_CHANT_MODE_"..decision )
    </PLAY_TIME_ACTION>
    <TARGET_DEFINITION id="0">
    local filter = Object():GetFilter()
    filter:Clear()
    filter:AddCardType( CARD_TYPE_CREATURE )
    filter:SetZone( ZONE_GRAVEYARD )
    filter:SetPlayer( EffectController() )
    filter:SetHint( HINT_ALLIED, EffectController() )
    </TARGET_DEFINITION>
    <TARGET_DEFINITION id="1">
    local filter = Object():GetFilter()
    filter:Clear()
    filter:AddSubType( CREATURE_TYPE_ZOMBIE )
    filter:SetZone( ZONE_GRAVEYARD )
    filter:SetPlayer( EffectController() )
    filter:SetHint( HINT_ALLIED, EffectController() )
    </TARGET_DEFINITION>
    <TARGET_DETERMINATION>
    if AtLeastOneTargetFromDefinition(0) ~= 0 or AtLeastNTargetsFromDefinition(1, 2) ~= 0 then
       return 1
    end
    return 0
    </TARGET_DETERMINATION>
    <PLAY_TIME_ACTION target_choosing="1">
    local player = EffectController()
    if EffectDC():Get_Int(3) == 0 then
       player:ChooseTarget( 0, "CARD_QUERY_CHOOSE_CREATURE_TO_PUT_INTO_HAND", EffectDC():Make_Targets(0) )
    else
       player:SetTargetCount(2)
       for i=0,1 do
          player:SetTargetPrompt( i, "CARD_QUERY_CHOOSE_CARD_TO_PUT_INTO_HAND" )
       end
       player:ChooseTargets( 1, EffectDC():Make_Targets(0) )
    end
    </PLAY_TIME_ACTION>
    <RESOLUTION_TIME_ACTION>
    local target_a = EffectDC():Get_Targets(0) and EffectDC():Get_Targets(0):Get_CardPtr(0)
    local target_b = EffectDC():Get_Targets(0) and EffectDC():Get_Targets(0):Get_CardPtr(1)
    if target_a ~= nil then
       target_a:GuidedReveal( ZONE_GRAVEYARD, ZONE_HAND )
       target_a:PutInHand()
    end
    if target_b ~= nil then
       target_b:GuidedReveal( ZONE_GRAVEYARD, ZONE_HAND )
       target_b:PutInHand()
    end
    </RESOLUTION_TIME_ACTION>
In the second PLAY_TIME_ACTION I commented out a line. It's up to you to decide if you want that or not. That line would send a message that informs the player about the modal choice (in paper Magic you would declare what you choose, right?). Of course this requires to define the localised text for 2 more strings:
  • PLAYER_MESSAGE_GHOULCALLERS_CHANT_MODE_0 should say that the player chose the first mode.
  • PLAYER_MESSAGE_GHOULCALLERS_CHANT_MODE_1 should say that the player chose the second mode.
About the other problems: when you can't see a card in the deck, it's because you made some mistake in the XML structure (if you made a mistake in the code, the card would appear but wouldn't work correctly). If you have Firefox, drag and drop the card's XML onto Firefox: it will tell you where the problem is... or show you the whole XML if no problem can be found. If something is still wrong even after you removed the buggy cards, I guess there's some information that persists... I know that Skidrow version does that, and requires to delete the profile each time you modify something in a custom deck, I don't know if the original copies of the game do the same. Do you know where your profile is stored? It should be composed by two files: <number>.profile (where <number> is a 10-digit number) and hash.file, but I can't remember where the original game stores it. I would suggest to make a backup of it and then try to delete it.
Last edited by thefiremind on 22 Mar 2013, 17:33, edited 1 time in total.
< Former DotP 2012/2013/2014 modder >
Currently busy with life. Don't expect answers to PMs.
User avatar
thefiremind
Programmer
 
Posts: 3513
Joined: 07 Nov 2011, 10:55
Has thanked: 117 times
Been thanked: 715 times

Re: Please help -- land assignment and coding for 2 cards

Postby nivmizzet1 » 22 Mar 2013, 17:22

awesome, thanks firemind. That was quick!

Your fix for the mortician beetle worked like a charm!

Unfortunately, there was something a little wrong with the code you wrote for Ghoulcaller's Chant. Even with creatures available in the g/y (both 1 non-zombie creature and 2 zombies) the card remained unplayable, and when I tried to play it, the game notified me that there weren't enough targets available. I had a look in the code to see if I could find what may be causing that, but not surprisingly, nothing stood out at me.


As for the land issue, it's still there. The game just seems intent on giving me 31 lands (it's not a problem with card code because 1. terramorphic expanse from the original game files is not showing up; and 2. some of the cards this is happening to are still showing up, only with less copies than there should be). I had a search for my profile and found a MTG profile folder in my documents, but there was nothing in it (I had hidden files visible too).
nivmizzet1
 
Posts: 544
Joined: 21 Mar 2013, 10:10
Has thanked: 84 times
Been thanked: 19 times

Re: Please help -- land assignment and coding for 2 cards

Postby thefiremind » 22 Mar 2013, 17:34

nivmizzet1 wrote:Unfortunately, there was something a little wrong with the code you wrote for Ghoulcaller's Chant. Even with creatures available in the g/y (both 1 non-zombie creature and 2 zombies) the card remained unplayable, and when I tried to play it, the game notified me that there weren't enough targets available. I had a look in the code to see if I could find what may be causing that, but not surprisingly, nothing stood out at me.
Sorry, sometimes I forget that DotP2013's TARGET_DETERMINATION wants 0 or 1 in return, not true or false as in DotP2012. I corrected the TARGET_DETERMINATION in the previous post.
< Former DotP 2012/2013/2014 modder >
Currently busy with life. Don't expect answers to PMs.
User avatar
thefiremind
Programmer
 
Posts: 3513
Joined: 07 Nov 2011, 10:55
Has thanked: 117 times
Been thanked: 715 times

Re: Please help -- land assignment and coding for 2 cards

Postby nivmizzet1 » 23 Mar 2013, 05:34

Excellent, it works perfectly now. Thanks so much. I would've spent hours trying to get that to work, and probably still wouldn't have succeeded. You're a legend!

EDIT: and I found my profile file -- C:\Program Files\Steam\userdata\<USER DATA NUMBER FOLDERS>\97330\remote\<PROFILE AND HASH HERE> and deleting it fixed the problem I was having with the land.

PS I just realised this should probably be in the 2013 sub-forum. I actually thought that's where I posted this in the first place, but I guess I didn't.
nivmizzet1
 
Posts: 544
Joined: 21 Mar 2013, 10:10
Has thanked: 84 times
Been thanked: 19 times

Re: Please help -- land assignment and coding for 2 cards

Postby nivmizzet1 » 23 Mar 2013, 18:18

thefiremind wrote:For Mortician Beetle, the trigger to use is "SACRIFICE" and the TriggerObject() contains the sacrificed creature. But Mortician Beetle doesn't care about who sacrifices what EDIT: no, wait, what did I say... it does care about something: it must be a creature!
Code: Select all
    <TRIGGER value="SACRIFICE" simple_qualifier="another">
    return TriggerObject():GetCardType():Test( CARD_TYPE_CREATURE ) ~= 0
    </TRIGGER>
The "another" tag can be there or not, I'd add it because if you sacrifice the Beetle itself, you can be sure that it won't be there to take the counter.
Hi there. Sorry to bother you again, but I just realised that Mortician Beetle isn't working as intended. It seemed to be working correctly, but then I noticed it gained +1/+1 when I sacrificed a land (polluted delta).
nivmizzet1
 
Posts: 544
Joined: 21 Mar 2013, 10:10
Has thanked: 84 times
Been thanked: 19 times

Re: Please help -- land assignment and coding for 2 cards

Postby thefiremind » 23 Mar 2013, 18:56

That's exactly the reason why I edited the post after a while. Use the new code.
< Former DotP 2012/2013/2014 modder >
Currently busy with life. Don't expect answers to PMs.
User avatar
thefiremind
Programmer
 
Posts: 3513
Joined: 07 Nov 2011, 10:55
Has thanked: 117 times
Been thanked: 715 times

Re: Please help -- land assignment and coding for 2 cards

Postby nivmizzet1 » 24 Mar 2013, 03:41

thefiremind wrote:That's exactly the reason why I edited the post after a while. Use the new code.
hey, I noticed you edited it, and I thought I was using that code. I've now figured out that I only copy and pasted from the second line down, and didn't realise that I left a slash at the end of the first line. derp! :oops:
I've fixed it now, and it's working as intended. Thanks *again* for your help!
nivmizzet1
 
Posts: 544
Joined: 21 Mar 2013, 10:10
Has thanked: 84 times
Been thanked: 19 times


Return to New MTG Cards and Decks

Who is online

Users browsing this forum: No registered users and 1 guest


Who is online

In total there is 1 user online :: 0 registered, 0 hidden and 1 guest (based on users active over the past 10 minutes)
Most users ever online was 279 on 11 Jul 2013, 22:03

Users browsing this forum: No registered users and 1 guest

Login Form