It is currently 20 Apr 2024, 05:43
   
Text Size

Report cards error here

Moderator: CCGHQ Admins

Re: Report cards error here

Postby GrovyleXShinyCelebi » 09 Jul 2013, 19:48

I think I ran into another issue:

I'm working on a metalcraft code, and again I don't get why it's not working...

Code: Select all
  <STATIC_ABILITY>
   <CONTINUOUS_ACTION layer="7C" filter_id="0">
    if EffectSource() ~= nil then
        local filter = ClearFilter()
       filter:Add( FE_TYPE, OP_IS, CARD_TYPE_ARTIFACT )
        filter:Add( FE_CONTROLLER, OP_IS, EffectController())
       local total = filter:Count()
        if total &gt; 2 then   
       local characteristics = EffectSource():GetCurrentCharacteristics()
          characteristics:Bool_Set( CHARACTERISTIC_FLYING )
       end
    end
  </CONTINUOUS_ACTION>
  </STATIC_ABILITY>
Anyone know what's going on? Thanks...
User avatar
GrovyleXShinyCelebi
 
Posts: 294
Joined: 12 Jun 2013, 18:23
Has thanked: 14 times
Been thanked: 37 times

Re: Report cards error here

Postby thefiremind » 09 Jul 2013, 20:06

Bool_Set needs 2 parameters, the characteristic and 1 (for switching on) or 0 (for switching off):
Code: Select all
characteristics:Bool_Set( CHARACTERISTIC_FLYING, 1 )
< Former DotP 2012/2013/2014 modder >
Currently busy with life...
User avatar
thefiremind
Programmer
 
Posts: 3515
Joined: 07 Nov 2011, 10:55
Has thanked: 118 times
Been thanked: 721 times

Re: Report cards error here

Postby GrovyleXShinyCelebi » 10 Jul 2013, 14:01

Hmmm... there's something else missing and I don't know what... As far as I know, by checking official cards like Coat of Arms or Biovisionary that also use filters that part is correct, but the code still doesn't seem to trigger even if I own three or more artifacts...
User avatar
GrovyleXShinyCelebi
 
Posts: 294
Joined: 12 Jun 2013, 18:23
Has thanked: 14 times
Been thanked: 37 times

Re: Report cards error here

Postby thefiremind » 10 Jul 2013, 14:37

Then you should tell me which card you are trying to implement, because maybe I'm assuming something is OK when it isn't.
< Former DotP 2012/2013/2014 modder >
Currently busy with life...
User avatar
thefiremind
Programmer
 
Posts: 3515
Joined: 07 Nov 2011, 10:55
Has thanked: 118 times
Been thanked: 721 times

Re: Report cards error here

Postby GrovyleXShinyCelebi » 10 Jul 2013, 15:57

It's Snapsail Glider.

Here's the full code:

Code: Select all
<?xml version='1.0' encoding='UTF-8'?>
<CARD_V2 ExportVersion="1">
  <FILENAME text="SNAPSAIL_GLIDER_209010" />
  <CARDNAME text="SNAPSAIL_GLIDER" />
  <TITLE>
    <LOCALISED_TEXT LanguageCode="en-US"><![CDATA[Snapsail Glider]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="fr-FR"><![CDATA[Planeur claquevoile]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="es-ES"><![CDATA[Deslizador velachasquido]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="de-DE"><![CDATA[Klappsegelgleiter]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="it-IT"><![CDATA[Aliante con Vele a Scatto]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="jp-JA"><![CDATA[嵌め乗りの滑空者]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="ko-KR"><![CDATA[Snapsail Glider]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="ru-RU"><![CDATA[Летяга Щелкающих Парусов]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="pt-BR"><![CDATA[Planador de Aerovelas]]></LOCALISED_TEXT>
  </TITLE>
  <MULTIVERSEID value="209010" />
  <ARTID value="209010" />
  <ARTIST name="Efrem Palacios" />
  <CASTING_COST cost="{3}" />
  <FLAVOURTEXT>
    <LOCALISED_TEXT LanguageCode="en-US"><![CDATA[Built from a reconfigured thresher, it charges with light reflected off the golden plain, ready to take to the air in case of danger.]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="fr-FR"><![CDATA[Construit à partir d’une batteuse recyclée, il se recharge avec la lumière reflétée par la plaine dorée, prêt à prendre les airs en cas de danger.]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="es-ES"><![CDATA[Construido con un trillador reconfigurado, se carga con luz reflejada de la llanura dorada, listo para salir volando en caso de peligro.]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="de-DE"><![CDATA[Er wird aus einem umgestalteten Drescher gebaut und greift mit Licht an, das von der goldenen Ebene reflektiert wird; droht Gefahr, erhebt er sich schnell in die Luft.]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="it-IT"><![CDATA[Costruito da una trebbiatrice riconfigurata, si carica con la luce riflessa dalle pianure dorate, sempre pronto a prendere il volo in caso di pericolo.]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="jp-JA"><![CDATA[打つものを再構成して作られたそれは、金色の平原に光る反射を合図に突撃し、危険の際に空から駆けつける。]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="ko-KR"><![CDATA[Built from a reconfigured thresher, it charges with light reflected off the golden plain, ready to take to the air in case of danger.]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="ru-RU"><![CDATA[Созданная из переделанной молотилки, она заряжается светом, отражающимся от золотой равнины, готовая взлететь в случае приближения опасности.]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="pt-BR"><![CDATA[Construído a partir de um debulhador reconfigurado, ele ataca com luz refletida do descampado dourado, pronto para alçar voo em caso de perigo.]]></LOCALISED_TEXT>
  </FLAVOURTEXT>
  <TYPE metaname="Artifact" />
  <TYPE metaname="Creature" />
  <SUB_TYPE metaname="Construct" />
  <EXPANSION value="SOM" />
  <RARITY metaname="C" />
  <POWER value="2" />
  <TOUGHNESS value="2" />
  <STATIC_ABILITY>
    <LOCALISED_TEXT LanguageCode="en-US"><![CDATA[Metalcraft — Snapsail Glider has flying as long as you control three or more artifacts.]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="fr-FR"><![CDATA[Art des métaux — Le Planeur claquevoile a le vol tant que vous contrôlez au moins trois artefacts.]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="es-ES"><![CDATA[Metalurgia — El Deslizador velachasquido tiene la habilidad de volar mientras controles tres o más artefactos.]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="de-DE"><![CDATA[Metallkunst — Der Klappsegelgleiter hat Flugfähigkeit, solange du drei oder mehr Artefakte kontrollierst.]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="it-IT"><![CDATA[Metallurgia — L’Aliante con Vele a Scatto ha volare fintanto che controlli tre o più artefatti.]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="jp-JA"><![CDATA[金属術 ― 嵌め乗りの滑空者は、あなたが3つ以上のアーティファクトをコントロールしているかぎり飛行を持つ。]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="ko-KR"><![CDATA[Metalcraft — Snapsail Glider has flying as long as you control three or more artifacts.]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="ru-RU"><![CDATA[Работа по металлу — Летяга Щелкающих Парусов имеет Полет, пока вы контролируете не менее трех артефактов.]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="pt-BR"><![CDATA[Maestria com Metais — Planador de Aerovelas terá voar enquanto você controlar três ou mais artefatos.]]></LOCALISED_TEXT>
   <CONTINUOUS_ACTION layer="7C">
    if EffectSource() ~= nil then
        local filter = ClearFilter()
       filter:Add( FE_TYPE, OP_IS, CARD_TYPE_ARTIFACT )
        filter:Add( FE_CONTROLLER, OP_IS, EffectController())
       local total = filter:Count()
        if total &gt; 2 then   
         local characteristics = EffectSource():GetCurrentCharacteristics()
          characteristics:Bool_Set( CHARACTERISTIC_FLYING, 1 )
       end
    end
  </CONTINUOUS_ACTION>
  </STATIC_ABILITY>
  <SFX text="COMBAT_CLAW_LARGE_ATTACK" power_boundary_min="4" power_boundary_max="-1" />
  <SFX text="COMBAT_CLAW_SMALL_ATTACK" power_boundary_min="1" power_boundary_max="3" />
</CARD_V2>
Another thing, do you know where the card query texts are located (those ones that say "Choose target creature for *insert effect here*" and stuff like that when you're choosing a target or answering a query)? I've checked Text_Permanent but can't find them anywhere, and I want to add some more...

Thanks!
User avatar
GrovyleXShinyCelebi
 
Posts: 294
Joined: 12 Jun 2013, 18:23
Has thanked: 14 times
Been thanked: 37 times

Re: Report cards error here

Postby thefiremind » 10 Jul 2013, 18:10

GrovyleXShinyCelebi wrote:It's Snapsail Glider.

Here's the full code:
[...]
Abilities should use layer="6", not "7C" which is for power/toughness modifications. But as far as I know, this shouldn't prevent the card from working, it should just make some interactions with other cards wrong. Anyway, fix that, I can't see anything else to fix.

Look here for more information about layers (the topic is outdated but still correct for the most part).

GrovyleXShinyCelebi wrote:Another thing, do you know where the card query texts are located (those ones that say "Choose target creature for *insert effect here*" and stuff like that when you're choosing a target or answering a query)? I've checked Text_Permanent but can't find them anywhere, and I want to add some more...
Your custom WAD probably doesn't have the TEXT_PERMANENT directory yet, if you never used it... look inside some other mods (TEXT_PERMANENT is inside DATA_DLC_TFM_OTHER in my mod) for examples.
< Former DotP 2012/2013/2014 modder >
Currently busy with life...
User avatar
thefiremind
Programmer
 
Posts: 3515
Joined: 07 Nov 2011, 10:55
Has thanked: 118 times
Been thanked: 721 times

Re: Report cards error here

Postby GrovyleXShinyCelebi » 11 Jul 2013, 15:32

Alright, I got one last card for you to check:

Empyrial Archangel

Code: Select all
<?xml version='1.0' encoding='UTF-8'?>
<CARD_V2 ExportVersion="1">
  <FILENAME text="EMPYRIAL_ARCHANGEL_175104" />
  <CARDNAME text="EMPYRIAL_ARCHANGEL" />
  <TITLE>
    <LOCALISED_TEXT LanguageCode="en-US"><![CDATA[Empyrial Archangel]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="fr-FR"><![CDATA[Archange de l’empyrée]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="es-ES"><![CDATA[Arcángel empírea]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="de-DE"><![CDATA[Himmlischer Erzengel]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="it-IT"><![CDATA[Arcangelo Empireo]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="jp-JA"><![CDATA[浄火の大天使]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="ko-KR"><![CDATA[Empyrial Archangel]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="ru-RU"><![CDATA[Архангел Небесного Огня]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="pt-BR"><![CDATA[Arcanjo Empírico]]></LOCALISED_TEXT>
  </TITLE>
  <MULTIVERSEID value="175104" />
  <ARTID value="175104" />
  <ARTIST name="Greg Staples" />
  <CASTING_COST cost="{4}{G}{W}{W}{U}" />
  <FLAVOURTEXT>
    <LOCALISED_TEXT LanguageCode="en-US"><![CDATA[Her wings are the prayers of the devoted; her sword, the despair of the vile.]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="fr-FR"><![CDATA[Ses ailes sont les prières des fidèles ; son épée, le désespoir des infâmes.]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="es-ES"><![CDATA[Sus alas son las plegarias de los devotos, su espada la desesperación de los malvados.]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="de-DE"><![CDATA[Seine Flügel sind die Gebete der Ergebenen, seine Schwert die Verzweiflung der Bösen.]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="it-IT"><![CDATA[Le sue ali sono le preghiere dei devoti; la sua spada, la disperazione degli abietti.]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="jp-JA"><![CDATA[彼女の翼は信者の祈りで、彼女の剣は卑しき者の絶望だ。]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="ko-KR"><![CDATA[Her wings are the prayers of the devoted; her sword, the despair of the vile.]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="ru-RU"><![CDATA[Ее крылья молитвы правоверных, ее меч отчаяние нечестивцев.]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="pt-BR"><![CDATA[Suas asas são as preces de seus devotos; sua espada, o desespero dos maus.]]></LOCALISED_TEXT>
  </FLAVOURTEXT>
  <TYPE metaname="Creature" />
  <SUB_TYPE metaname="Angel" />
  <EXPANSION value="ALA" />
  <RARITY metaname="M" />
  <POWER value="5" />
  <TOUGHNESS value="8" />
  <STATIC_ABILITY>
    <LOCALISED_TEXT LanguageCode="en-US"><![CDATA[Flying, shroud]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="fr-FR"><![CDATA[Vol, linceul]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="es-ES"><![CDATA[Vuela, velo.]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="de-DE"><![CDATA[Fliegend, Verhüllt]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="it-IT"><![CDATA[Volare, velo]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="jp-JA"><![CDATA[飛行、被覆]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="ko-KR"><![CDATA[Flying, shroud]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="ru-RU"><![CDATA[Полет, Пелена]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="pt-BR"><![CDATA[Voar, manto]]></LOCALISED_TEXT>
  <INTRINSIC characteristic="CHARACTERISTIC_FLYING" />
  <INTRINSIC characteristic="CHARACTERISTIC_SHROUD" />
  </STATIC_ABILITY>
  <TRIGGERED_ABILITY replacement_effect="1">
    <LOCALISED_TEXT LanguageCode="en-US"><![CDATA[All damage that would be dealt to you is dealt to Empyrial Archangel instead.]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="fr-FR"><![CDATA[Toutes les blessures qui devraient vous être infligées sont infligées à l’Archange de l’empyrée à la place.]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="es-ES"><![CDATA[Todo el daño que se te fuera a hacer, en vez de eso, se le hace a la Arcángel empírea.]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="de-DE"><![CDATA[Aller Schaden, der dir zugefügt würde, wird stattdessen dem Himmlischen Erzengel zugefügt.]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="it-IT"><![CDATA[Tutto il danno che ti verrebbe inflitto viene invece inflitto all’Arcangelo Empireo.]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="jp-JA"><![CDATA[あなたに与えられるすべてのダメージは、代わりに浄火の大天使に与えられる。]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="ko-KR"><![CDATA[All damage that would be dealt to you is dealt to Empyrial Archangel instead.]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="ru-RU"><![CDATA[Все повреждения, которые должны быть нанесены вам, наносятся Архангелу Небесного Огня вместо этого.]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="pt-BR"><![CDATA[Todo o dano que seria causado a você, em vez disso, é causado a Arcanjo Empírico.]]></LOCALISED_TEXT>
   <TRIGGER value="PLAYER_TAKES_DAMAGE" pre_trigger="1">
    return TriggerPlayer() == EffectController()
    </TRIGGER>
   <RESOLUTION_TIME_ACTION>
    if EffectController() ~= nil then
       Damage():RedirectAllTo( EffectSource())
    end
   </RESOLUTION_TIME_ACTION>
  </TRIGGER_ABILITY>
  <SFX text="COMBAT_ANGEL_LARGE_ATTACK" power_boundary_min="4" power_boundary_max="-1" />
  <SFX text="COMBAT_ANGEL_SMALL_ATTACK" power_boundary_min="1" power_boundary_max="3" />
</CARD_V2>
Otherwise, I gotta give a huge thanks to you, Mr. thefiremind, and others who have helped me with all of this LUA stuff. Alot of the cards I made wouldn't have been possible without your help :D

I'm almost done coding in cards, but my mod still has alot of bugs. Frankly, I just want to upload a beta of it first here and debug later after I've gotten it up and running.

Otherwise, many thanks!
User avatar
GrovyleXShinyCelebi
 
Posts: 294
Joined: 12 Jun 2013, 18:23
Has thanked: 14 times
Been thanked: 37 times

Re: Report cards error here

Postby thefiremind » 11 Jul 2013, 15:56

GrovyleXShinyCelebi wrote:Alright, I got one last card for you to check:

Empyrial Archangel
The trigger needs to be updated to DotP2014, since PLAYER_TAKES_DAMAGE doesn't exist anymore. You also want to verify that EffectSource isn't nil, since it's the archangel that takes the damage.
Code: Select all
    <TRIGGER value="SOURCE_DEALS_DAMAGE_TO_PLAYER" pre_trigger="1">
    return SecondaryPlayer() == EffectController()
    </TRIGGER>
    <RESOLUTION_TIME_ACTION>
    if EffectSource() ~= nil then
       Damage():RedirectAllTo( EffectSource() )
    end
    </RESOLUTION_TIME_ACTION>
< Former DotP 2012/2013/2014 modder >
Currently busy with life...
User avatar
thefiremind
Programmer
 
Posts: 3515
Joined: 07 Nov 2011, 10:55
Has thanked: 118 times
Been thanked: 721 times

Re: Report cards error here

Postby gorem2k » 25 Jul 2013, 01:08

need help with Hokori, Dust Drinker.

Code: Select all
  <TRIGGERED_ABILITY replacement_query="1">
    <LOCALISED_TEXT LanguageCode="en-US"><![CDATA[At the beginning of each player’s upkeep, that player untaps a land he or she controls.]]></LOCALISED_TEXT>
    <TRIGGER value="BEGINNING_OF_PLAYERS_STEP">
    return MTG():GetStep() == STEP_UPKEEP
    </TRIGGER>
    <TARGET_DEFINITION id="0">
    local filter = ClearFilter()
    filter:Add( FE_TYPE, OP_IS, CARD_TYPE_LAND )
    </TARGET_DEFINITION>
    <TARGET tag="CARD_QUERY_OPTION_UNTAP_PERMANENT_YOU_CONTROL" definition="0" compartment="0" count="1" />
    <RESOLUTION_TIME_ACTION>
    local target = EffectDC():Get_Targets(0):Get_CardPtr(0)
    if target ~= nil then   
       target:Untap() 
    end
    </RESOLUTION_TIME_ACTION>
  </TRIGGERED_ABILITY>
My current code won't let player choose HIS/HER land to untap during HIS/HER upkeep step.
gorem2k
 
Posts: 464
Joined: 01 Apr 2013, 04:21
Has thanked: 48 times
Been thanked: 33 times

Re: Report cards error here

Postby thefiremind » 25 Jul 2013, 08:31

When there's no "target" word in the text, then you shouldn't use TARGET blocks. There is a function for asking a target to another player (see Evangelize), but it would be wrong here: you would prevent a player from untapping a land with shroud.

Code: Select all
  <TRIGGERED_ABILITY replacement_query="1">
    <LOCALISED_TEXT LanguageCode="en-US"><![CDATA[At the beginning of each player’s upkeep, that player untaps a land he or she controls.]]></LOCALISED_TEXT>
    <TRIGGER value="BEGINNING_OF_PLAYERS_STEP">
    return MTG():GetStep() == STEP_UPKEEP
    </TRIGGER>
    <RESOLUTION_TIME_ACTION>
    local filter = ClearFilter()
    local player = TriggerPlayer()
    filter:Add( FE_TYPE, OP_IS, CARD_TYPE_LAND )
    filter:Add( FE_CONTROLLER, OP_IS, player )
    player:ChooseItem( "CARD_QUERY_CHOOSE_LAND_TO_UNTAP", EffectDC():Make_Targets(0) )
    </RESOLUTION_TIME_ACTION>
    <RESOLUTION_TIME_ACTION>
    local target = EffectDC():Get_Targets(0):Get_CardPtr(0)
    if target ~= nil then   
       target:Untap() 
    end
    </RESOLUTION_TIME_ACTION>
  </TRIGGERED_ABILITY>
< Former DotP 2012/2013/2014 modder >
Currently busy with life...
User avatar
thefiremind
Programmer
 
Posts: 3515
Joined: 07 Nov 2011, 10:55
Has thanked: 118 times
Been thanked: 721 times

Re: Report cards error here

Postby gorem2k » 26 Jul 2013, 02:20

thefiremind wrote:When there's no "target" word in the text, then you shouldn't use TARGET blocks. There is a function for asking a target to another player (see Evangelize), but it would be wrong here: you would prevent a player from untapping a land with shroud.
Thanks!

I have another problem with Flash Foliage.

Do you know how to put a token in play, blocking a creature?

Code: Select all
  <SPELL_ABILITY>
    <LOCALISED_TEXT LanguageCode="en-US"><![CDATA[Cast Flash Foliage only during combat after blockers are declared.]]></LOCALISED_TEXT>
    <AVAILABILITY>
    return ( MTG():GetPhase() == PHASE_COMBAT and MTG():GetStep() &gt;= STEP_DECLARE_BLOCKERS )
    </AVAILABILITY>
  </SPELL_ABILITY>
  <SPELL_ABILITY>
    <LOCALISED_TEXT LanguageCode="en-US"><![CDATA[Put a 1/1 green Saproling creature token onto the battlefield blocking target creature attacking you.]]></LOCALISED_TEXT>
    <TARGET tag="CARD_QUERY_CHOOSE_CREATURE_BLOCK" definition="0" compartment="0" count="1" />
    <TARGET_DEFINITION id="0">
    local filter = ClearFilter()
    filter:Add( FE_TYPE, OP_IS, CARD_TYPE_CREATURE )
    filter:Add( FE_IS_ATTACKING, true )
    filter:Add( FE_CONTROLLER, OP_NOT, EffectController() )
    </TARGET_DEFINITION>
    <RESOLUTION_TIME_ACTION>
    local target = EffectDC():Get_Targets(0):Get_CardPtr(0)
    if target ~= nil then
      MTG():PutTokensOntoBattlefield( "TOKEN_SAPROLING_1_1_G_350772", 1, EffectController() )
      -- PutOntoBattlefieldBlocking
    end
    </RESOLUTION_TIME_ACTION>
  </SPELL_ABILITY>
  <SPELL_ABILITY>
    <LOCALISED_TEXT LanguageCode="en-US"><![CDATA[Draw a card.]]></LOCALISED_TEXT>
    <RESOLUTION_TIME_ACTION>
    EffectController():DrawCards(1)
    </RESOLUTION_TIME_ACTION>
  </SPELL_ABILITY>
 
EDIT: my second attempt is semi-working. the token should block without asking.

Flash Foliage , take 2 | Open
Code: Select all
  <SPELL_ABILITY>
    <LOCALISED_TEXT LanguageCode="en-US"><![CDATA[Cast Flash Foliage only during combat after blockers are declared.]]></LOCALISED_TEXT>
    <AVAILABILITY>
    return ( MTG():GetPhase() == PHASE_COMBAT and MTG():GetStep() &gt;= STEP_DECLARE_BLOCKERS )
    </AVAILABILITY>
  </SPELL_ABILITY>
  <SPELL_ABILITY>
    <LOCALISED_TEXT LanguageCode="en-US"><![CDATA[Put a 1/1 green Saproling creature token onto the battlefield blocking target creature attacking you.]]></LOCALISED_TEXT>
    <TARGET tag="CARD_QUERY_CHOOSE_CREATURE_BLOCK" definition="0" compartment="0" count="1" />
    <TARGET_DEFINITION id="0">
    local filter = ClearFilter()
    filter:Add( FE_TYPE, OP_IS, CARD_TYPE_CREATURE )
    filter:Add( FE_IS_ATTACKING, true )
    filter:Add( FE_CONTROLLER, OP_NOT, EffectController() )
    </TARGET_DEFINITION>
    <RESOLUTION_TIME_ACTION>
    MTG():PutTokensOntoBattlefield( "TOKEN_SAPROLING_1_1_G_350772", 1, EffectController() )
    </RESOLUTION_TIME_ACTION>
  </SPELL_ABILITY>
  <SPELL_ABILITY>
    <RESOLUTION_TIME_ACTION>
    local target = EffectDC():Get_Targets(0):Get_CardPtr(0)
    if target ~= nil then
      local filter = ClearFilter()
      filter:Add( FE_TYPE, OP_IS, CARD_TYPE_CREATURE )
      filter:Add( FE_IS_TOKEN, true )
      filter:Add( FE_CONTROLLER, OP_IS, EffectController() )
      filter:Add( FE_IS_BLOCKING, false )
      EffectController():ChooseItem( "CARD_QUERY_CHOOSE_A_CREATURE_TO_PUT_ONTO_BATTLEFIELD_BLOCKING", EffectDC():Make_Targets(1))
    end
    </RESOLUTION_TIME_ACTION>
  </SPELL_ABILITY>
  <SPELL_ABILITY>
    <RESOLUTION_TIME_ACTION>
    local target = EffectDC():Get_Targets(0):Get_CardPtr(0)
    local token = EffectDC():Get_Targets(1):Get_CardPtr(0)
    if token ~= nil then
       token:PutOntoBattlefieldBlocking( EffectController(), target )
    end
    </RESOLUTION_TIME_ACTION>
  </SPELL_ABILITY>
  <SPELL_ABILITY>
    <LOCALISED_TEXT LanguageCode="en-US"><![CDATA[Draw a card.]]></LOCALISED_TEXT>
    <RESOLUTION_TIME_ACTION>
    EffectController():DrawCards(1)
    </RESOLUTION_TIME_ACTION>
  </SPELL_ABILITY>
gorem2k
 
Posts: 464
Joined: 01 Apr 2013, 04:21
Has thanked: 48 times
Been thanked: 33 times

Re: Report cards error here

Postby thefiremind » 26 Jul 2013, 08:38

I thought about Flash Foliage, too, but the developers removed the function that allowed to declare a token without putting it onto the battlefield (it was called ObtainToken), after which the token could have been PutOntoBattlefieldBlocking. Without that (or without a PutTokensOntoBattlefieldBlocking function), I don't think that Flash Foliage could be coded 100%.

EDIT: I was wrong: I made it! :D
viewtopic.php?f=109&t=11010&p=126913#p126913
But I would have never thought about using two "put onto battlefield" effects in a row without seeing your tries.
< Former DotP 2012/2013/2014 modder >
Currently busy with life...
User avatar
thefiremind
Programmer
 
Posts: 3515
Joined: 07 Nov 2011, 10:55
Has thanked: 118 times
Been thanked: 721 times

Re: Report cards error here

Postby gorem2k » 02 Aug 2013, 00:57

I'm trying to adapt a DotP2013 card from sumomole to DotP2014 but I can't find the problem.

Kazuul, Tyrant of the Cliffs | Open
Code: Select all
  <TRIGGERED_ABILITY>
    <LOCALISED_TEXT LanguageCode="en-US"><![CDATA[Whenever a creature an opponent controls attacks, if you’re the defending player, put a 3/3 red Ogre creature token onto the battlefield unless that creature’s controller pays {3}.]]></LOCALISED_TEXT>
    <TRIGGER value="ATTACKING">
    if TriggerObject():GetController():GetTeam() ~= EffectController():GetTeam() and TriggerObject():GetPlayerAttacked() == EffectController() then
      EffectDC():Set_CardPtr(2, TriggerObject())
      EffectDC():LKIShield_CardPtr(2)
      return true
    end
    return false
    </TRIGGER>
    <RESOLUTION_TIME_ACTION>
    local attack_creature = EffectDC():Get_CardPtr(2)
    if attack_creature ~= nil then
      local player = attack_creature:GetController()
      if player:CanPayManaCost("{3}") then
         player:BeginNewMultipleChoice()   
         player:AddMultipleChoiceAnswer( "CARD_QUERY_OPTION_PAY_3" )   
         player:AddMultipleChoiceAnswer( "CARD_QUERY_OPTION_TOKEN_OGRE" )
         player:AskMultipleChoiceQuestion( "CARD_QUERY_MC_KAZUUL_TYRANT_OF_THE_CLIFFS" )
      end
    end
    </RESOLUTION_TIME_ACTION>
    <RESOLUTION_TIME_ACTION>
    local attack_creature = EffectDC():Get_CardPtr(2)
    if attack_creature ~= nil then
      local player = attack_creature:GetController()
      local decision = Object():GetMultipleChoiceResult()
      if player:CanPayManaCost("{3}") then
        if decision ~= 1 then
          player:PayManaCost("{3}")
        else
           MTG():PutTokensOntoBattlefield( "TOKEN_OGRE_3_3_197145", 1, EffectController() )
        end
      else
         MTG():PutTokensOntoBattlefield( "TOKEN_OGRE_3_3_197145", 1, EffectController() )
      end
    end
    </RESOLUTION_TIME_ACTION>
  </TRIGGERED_ABILITY>
attack_creature:GetController() doesn't seem to return the right controller.
gorem2k
 
Posts: 464
Joined: 01 Apr 2013, 04:21
Has thanked: 48 times
Been thanked: 33 times

Re: Report cards error here

Postby RiiakShiNal » 02 Aug 2013, 01:11

Why don't you save off the controller instead of the attacking creature since you don't actually need the attacking creature after you've determined that you are the player being attacked by it. That way you also don't have to shield the card pointer and it should simplify the code some.
RiiakShiNal
Programmer
 
Posts: 2185
Joined: 16 May 2011, 21:37
Has thanked: 75 times
Been thanked: 497 times

Re: Report cards error here

Postby gorem2k » 02 Aug 2013, 02:00

RiiakShiNal wrote:Why don't you save off the controller instead of the attacking creature since you don't actually need the attacking creature after you've determined that you are the player being attacked by it. That way you also don't have to shield the card pointer and it should simplify the code some.
It's supposed to trigger once for each attacking creature. I just took sumomole original xml from 2013 and changed few constants for DotP2014 equivalent names. maybe I missed a few step? I will try your suggestion but then I will have to rewrite the rest. should I start again from scratch?

EDIT:alright! it works now. thanks!

Code: Select all
    <TRIGGER value="ATTACKING">
    if TriggerObject():GetController():GetTeam() ~= EffectController():GetTeam() and TriggerObject():GetPlayerAttacked() == EffectController() then
      EffectDC():Set_PlayerPtr(2, TriggerObject():GetController())
      return true
    end
    return false
    </TRIGGER>
    <RESOLUTION_TIME_ACTION>
    local player = EffectDC():Get_PlayerPtr(2)
    if player ~= nil then
      if player:CanPayManaCost("{3}") then
         player:BeginNewMultipleChoice()   
         player:AddMultipleChoiceAnswer( "CARD_QUERY_OPTION_PAY_3" )   
         player:AddMultipleChoiceAnswer( "CARD_QUERY_OPTION_TOKEN_OGRE" )
         player:AskMultipleChoiceQuestion( "CARD_QUERY_MC_KAZUUL_TYRANT_OF_THE_CLIFFS" )
      end
    end
    </RESOLUTION_TIME_ACTION>
    <RESOLUTION_TIME_ACTION>
    local player = EffectDC():Get_PlayerPtr(2)
    if player ~= nil then
      local decision = player:GetMultipleChoiceResult()
      if player:CanPayManaCost("{3}") then
        if decision ~= 1 then
          player:PayManaCost("{3}")
        else
           MTG():PutTokensOntoBattlefield( "TOKEN_OGRE_3_3_197145", 1, EffectController() )
        end
      else
         MTG():PutTokensOntoBattlefield( "TOKEN_OGRE_3_3_197145", 1, EffectController() )
      end
    end
    </RESOLUTION_TIME_ACTION>
  </TRIGGERED_ABILITY>
gorem2k
 
Posts: 464
Joined: 01 Apr 2013, 04:21
Has thanked: 48 times
Been thanked: 33 times

PreviousNext

Return to Programming Talk

Who is online

Users browsing this forum: No registered users and 26 guests

cron

Who is online

In total there are 26 users online :: 0 registered, 0 hidden and 26 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 26 guests

Login Form