It is currently 26 Apr 2024, 07:11
   
Text Size

Unusual targetting & animation problems (solved!)

Moderator: CCGHQ Admins

Unusual targetting & animation problems (solved!)

Postby thefiremind » 10 May 2012, 10:18

I want to code Vexing Devil... not difficult by itself, but I'd like to use <SFX text="TARGET_CLAW_ABILITY_RESOLVED_PLAY" /> so that the opponent who decides to take the damage gets the nice animation. To do this, I need to set the card's target to the player who decided to take the damage.
I know that there's a SetTargetPlayer function, but I can't understand what it needs as arguments.
I tried with:
Object():SetTargetPlayer( player )
(where player points to an opponent), but it makes MOTHER.TXT pop out with:
call parameter mismatch - too many or too few a parameter count declared, method SetTargetPlayer in class __Object
So, does anybody know the right syntax for SetTargetPlayer?

EDIT: I found a "surrogate" of SetTargetPlayer:
MTG():EffectDataChest():Make_Targets( 0 ):Set_PlayerPtr( 0, player )
The problem is that the animation doesn't recognize the player as the target anyway.
With TARGET_CLAW_ABILITY_RESOLVED_PLAY I see nothing, while with TARGET_FLAME_ABILITY_RESOLVED_PLAY the flame starts from the card and goes outside the screen in horizontal. I'm starting to think that the animations work properly only when the target is chosen the usual way. :(

EDIT 2: I found the cause of the problem! The animations aren't managed properly if the target is chosen in resolution time, but they are perfect if I do it in play time. I'm not sure about when the players should make their decisions about Vexing Devil, but it shouldn't be dramatically different. This is the full Vexing Devil code, if someone is interested:
Code: Select all
<?xml version='1.0'?>
<CARD_V2 custom="true">
  <FILENAME text="VEXING_DEVIL_19991695" />
  <CARDNAME text="VEXING_DEVIL" />
  <TITLE>
    <LOCALISED_TEXT LanguageCode="en-US"><![CDATA[Vexing Devil]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="it-IT"><![CDATA[Diavolo Irritante]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="de-DE"><![CDATA[Lästiger Teufel]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="fr-FR"><![CDATA[Diable vexatoire]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="es-ES"><![CDATA[Diablo irritante]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="jp-JA"><![CDATA[苛立たしい小悪魔]]></LOCALISED_TEXT>
  </TITLE>
  <MULTIVERSEID value="19991695" />
  <ARTID value="19991695" />
  <FRAMECOLOUR name="R" />
  <COLOUR value="R" />
  <ARTIST name="Lucas Graciano" />
  <CASTING_COST cost="{R}" />
  <FLAVOURTEXT>
    <LOCALISED_TEXT LanguageCode="en-US"><![CDATA[It’s not any fun until someone loses an eye.]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="it-IT"><![CDATA[Non c’è gusto finché qualcuno non ci rimette un occhio.]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="de-DE"><![CDATA[Es wird erst lustig, sobald jemand ein Auge verliert.]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="fr-FR"><![CDATA[Ça devient uniquement drôle quand il y a des blessés.]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="es-ES"><![CDATA[No es gracioso hasta que alguien pierde un ojo.]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="jp-JA"><![CDATA[誰かが痛い目に遭うまでは面白くもない。]]></LOCALISED_TEXT>
  </FLAVOURTEXT>
  <TYPE metaname="Creature" order_de-DE="0" order_es-ES="0" order_fr-FR="0" order_it-IT="0" order_jp-JA="0" />
  <SUB_TYPE metaname="Devil" order_de-DE="0" order_es-ES="0" order_fr-FR="0" order_it-IT="0" order_jp-JA="0" />
  <EXPANSION value="AVR" />
  <RARITY metaname="R" />
  <POWER value="4" />
  <TOUGHNESS value="3" />
  <TRIGGERED_ABILITY zone="player">
    <LOCALISED_TEXT LanguageCode="en-US"><![CDATA[When Vexing Devil enters the battlefield, any opponent may have it deal 4 damage to him or her. If a player does, sacrifice Vexing Devil.]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="it-IT"><![CDATA[Quando il Diavolo Irritante entra nel campo di battaglia, qualsiasi avversario può farsi infliggere 4 danni da esso. Se un giocatore lo fa, sacrifica il Diavolo Irritante.]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="de-DE"><![CDATA[Wenn der Lästige Teufel ins Spiel kommt, kann jeder deiner Gegner bestimmen, sich von ihm 4 Schadenspunkte zufügen lassen. Falls ein Spieler das tut, opfere den Lästigen Teufel.]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="fr-FR"><![CDATA[Quand le Diable vexatoire arrive sur le champ de bataille, n’importe quel adversaire peut faire qu’il lui inflige 4 blessures. Si un joueur fait ainsi, sacrifiez le Diable vexatoire.]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="es-ES"><![CDATA[Cuando el Diablo irritante entre al campo de batalla, cualquier oponente puede hacer que le haga 4 puntos de daño. Si un jugador lo hace, sacrifica el Diablo irritante.]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="jp-JA"><![CDATA[苛立たしい小悪魔が戦場に出たとき、どの対戦相手でも「苛立たしい小悪魔は自分に4点のダメージを与える。」を選んでもよい。 いずれかのプレイヤーがそうした場合、苛立たしい小悪魔を生け贄に捧げる。]]></LOCALISED_TEXT>
    <TRIGGER value="COMES_INTO_PLAY" simple_qualifier="self" />
    <PLAY_TIME_ACTION repeating="1">
    local n = MTG():GetActionRepCount()
    local parity = n % 2
    local num_players = MTG():GetNumberOfPlayers()
    local player = MTG():GetNthPlayer(n/2)
    if player ~= nil and n &lt; num_players*2 then
      if player:GetTeam() ~= Object():GetPlayer():GetTeam() then
        if parity == 0 then
          -- ask question
         player:BeginNewMultipleChoice()
          player:AddMultipleChoiceAnswer( "CARD_QUERY_OPTION_YES" )
          player:AddMultipleChoiceAnswer( "CARD_QUERY_OPTION_NO" )
          player:AskMultipleChoiceQuestion( "CARD_QUERY_MC_TAKE_4_DAMAGE" )
        else
          -- see decision
         if Object():GetMultipleChoiceResult() == 0 then
            MTG():EffectDataChest():Make_Targets( 0 ):Set_PlayerPtr( 0, player )
            return false
          end
        end
      end
      return true
    else
      return false
    end
    </PLAY_TIME_ACTION>
    <RESOLUTION_TIME_ACTION>
    if Object():GetTargetPlayer() ~= nil then
      Object():GetTargetPlayer():DealDamage( 4, Object() )
    end
    </RESOLUTION_TIME_ACTION>
    <RESOLUTION_TIME_ACTION>
    if Object():GetTargetPlayer() ~= nil then
      Object():Sacrifice()
    end
    </RESOLUTION_TIME_ACTION>
    <SFX text="TARGET_CLAW_ABILITY_RESOLVED_PLAY" />
  </TRIGGERED_ABILITY>
</CARD_V2>
With this code not only you see the nice "clawing" animation when the damage is dealt, but also the glowing line connecting the Devil with the player that chose to take the damage! :D
< 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

Return to Programming Talk

Who is online

Users browsing this forum: No registered users and 36 guests


Who is online

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

Login Form