It is currently 24 Sep 2018, 00:07
   
Text Size

Why Are My Specters Attacking Me?

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

Why Are My Specters Attacking Me?

Postby diabolicseraph » 08 Apr 2013, 15:56

Greetings Dear Brilliant Ones!

Is there a known bug on Specters for DOTP or is it just me?
Whenever my opponent deals me damage, the discard trigger of any Specter I have in play rebounds on me and makes me throw away a card.

I'm pretty sure that's not how it should work. :?

Here's my code for the Hypnotic Specter:

Code: Select all
<?xml version='1.0' encoding='UTF-8'?>
<CARD_V2>
  <FILENAME text="HYPNOTIC_SPECTER_190566" />
  <CARDNAME text="HYPNOTIC_SPECTER" />
  <TITLE>
    <LOCALISED_TEXT LanguageCode="en-US"><![CDATA[Hypnotic Specter]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="fr-FR"><![CDATA[Spectre hypnotiseur]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="es-ES"><![CDATA[Espectro hipnótico]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="de-DE"><![CDATA[Hypnotisierendes Gespenst]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="it-IT"><![CDATA[Spettro Ipnotico]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="jp-JA"><![CDATA[惑乱の死霊]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="ko-KR"><![CDATA[Hypnotic Specter]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="ru-RU"><![CDATA[Усыпляющий Призрак]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="pt-BR"><![CDATA[Espectro Hipnótico]]></LOCALISED_TEXT>
  </TITLE>
  <MULTIVERSEID value="190566" />
  <ARTID value="HYPNOTIC SPECTER" />
  <ARTIST name="Greg Staples" />
  <CASTING_COST cost="{1}{B}{B}" />
  <FLAVOURTEXT>
    <LOCALISED_TEXT LanguageCode="en-US"><![CDATA[Its victims are known by their eyes: shattered vessels leaking broken dreams.]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="fr-FR"><![CDATA[On reconnaît ses victimes à leurs yeux : des globes éclatés d’où s’écoulent des rêves brisés.]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="es-ES"><![CDATA[Sus víctimas se reconocen por sus ojos: cuencos vacíos, derramando sueños perdidos.]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="de-DE"><![CDATA[Seine Opfer kann man an den Augen erkennen – gebrochen und jeglicher Träume beraubt.]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="it-IT"><![CDATA[Le sue vittime vengono riconosciute per i loro occhi: recipienti infranti che colano sogni spezzati.]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="jp-JA"><![CDATA[被害者は目を見ればわかる。血走った目から叶わぬ夢を流しているからだ。]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="ko-KR"><![CDATA[Its victims are known by their eyes: shattered vessels leaking broken dreams.]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="ru-RU"><![CDATA[Его жертв можно узнать по глазам — растрескавшимся сосудам, из которых сочатся разбитые мечты.]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="pt-BR"><![CDATA[Suas vítimas são conhecidas pelos olhos: navios destroçados gotejando sonhos destruídos.]]></LOCALISED_TEXT>
  </FLAVOURTEXT>
  <TYPE metaname="Creature" />
  <SUB_TYPE metaname="Specter" />
  <EXPANSION value="M10" />
  <RARITY metaname="R" />
  <POWER value="2" />
  <TOUGHNESS value="2" />
  <STATIC_ABILITY>
    <LOCALISED_TEXT LanguageCode="en-US"><![CDATA[Flying]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="fr-FR"><![CDATA[Vol]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="es-ES"><![CDATA[Vuela.]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="de-DE"><![CDATA[Fliegend]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="it-IT"><![CDATA[Volare]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="jp-JA"><![CDATA[飛行]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="ko-KR"><![CDATA[비행]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="ru-RU"><![CDATA[Полет]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="pt-BR"><![CDATA[Voar]]></LOCALISED_TEXT>
    <CONTINUOUS_ACTION>
    local characteristics = Object():GetCurrentCharacteristics()
    characteristics:Characteristic_Set( CHARACTERISTIC_FLYING, 1 )
    </CONTINUOUS_ACTION>
  </STATIC_ABILITY>
  <TRIGGERED_ABILITY filter_zone="ANY">
    <LOCALISED_TEXT LanguageCode="en-US"><![CDATA[Whenever Hypnotic Specter deals damage to an opponent, that player discards a card at random.]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="fr-FR"><![CDATA[À chaque fois que le Spectre hypnotiseur inflige des blessures à un adversaire, ce joueur se défausse au hasard d’une carte.]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="es-ES"><![CDATA[Siempre que el Espectro hipnótico haga daño a un oponente, ese jugador descarta una carta al azar.]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="de-DE"><![CDATA[Immer wenn das Hypnotisierende Gespenst einem Gegner Schaden zufügt, wirft dieser Spieler eine zufällig bestimmte Karte aus seiner Hand ab.]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="it-IT"><![CDATA[Ogniqualvolta lo Spettro Ipnotico infligge danno a un avversario, quel giocatore scarta una carta a caso.]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="jp-JA"><![CDATA[惑乱の死霊がいずれかの対戦相手にダメージを与えるたび、そのプレイヤーはカードを1枚無作為に選んで捨てる。]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="ko-KR"><![CDATA[Whenever Hypnotic Specter deals damage to an opponent, that player discards a card at random.]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="ru-RU"><![CDATA[Каждый раз, когда Усыпляющий Призрак наносит повреждения оппоненту, тот игрок сбрасывает одну случайно выбранную карту.]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="pt-BR"><![CDATA[Toda vez que Espectro Hipnótico causa dano a um oponente, aquele jogador descarta um card aleatoriamente.]]></LOCALISED_TEXT>
  <TRIGGER value="CREATURE_DEALS_COMBAT_DAMAGE_TO_PLAYER" simple_qualifer="self">
   return ( TriggerPlayer() ~= nil )
   </TRIGGER>
   <RESOLUTION_TIME_ACTION>
    local player = TriggerPlayer()
    if player ~= nil then
       local filter = Object():GetFilter()
       filter:Clear()
       filter:SetZone( ZONE_HAND )
       filter:SetPlayer( player )
      filter:SetHint( HINT_ENEMY_ONLY, EffectController )
       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(1) )
    end
    </RESOLUTION_TIME_ACTION>
    <RESOLUTION_TIME_ACTION>
    local player = TriggerPlayer()
    if player ~= nil then
       for i = 0,(1-1) do
          local target_card = EffectDC():Get_Targets(1):Get_CardPtr(i)
          if target_card ~= nil  then
             target_card:Discard()
          end
       end
    end
    </RESOLUTION_TIME_ACTION>
  </TRIGGERED_ABILITY>
  </CARD_V2>
I do hope it's just me. :lol:

Thanks in advance for your sage advice as usual!
diabolicseraph
 
Posts: 10
Joined: 18 Mar 2013, 04:12
Has thanked: 7 times
Been thanked: 0 time

Re: Why Are My Specters Attacking Me?

Postby thefiremind » 08 Apr 2013, 16:15

It's strange that this code actually does something... you forgot the parentheses after EffectController in the SetHint function and this should block the code there. Anyway, you are allowing the player to choose which card to discard, but Hypnotic Specter says "at random". There's also another slight problem: Hypnotic Specter says "deals damage to an opponent" which is different from "deals combat damage to a player", so you should use a different trigger. This is all you need:
Code: Select all
    <TRIGGER value="PLAYER_TOOK_DAMAGE">
    return TriggerPlayer():GetTeam() ~= EffectController():GetTeam() and Damage():GetSource() == Object()
    </TRIGGER>
    <RESOLUTION_TIME_ACTION>
    if TriggerPlayer() ~= nil then
       TriggerPlayer():DiscardRandomCard()
    end
    </RESOLUTION_TIME_ACTION>
< 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: Why Are My Specters Attacking Me?

Postby diabolicseraph » 08 Apr 2013, 17:43

thefiremind wrote:It's strange that this code actually does something...
:mrgreen:

Coming from you thefiremind, I will take this statement as a huge compliment.

Thank you!
diabolicseraph
 
Posts: 10
Joined: 18 Mar 2013, 04:12
Has thanked: 7 times
Been thanked: 0 time

Re: Why Are My Specters Attacking Me?

Postby thefiremind » 08 Apr 2013, 18:06

diabolicseraph wrote:
thefiremind wrote:It's strange that this code actually does something...
:mrgreen:
Don't just stop on that sentence, I explained why: it's not like that code was all wrong, but it usually takes just 1 syntax error to stop the code interpreter and prevent the card from doing anything at all. There was in fact only 1 syntax error, so I was surprised that you experienced such a strange effect, because I would have expected the card to manifest no effects.

No offense intended, not even as a joke. On the contrary, I'm very happy to see that many people are trying to mod by themselves. :)
< 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: Why Are My Specters Attacking Me?

Postby RiiakShiNal » 08 Apr 2013, 18:15

The reason yours is triggering is because of this line:
Code: Select all
<TRIGGER value="CREATURE_DEALS_COMBAT_DAMAGE_TO_PLAYER" simple_qualifer="self">
It should be simple_qualifier="self".
Code: Select all
<TRIGGER value="CREATURE_DEALS_COMBAT_DAMAGE_TO_PLAYER" simple_qualifier="self">
Though what thefiremind says about dealing damage (and about it needing to be random) is right, it should trigger not just on combat damage but any damage that the Hypnotic Specter may do and only to opponents.

As for the game accepting EffectController (without parentheses) in SetHint is because a pointer to a function is still a pointer and LUA is not strongly typed. Also I believe the "Hints" are mainly only used for the AI so if simple targeting is off and the ability is used by the player then SetHint probably does nothing.
Problems with base game cards: DotP 2014 Core Fixes
Need a deck builder: DotP 2014 Deck Builder
Problems Modding: DotP 2014 Frequent Modding Mistakes
RiiakShiNal
Programmer
 
Posts: 2098
Joined: 16 May 2011, 21:37
Has thanked: 73 times
Been thanked: 462 times

Re: Why Are My Specters Attacking Me?

Postby diabolicseraph » 08 Apr 2013, 20:01

thefiremind wrote:
diabolicseraph wrote:
thefiremind wrote:It's strange that this code actually does something...
:mrgreen:
Don't just stop on that sentence, I explained why: it's not like that code was all wrong, but it usually takes just 1 syntax error to stop the code interpreter and prevent the card from doing anything at all. There was in fact only 1 syntax error, so I was surprised that you experienced such a strange effect, because I would have expected the card to manifest no effects.

No offense intended, not even as a joke. On the contrary, I'm very happy to see that many people are trying to mod by themselves. :)
None taken, sir.
My mistake. I didn't mean to place the statement out of its original context. I was putting it in conjunction with another comment you made to me in a separate post wherein you mentioned that I had a tendency to be a bit too "creative" in how I write my codes, and I found it very funny. :lol:
diabolicseraph
 
Posts: 10
Joined: 18 Mar 2013, 04:12
Has thanked: 7 times
Been thanked: 0 time

Re: Why Are My Specters Attacking Me?

Postby diabolicseraph » 08 Apr 2013, 20:03

RiiakShiNal wrote:The reason yours is triggering is because of this line:
Code: Select all
<TRIGGER value="CREATURE_DEALS_COMBAT_DAMAGE_TO_PLAYER" simple_qualifer="self">
It should be simple_qualifier="self".
Code: Select all
<TRIGGER value="CREATURE_DEALS_COMBAT_DAMAGE_TO_PLAYER" simple_qualifier="self">
Though what thefiremind says about dealing damage (and about it needing to be random) is right, it should trigger not just on combat damage but any damage that the Hypnotic Specter may do and only to opponents.

As for the game accepting EffectController (without parentheses) in SetHint is because a pointer to a function is still a pointer and LUA is not strongly typed. Also I believe the "Hints" are mainly only used for the AI so if simple targeting is off and the ability is used by the player then SetHint probably does nothing.
Now that little gem of a typo I actually missed. Thank you!
diabolicseraph
 
Posts: 10
Joined: 18 Mar 2013, 04:12
Has thanked: 7 times
Been thanked: 0 time

Re: Why Are My Specters Attacking Me?

Postby diabolicseraph » 09 Apr 2013, 07:36

So, I've gone from having my Specters hit me with their abilities, to a specter that would not activate it's ability. I've done so many variations on the code, I think I've gone dyslexic. Could someone with fresh eyes (or eye even) kindly look through this and let me know what I'm missing? ](*,) ](*,) ](*,) ](*,) ](*,) ](*,) ](*,)


Code: Select all
?xml version='1.0' encoding='UTF-8'?>
<CARD_V2>
  <FILENAME text="SHIMIAN_SPECTER_278072" />
  <CARDNAME text="SHIMIAN_SPECTER" />
  <TITLE>
    <LOCALISED_TEXT LanguageCode="en-US"><![CDATA[Shimian Specter]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="fr-FR"><![CDATA[Spectre de Shimia]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="es-ES"><![CDATA[Espectro shimiano]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="de-DE"><![CDATA[Shimianisches Gespenst]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="it-IT"><![CDATA[Spettro Shimiano]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="jp-JA"><![CDATA[シミアの死霊]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="ko-KR"><![CDATA[시미안 스펙터]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="ru-RU"><![CDATA[Шимийский Призрак]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="pt-BR"><![CDATA[Espectro Shimiano]]></LOCALISED_TEXT>
  </TITLE>
  <MULTIVERSEID value="278072" />
  <ARTID value="A278072" />
  <ARTIST name="Anthony S. Waters" />
  <CASTING_COST cost="{2}{B}{B}" />
  <TYPE metaname="Creature" />
  <SUB_TYPE metaname="Specter" />
  <EXPANSION value="M13" />
  <RARITY metaname="R" />
  <POWER value="2" />
  <TOUGHNESS value="2" />
  <STATIC_ABILITY>
    <LOCALISED_TEXT LanguageCode="en-US"><![CDATA[Flying]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="fr-FR"><![CDATA[Vol]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="es-ES"><![CDATA[Vuela.]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="de-DE"><![CDATA[Fliegend]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="it-IT"><![CDATA[Volare]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="jp-JA"><![CDATA[飛行]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="ko-KR"><![CDATA[비행]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="ru-RU"><![CDATA[Полет]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="pt-BR"><![CDATA[Voar]]></LOCALISED_TEXT>
    <CONTINUOUS_ACTION>
    local characteristics = Object():GetCurrentCharacteristics()
    characteristics:Characteristic_Set( CHARACTERISTIC_FLYING, 1 )
    </CONTINUOUS_ACTION>
  </STATIC_ABILITY>
  <TRIGGERED_ABILITY filter_zone="ANY">
    <LOCALISED_TEXT LanguageCode="en-US"><![CDATA[Whenever Shimian Specter deals combat damage to a player, that player reveals his or her hand. You choose a nonland card from it. Search that player’s graveyard, hand, and library for all cards with the same name as that card and exile them. Then that player shuffles his or her library.]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="fr-FR"><![CDATA[À chaque fois que le Spectre de Shimia inflige des blessures de combat à un joueur, ce joueur révèle sa main. Choisissez-y une carte non-terrain. Cherchez dans le cimetière, la main et la bibliothèque de ce joueur toutes les cartes ayant le même nom que cette carte et exilez-les. Ce joueur mélange ensuite sa bibliothèque.]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="es-ES"><![CDATA[Siempre que el Espectro shimiano haga daño de combate a un jugador, ese jugador muestra su mano. Eliges de ahí una carta que no sea tierra. Busca en el cementerio, mano y biblioteca de ese jugador todas las cartas con el mismo nombre que esa carta y exílialas. Luego ese jugador baraja su biblioteca.]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="de-DE"><![CDATA[Immer wenn das Shimianische Gespenst einem Spieler Kampfschaden zufügt, zeigt dieser Spieler die Karten auf seiner Hand offen vor. Bestimme davon eine Karte, die kein Land ist. Durchsuche den Friedhof, die Hand und die Bibliothek dieses Spielers nach Karten mit demselben Namen wie diese Karte und schicke sie alle ins Exil. Dieser Spieler mischt dann seine Bibliothek.]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="it-IT"><![CDATA[Ogniqualvolta lo Spettro Shimiano infligge danno da combattimento a un giocatore, quel giocatore rivela la sua mano. Scegli una carta non terra da quella mano. Passa in rassegna il cimitero, la mano e il grimorio di quel giocatore per tutte le carte con lo stesso nome di quella carta ed esiliale. Poi quel giocatore rimescola il suo grimorio.]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="jp-JA"><![CDATA[シミアの死霊がいずれかのプレイヤーに戦闘ダメージを与えるたび、そのプレイヤーは自分の手札を公開する。あなたはその中の土地でないカードを1枚選ぶ。そのプレイヤーの墓地と手札とライブラリーから、そのカードと同じ名前を持つカードをすべて探し、それらを追放する。その後、そのプレイヤーは自分のライブラリーを切り直す。]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="ko-KR"><![CDATA[시미안 스펙터가 플레이어에게 전투피해를 입힐 때마다, 그 플레이어는 자신의 손을 공개한다. 그 중 대지가 아닌 카드 한 장을 선택한다. 그 플레이어의 무덤과 손, 서고에서 선택한 카드와 같은 이름을 가진 카드를 모두 찾아서 추방한다. 그러고 나서 그 플레이어는 자신의 서고를 섞는다.]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="ru-RU"><![CDATA[Каждый раз, когда Шимийский Призрак наносит боевые повреждения игроку, тот игрок показывает свою руку. Вы выбираете из нее карту, не являющуюся землей. Найдите на кладбище, в руке и в библиотеке того игрока все карты с таким же именем, что и у той карты, и изгоните их. Затем тот игрок тасует свою библиотеку.]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="pt-BR"><![CDATA[Toda vez que o Espectro Shimiano causa dano de combate a um jogador, aquele jogador revela sua própria mão. Você escolhe um card que não seja um terreno da mão dele. Procure na mão, no cemitério e no grimório daquele jogador todo os cards com o mesmo nome daquele card e exile-os. Depois, aquele jogador embaralha seu próprio grimório.]]></LOCALISED_TEXT>
    <TRIGGER value="CREATURE_DEALS_COMBAT_DAMAGE_TO_PLAYER" simple_qualifier="self">
      return TriggerPlayer() ~= nil
      </TRIGGER>
      <RESOLUTION_TIME_ACTION>
    local player = TriggerPlayer()
    if player ~= nil then
          TriggerPlayer():RevealHand()
       end
       player:ChooseTargets( NO_VALIDATION, "CARD_QUERY_CHOOSE_CARD"  EffectDC():Make_Targets(1) )
    end
    </RESOLUTION_TIME_ACTION>
   <RESOLUTION_TIME_ACTION>
    local target_card = EffectSource():GetTargetCard()
    if target_card ~= nil then
      EffectDC():Set_ProtectedCardPtr( 0, target_card )
      EffectDC():Set_PlayerPtr( 1, target_card:GetPlayer() )
   end
    </RESOLUTION_TIME_ACTION>
      <RESOLUTION_TIME_ACTION>
         local Filter = EffectSource():GetFilter()
         local player = TriggerPlayer()
         local target_card = EffectDC():Get_ProtectedCardPtr( 0 )
         for i=0,2 do
            Filter:Clear()
            Filter:SetPlayer( TriggerPlayer() )
            if (i == 0) then
               Filter:SetZone( ZONE_GRAVEYARD )
            elseif (i == 1) then
               Filter:SetZone( ZONE_HAND )
            else
               Filter:SetZone( ZONE_LIBRARY )
            end
            Filter:AddCardName( Card:GetCardName() )
            local nCount = Filter:EvaluateObjects()
            if (nCount &gt; 0) then
               for j=0,nCount-1 do
                  local FoundCard = Filter:GetNthEvaluatedObject( j )
                  if (FoundCard ~= nil) then
                     FoundCard:RemoveFromGame()
                  end
      </RESOLUTION_TIME_ACTION>
      <RESOLUTION_TIME_ACTION>
         local player = TriggerPlayer()
         if TriggerPlayer() ~= nil then
         TriggerPlayer():ShuffleLibrary()
         end
      </RESOLUTION_TIME_ACTION>
  </TRIGGERED_ABILITY>
  <HELP title="MORE_INFO_BADGE_TITLE_10" body="MORE_INFO_BADGE_BODY_10" zone="ZONE_ANY" />
  <SFX text="COMBAT_BLUNT_LARGE_ATTACK" power_boundary_min="4" power_boundary_max="-1" />
  <SFX text="COMBAT_BLUNT_SMALL_ATTACK" power_boundary_min="1" power_boundary_max="3" />
</CARD_V2>
diabolicseraph
 
Posts: 10
Joined: 18 Mar 2013, 04:12
Has thanked: 7 times
Been thanked: 0 time

Re: Why Are My Specters Attacking Me?

Postby thefiremind » 09 Apr 2013, 09:06

OK, let's see...
  • filter_zone="ANY" should be filter_zone="ZONE_ANY" but there's no <FILTER> block here so you can safely remove the tag completely.
  • TriggerPlayer() is the player you dealt damage to... but you are letting that player choose his own card, while you should choose it. So the first target choice should be
    Code: Select all
    EffectController():ChooseTargets( NO_VALIDATION, "CARD_QUERY_CHOOSE_CARD", EffectDC():Make_Targets(1) )
    you also forgot a comma between the last 2 parameters.
  • That's not enough, though... you want to choose a card from a player's hand but there's no filter that selects those cards. Before the first target choice you need to add
    Code: Select all
    local filter = Object():GetFilter()
    filter:Clear()
    filter:SetZone( ZONE_HAND )
    filter:SetPlayer( player )
    filter:NotTargetted()
  • Forget about GetTargetCard(), it's DotP2012 syntax and it gives you problems. Use
    Code: Select all
    local target_card = EffectDC():Get_Targets(1) and EffectDC():Get_Targets(1):Get_CardPtr(0)
    this will automatically check the chest before looking at the card pointer, so that it won't give you nil value errors when the chest is nil. Of course you want to use Get_Targets(1) because you used Make_Targets(1) in the target choice... if you used Make_Targets(0) you would want Get_Targets(0).
  • You are using register #1 again to save a player pointer, but you already used it for the target chest. While it's true that you are saving the target in register #0 before that, reusing registers is bad practice and could lead to problems. Besides, you aren't using that player pointer anywhere in the following code, so don't even save it.
  • You are missing 2 "end" at the end of the second RESOLUTION_TIME_ACTION.
I can't guarantee that it will work after those fixes, but you should be much closer at least.
< 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


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