Page 63 of 102

Re: Card Creation Request Thread

PostPosted: 25 May 2013, 06:05
by Master Necro
Having problems with Izzet Keyrune.

When I coded the other keyrunes I have added abilities by simply putting in this code:

Code: Select all
<CONTINUOUS_ACTION layer="6">
    local target = Object()
    if target ~= nil then
       local characteristics = target:GetCurrentCharacteristics()
       characteristics:Characteristic_Set( CHARACTERISTIC_the ability I wanted, 1 )
   end
    </CONTINUOUS_ACTION>
And it worked since all the runes had abilities like trample, flying, etc..

The Izzet keyrune has "Whenever Izzet Keyrune deals combat damage to a player, you may draw a card. If you do, discard a card.", how do I code that?

Re: Card Creation Request Thread

PostPosted: 25 May 2013, 07:18
by sumomole
Master Necro wrote:The Izzet keyrune has "Whenever Izzet Keyrune deals combat damage to a player, you may draw a card. If you do, discard a card.", how do I code that?
Whenever Izzet Keyrune deals combat damage to a player, you may draw a card. If you do, discard a card. | Open
Code: Select all
  <TRIGGERED_ABILITY auto_skip="1">
    <LOCALISED_TEXT LanguageCode="en-US"><![CDATA[Whenever Izzet Keyrune deals combat damage to a player, you may draw a card. If you do, discard a card.]]></LOCALISED_TEXT>
    <TRIGGER value="CREATURE_DEALS_COMBAT_DAMAGE_TO_PLAYER" simple_qualifier="self" />
    <RESOLUTION_TIME_ACTION>
    if EffectController():IsAI() == 0 then
       EffectController():BeginNewMultipleChoice()   
       EffectController():AddMultipleChoiceAnswer( "CARD_QUERY_OPTION_YES" )   
       EffectController():AddMultipleChoiceAnswer( "CARD_QUERY_OPTION_NO" )   
       EffectController():AskMultipleChoiceQuestion( "CARD_QUERY_DRAW_A_CARD")
    end
    </RESOLUTION_TIME_ACTION>
    <RESOLUTION_TIME_ACTION>
    local player = EffectController()
    local filter = Object():GetFilter()
    local decision = Object():GetMultipleChoiceResult()
    if (player:IsAI() == 0 and decision == 0) or (player:IsAI() ~= 0 and CountCardsInLibrary(player) &gt; 5) then
       player:DrawCard()
      filter:Clear()
      filter:SetZone( ZONE_HAND )
      filter:SetPlayer( player )
      filter:NotTargetted()
      player:SetTargetCount( 1 )
      for i=0,1-1 do
         player:SetTargetPrompt( i, "CARD_QUERY_CHOOSE_CARD_TO_DISCARD" )
      end
      player:ChooseTargets( NO_VALIDATION, EffectDC():Make_Targets(0) )
    end
    </RESOLUTION_TIME_ACTION>
    <RESOLUTION_TIME_ACTION>
    local target_card = EffectDC():Get_Targets(0) and EffectDC():Get_Targets(0):Get_CardPtr(0)
    if target_card ~= nil then
       target_card:Discard()
    end   
    </RESOLUTION_TIME_ACTION>
  </TRIGGERED_ABILITY>

Re: Card Creation Request Thread

PostPosted: 25 May 2013, 10:15
by BloodReyvyn
All seems to be working fine with this except this snippet:

Code: Select all
        <RESOLUTION_TIME_ACTION>
        local life_total = EffectController():GetLifeTotal()
        if life_total &gt; 0 then
           EffectController():LoseLife( life_total )
        end
        </RESOLUTION_TIME_ACTION>
I cab see quite plainly what it is supposed to be doing, but when in-game and it enters the battlefield, the ability triggers, but you don't lose any life. :o

Re: Card Creation Request Thread

PostPosted: 25 May 2013, 11:05
by thefiremind
BloodReyvyn wrote:All seems to be working fine with this except this snippet:

Code: Select all
        <RESOLUTION_TIME_ACTION>
        local life_total = EffectController():GetLifeTotal()
        if life_total &gt; 0 then
           EffectController():LoseLife( life_total )
        end
        </RESOLUTION_TIME_ACTION>
I cab see quite plainly what it is supposed to be doing, but when in-game and it enters the battlefield, the ability triggers, but you don't lose any life. :o
Try to do this:
Code: Select all
        <RESOLUTION_TIME_ACTION>
        local life_total = EffectController():GetLifeTotal()
        if life_total &gt; 0 then
           EffectController():SetLifeTotal(0)
        end
        </RESOLUTION_TIME_ACTION>
Setting a life total means losing or gaining life enough to go to that total, this is a real Magic rule and DotP should follow it internally. Why it doesn't work the other way, I really don't know.

There's another thing that could give problems: FILTER_EXTRA_NOT_TOKEN is known to be bugged so that it just excludes tokens that were born as such, without counting tokens that are copies of other cards (i.e. the copies made by Splinter Twin aren't tokens according to the FILTER_EXTRA_NOT_TOKEN filtering). You should use filter evaluation if you want to be safe:
Code: Select all
    MTG():ClearFilterMarkedObjectsInZone( ZONE_IN_PLAY )
    local filter = Object():GetFilter()
    -- Insert here the rest of the filter
    local filter_count = filter:EvaluateObjects()
    if filter_count &gt; 0 then
       for i=0,filter_count-1 do
           local candidate = filter:GetNthEvaluatedObject(i)
           if candidate:IsToken() == 0 then
              candidate:MarkForFilter()
           end
       end
    end
    filter:SetMarkedObjectsOnly()

Re: Card Creation Request Thread

PostPosted: 25 May 2013, 12:25
by BloodReyvyn
Awesome thanks. :)

Unfortunately when I tried to add the other filters back in, the game started crashing when I tried to play, but I'm really burnt out I been at this since yesterday. Thanks guys for all the help, lots of progress today. Even coded a companion card for this...

Deaths Shadow: https://www.dropbox.com/s/jwg55zcztcju8 ... ip?v=0rc-s

Hehehehehe :lol:

Re: Card Creation Request Thread

PostPosted: 25 May 2013, 12:53
by thefiremind
Actually, there's a Death's Shadow in the core. It's used in a challenge and it just has a CHARACTERISTIC_MUST_BE_BLOCKED_IF_ABLE ability to remove, then it becomes fine to use outside the challenge. Anyway, any card you code by yourself is something you learn. :wink:

Re: Card Creation Request Thread

PostPosted: 25 May 2013, 13:08
by NEMESiS
Does anyone know how to make echo? I want to make Firemaw Kavu.

Re: Card Creation Request Thread

PostPosted: 25 May 2013, 13:27
by thefiremind
NEMESiS wrote:Does anyone know how to make echo? I want to make Firemaw Kavu.
The echo check is almost the same as checking summoning sickness, except for being checked at the upkeep rather than at the untap. So I would start from the code I invented here and do something like this:
Code: Select all
  <TRIGGERED_ABILITY internal="1">
    <TRIGGER value="ZONECHANGE_END" simple_qualifier="self" to_zone="ZONE_IN_PLAY" />
    <RESOLUTION_TIME_ACTION>
    ObjectDC():Set_Int(1, 0)
    </RESOLUTION_TIME_ACTION>
  </TRIGGERED_ABILITY>
  <TRIGGERED_ABILITY internal="1">
    <TRIGGER value="CONTROLLER_CHANGED" simple_qualifier="self" />
    <RESOLUTION_TIME_ACTION>
    ObjectDC():Set_Int(1, 0)
    </RESOLUTION_TIME_ACTION>
  </TRIGGERED_ABILITY>
  <TRIGGERED_ABILITY internal="1">
    <TRIGGER value="BEGINNING_OF_STEP" simple_qualifier="controller">
    return EffectController():MyTurn() ~= 0 and MTG():GetStep() == STEP_UPKEEP and ObjectDC():Get_Int(1) == 0
    </TRIGGER>
    <RESOLUTION_TIME_ACTION>
    local controller = EffectController()
    if controller ~= nil and controller:CanAfford("{5}{R}") == 1 then
       controller:BeginNewMultipleChoice()
       controller:AddMultipleChoiceAnswer( "CARD_QUERY_OPTION_YES" )
       controller:AddMultipleChoiceAnswer( "CARD_QUERY_OPTION_NO" )
       controller:AskMultipleChoiceQuestion( "CONDITIONAL_QUESTION_BODY" )
    end
    </RESOLUTION_TIME_ACTION>
    <RESOLUTION_TIME_ACTION>
    local controller = EffectController()
    if controller ~= nil then
       if controller:CanAfford("{5}{R}") == 1 and Object():GetMultipleChoiceResult() == 0 then
          ObjectDC():Set_Int(1, 1)
          controller:TapLand("{5}{R}")
       elseif EffectSource() ~= nil then
          EffectSource():Sacrifice(controller)
       end
    end
    </RESOLUTION_TIME_ACTION>
  </TRIGGERED_ABILITY>
Of course it would need to be refined if ObjectDC register #1 is already needed for something else (maybe defining a constant COMPARTMENT_ID_ALREADY_ECHOED or similar) or if you plan on adding Thick-Skinned Goblin to the mix. In the latter case I would suggest to rewrite the query completely so that it has 3 answers:

Re: Card Creation Request Thread

PostPosted: 25 May 2013, 14:41
by becauseafrica
becauseafrica wrote:I have request for Spectral Procession and Kami of False Hope
thank's a lot
still waiting for the help=)

Re: Card Creation Request Thread

PostPosted: 25 May 2013, 14:54
by thefiremind
DotP2013 doesn't have full support for hybrid monocolored mana: it understands what it means but has no texture to show, so Spectral Procession's mana cost will be invisible on the card. If you don't care and you want to use it anyway, here it is, together with the Kami.

Re: Card Creation Request Thread

PostPosted: 25 May 2013, 15:02
by Vasht
Vasht wrote:Hi,

i would like to request The Tabernacle at Pendrell Vale, Chalice of the Void and Tyrant of Discord :). Thx
Second Try :wink:

Re: Card Creation Request Thread

PostPosted: 25 May 2013, 16:45
by thefiremind
Vasht wrote:Hi,

i would like to request The Tabernacle at Pendrell Vale, Chalice of the Void and Tyrant of Discord :). Thx
DotP games can't display 2 {X} in the same cost, they'll display just one, which is highly confusing for those who don't know the card enough.
Here are the other 2 cards.

Re: Card Creation Request Thread

PostPosted: 25 May 2013, 18:33
by BloodReyvyn
Oy... lol. Maybe I just need a fresh pair of eyes to look at this. Still crashing the game if I try to start a match.

This is the entire triggered ability. Did I miss something or put something in the wrong place?

Code: Select all
  <TRIGGERED_ABILITY>
    <LOCALISED_TEXT LanguageCode="en-US"><![CDATA[Whenever you’re dealt damage, sacrifice that many nontoken permanents. If you can’t, you lose the game.]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="fr-FR"><![CDATA[Whenever you’re dealt damage, sacrifice that many nontoken permanents. If you can’t, you lose the game.]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="es-ES"><![CDATA[Whenever you’re dealt damage, sacrifice that many nontoken permanents. If you can’t, you lose the game.]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="de-DE"><![CDATA[Whenever you’re dealt damage, sacrifice that many nontoken permanents. If you can’t, you lose the game.]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="it-IT"><![CDATA[Whenever you’re dealt damage, sacrifice that many nontoken permanents. If you can’t, you lose the game.]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="jp-JA"><![CDATA[Whenever you’re dealt damage, sacrifice that many nontoken permanents. If you can’t, you lose the game.]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="ko-KR"><![CDATA[Whenever you’re dealt damage, sacrifice that many nontoken permanents. If you can’t, you lose the game.]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="ru-RU"><![CDATA[Whenever you’re dealt damage, sacrifice that many nontoken permanents. If you can’t, you lose the game.]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="pt-BR"><![CDATA[Whenever you’re dealt damage, sacrifice that many nontoken permanents. If you can’t, you lose the game.]]></LOCALISED_TEXT>
        <TRIGGER value="PLAYER_TOOK_DAMAGE" simple_qualifier="controller" />
        <RESOLUTION_TIME_ACTION>
        local player = EffectController()
        local amount = Damage():GetAmount()

        MTG():ClearFilterMarkedObjectsInZone( ZONE_IN_PLAY )
        local filter = Object():GetFilter()

        filter:NotTargetted()
        filter:SetPlayer( player )
        filter:SetZone( ZONE_IN_PLAY )
        filter:AddCardType( CARD_TYPE_ARTIFACT )
        filter:AddCardType( CARD_TYPE_ENCHANTMENT )
        filter:AddCardType( CARD_TYPE_LAND )
        filter:AddCardType( CARD_TYPE_CREATURE )
        filter:AddCardType( CARD_TYPE_PLANESWALKER )
        filter:SetHint( HINT_ENEMY, player )   
        local filter_count = filter:EvaluateObjects()
        if filter_count &gt; 0 then
           for i=0,filter_count-1 do
             local candidate = filter:GetNthEvaluatedObject(i)
               if candidate:IsToken() == 0 then
                 candidate:MarkForFilter()
               end
           end
         end
         filter:SetMarkedObjectsOnly()

        total = filter:Count()
        if total &lt; amount then
          player:LoseGame()
        else
           player:SetTargetCount( amount )
           EffectDC():Set_Int(1, amount)
            for i=0,amount-1 do
               player:SetTargetPrompt( i, "CARD_QUERY_CHOOSE_PERMANENT_TO_SACRIFICE" )
            end
            player:ChooseTargets( NO_VALIDATION, EffectDC():Make_Targets(0) )
        end
        </RESOLUTION_TIME_ACTION>
        <RESOLUTION_TIME_ACTION>
        local amount = EffectDC():Get_Int(1)
        if amount &gt; 0 then
           for i = 0,amount-1 do
              local target = EffectDC():Get_Targets(0):Get_CardPtr(i)
              if target ~= nil then
                 target:Sacrifice(EffectController())
              end
           end
        end
        </RESOLUTION_TIME_ACTION>
  </TRIGGERED_ABILITY>

Re: Card Creation Request Thread

PostPosted: 25 May 2013, 18:48
by thefiremind
You forgot
Code: Select all
filter:Clear()
before the NotTargetted() line.

Re: Card Creation Request Thread

PostPosted: 25 May 2013, 19:32
by BloodReyvyn
Still crashes to desktop...

Here's the entire code, just in case something got screwed up elsewhere.

Code: Select all
<?xml version='1.0' encoding='UTF-8'?>
<CARD_V2>
  <FILENAME text="LICH_979701" />
  <CARDNAME text="LICH" />
  <TITLE>
    <LOCALISED_TEXT LanguageCode="en-US"><![CDATA[Lich]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="fr-FR"><![CDATA[Lich]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="es-ES"><![CDATA[Lich]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="de-DE"><![CDATA[Lich]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="it-IT"><![CDATA[Lich]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="jp-JA"><![CDATA[Lich]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="ko-KR"><![CDATA[Lich]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="ru-RU"><![CDATA[Lich]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="pt-BR"><![CDATA[Lich]]></LOCALISED_TEXT>
  </TITLE>
  <MULTIVERSEID value="979701" />
  <ARTID value="A979701" />
  <ARTIST name="DottorFile@DeviantArt" />
  <CASTING_COST cost="{B}{B}{B}{B}" />
  <TYPE metaname="Enchantment" />
  <EXPANSION value="ME4" />
  <RARITY metaname="R" />
  <TRIGGERED_ABILITY dangerous="0" filter_zone="ZONE_IN_PLAY">
    <LOCALISED_TEXT LanguageCode="en-US"><![CDATA[As Lich enters the battlefield, you lose life equal to your life total.]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="fr-FR"><![CDATA[As Lich enters the battlefield, you lose life equal to your life total.]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="es-ES"><![CDATA[As Lich enters the battlefield, you lose life equal to your life total.]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="de-DE"><![CDATA[As Lich enters the battlefield, you lose life equal to your life total.]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="it-IT"><![CDATA[As Lich enters the battlefield, you lose life equal to your life total.]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="jp-JA"><![CDATA[As Lich enters the battlefield, you lose life equal to your life total.]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="ko-KR"><![CDATA[As Lich enters the battlefield, you lose life equal to your life total.]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="ru-RU"><![CDATA[As Lich enters the battlefield, you lose life equal to your life total.]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="pt-BR"><![CDATA[As Lich enters the battlefield, you lose life equal to your life total.]]></LOCALISED_TEXT>
            <RESOLUTION_TIME_ACTION>
            local life_total = EffectController():GetLifeTotal()
            if life_total &gt; 0 then
               EffectController():SetLifeTotal(0)
            end
            </RESOLUTION_TIME_ACTION>  </TRIGGERED_ABILITY>
  <STATIC_ABILITY>
    <LOCALISED_TEXT LanguageCode="en-US"><![CDATA[You don’t lose the game for having 0 or less life.]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="fr-FR"><![CDATA[You don’t lose the game for having 0 or less life.]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="es-ES"><![CDATA[You don’t lose the game for having 0 or less life.]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="de-DE"><![CDATA[You don’t lose the game for having 0 or less life.]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="it-IT"><![CDATA[You don’t lose the game for having 0 or less life.]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="jp-JA"><![CDATA[You don’t lose the game for having 0 or less life.]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="ko-KR"><![CDATA[You don’t lose the game for having 0 or less life.]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="ru-RU"><![CDATA[You don’t lose the game for having 0 or less life.]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="pt-BR"><![CDATA[You don’t lose the game for having 0 or less life.]]></LOCALISED_TEXT>
    <CONTINUOUS_ACTION layer="8">
      EffectController():GetCurrentCharacteristics():Bool_Set( PLAYER_CHARACTERISTIC_DOESNT_DIE_ON_ZERO_LIFE, 1 )
    </CONTINUOUS_ACTION>
  </STATIC_ABILITY>
  <TRIGGERED_ABILITY>
    <LOCALISED_TEXT LanguageCode="en-US"><![CDATA[If you would gain life, draw that many cards instead.]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="fr-FR"><![CDATA[If you would gain life, draw that many cards instead.]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="es-ES"><![CDATA[If you would gain life, draw that many cards instead.]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="de-DE"><![CDATA[If you would gain life, draw that many cards instead.]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="it-IT"><![CDATA[If you would gain life, draw that many cards instead.]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="jp-JA"><![CDATA[If you would gain life, draw that many cards instead.]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="ko-KR"><![CDATA[If you would gain life, draw that many cards instead.]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="ru-RU"><![CDATA[If you would gain life, draw that many cards instead.]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="pt-BR"><![CDATA[If you would gain life, draw that many cards instead.]]></LOCALISED_TEXT>
      <TRIGGER value="PLAYER_GAINED_LIFE" simple_qualifier="controller">
        if TriggerPlayer() ~= nil then
           override = true
           return true
        end
        return false
        </TRIGGER>
        <RESOLUTION_TIME_ACTION>
        local NumCards = GetAmount()
        while (NumCards &gt; 0) do
           NumCards = NumCards - 1
           EffectController():DrawCard()
        end
      </RESOLUTION_TIME_ACTION>
  </TRIGGERED_ABILITY>
  <TRIGGERED_ABILITY>
    <LOCALISED_TEXT LanguageCode="en-US"><![CDATA[Whenever you’re dealt damage, sacrifice that many nontoken permanents. If you can’t, you lose the game.]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="fr-FR"><![CDATA[Whenever you’re dealt damage, sacrifice that many nontoken permanents. If you can’t, you lose the game.]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="es-ES"><![CDATA[Whenever you’re dealt damage, sacrifice that many nontoken permanents. If you can’t, you lose the game.]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="de-DE"><![CDATA[Whenever you’re dealt damage, sacrifice that many nontoken permanents. If you can’t, you lose the game.]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="it-IT"><![CDATA[Whenever you’re dealt damage, sacrifice that many nontoken permanents. If you can’t, you lose the game.]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="jp-JA"><![CDATA[Whenever you’re dealt damage, sacrifice that many nontoken permanents. If you can’t, you lose the game.]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="ko-KR"><![CDATA[Whenever you’re dealt damage, sacrifice that many nontoken permanents. If you can’t, you lose the game.]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="ru-RU"><![CDATA[Whenever you’re dealt damage, sacrifice that many nontoken permanents. If you can’t, you lose the game.]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="pt-BR"><![CDATA[Whenever you’re dealt damage, sacrifice that many nontoken permanents. If you can’t, you lose the game.]]></LOCALISED_TEXT>
        <TRIGGER value="PLAYER_TOOK_DAMAGE" simple_qualifier="controller" />
        <RESOLUTION_TIME_ACTION>
        local player = EffectController()
        local amount = Damage():GetAmount()

        MTG():ClearFilterMarkedObjectsInZone( ZONE_IN_PLAY )
        local filter = Object():GetFilter()

        filter:Clear()
        filter:NotTargetted()
        filter:SetPlayer( player )
        filter:SetZone( ZONE_IN_PLAY )
        filter:AddCardType( CARD_TYPE_ARTIFACT )
        filter:AddCardType( CARD_TYPE_ENCHANTMENT )
        filter:AddCardType( CARD_TYPE_LAND )
        filter:AddCardType( CARD_TYPE_CREATURE )
        filter:AddCardType( CARD_TYPE_PLANESWALKER )
        filter:SetHint( HINT_ENEMY, player )   
        local filter_count = filter:EvaluateObjects()
        if filter_count &gt; 0 then
           for i=0,filter_count-1 do
             local candidate = filter:GetNthEvaluatedObject(i)
               if candidate:IsToken() == 0 then
                 candidate:MarkForFilter()
               end
           end
         end
         filter:SetMarkedObjectsOnly()

        total = filter:Count()
        if total &lt; amount then
          player:LoseGame()
        else
           player:SetTargetCount( amount )
           EffectDC():Set_Int(1, amount)
            for i=0,amount-1 do
               player:SetTargetPrompt( i, "CARD_QUERY_CHOOSE_PERMANENT_TO_SACRIFICE" )
            end
            player:ChooseTargets( NO_VALIDATION, EffectDC():Make_Targets(0) )
        end
        </RESOLUTION_TIME_ACTION>

        <RESOLUTION_TIME_ACTION>
        local amount = EffectDC():Get_Int(1)
        if amount &gt; 0 then
           for i = 0,amount-1 do
              local target = EffectDC():Get_Targets(0):Get_CardPtr(i)
              if target ~= nil then
                 target:Sacrifice(EffectController())
              end
           end
        end
        </RESOLUTION_TIME_ACTION>
  </TRIGGERED_ABILITY>
  <TRIGGERED_ABILITY>
    <LOCALISED_TEXT LanguageCode="en-US"><![CDATA[When Lich is put into a graveyard from the battlefield, you lose the game.]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="fr-FR"><![CDATA[When Lich is put into a graveyard from the battlefield, you lose the game.]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="es-ES"><![CDATA[When Lich is put into a graveyard from the battlefield, you lose the game.]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="de-DE"><![CDATA[When Lich is put into a graveyard from the battlefield, you lose the game.]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="it-IT"><![CDATA[When Lich is put into a graveyard from the battlefield, you lose the game.]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="jp-JA"><![CDATA[When Lich is put into a graveyard from the battlefield, you lose the game.]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="ko-KR"><![CDATA[When Lich is put into a graveyard from the battlefield, you lose the game.]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="ru-RU"><![CDATA[When Lich is put into a graveyard from the battlefield, you lose the game.]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="pt-BR"><![CDATA[When Lich is put into a graveyard from the battlefield, you lose the game.]]></LOCALISED_TEXT>
        <TRIGGER value="ZONECHANGE_BEGIN" simple_qualifier="self" to_zone="ZONE_GRAVEYARD" from_zone="ZONE_IN_PLAY" />
        <RESOLUTION_TIME_ACTION>
        EffectController():LoseGame()
        </RESOLUTION_TIME_ACTION>
  </TRIGGERED_ABILITY>
</CARD_V2>
On a hunch, I swapped the code for the older (flawed) code that worked and it still crashes.... Hmmm will start to look for whatever I may have changed other than those 2 actions.