It is currently 12 Nov 2025, 23:11
   
Text Size

Dissipation Field. Help with the trigger.

Moderator: CCGHQ Admins

Dissipation Field. Help with the trigger.

Postby alexandreonly » 29 Sep 2012, 05:11

Well, if i leave just the Damage():GetSource() ~= nill, it will work, but will return also instant and sorcery to owner's hand. I need to make sure that the damage source is a permanent, but with the IsPermanent(Damage():GetSource())it will not work, the effect will not be triggered.

Code: Select all
<?xml version='1.0'?>
<CARD_V2>
  <FILENAME text="DISSIPATION_FIELD_202635" />
  <CARDNAME text="DISSIPATION_FIELD" />
  <TITLE>
    <LOCALISED_TEXT LanguageCode="en-US"><![CDATA[Dissipation Field]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="de-DE"><![CDATA[Dissipation Field]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="es-ES"><![CDATA[Dissipation Field]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="fr-FR"><![CDATA[Dissipation Field]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="it-IT"><![CDATA[Dissipation Field]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="jp-JA"><![CDATA[Dissipation Field]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="ko-KR"><![CDATA[Dissipation Field]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="ru-RU"><![CDATA[Dissipation Field]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="pt-BR"><![CDATA[Dissipation Field]]></LOCALISED_TEXT>
  </TITLE>
  <MULTIVERSEID value="202635" />
  <ARTID value="202635" />
  <ARTIST name="Matt Cavotta" />
  <CASTING_COST cost="{2}{U}{U}" />
  <FLAVOURTEXT>
    <LOCALISED_TEXT LanguageCode="en-US"><![CDATA[“Strike me once, shame on you. Strike me twice . . . Well, let’s just see if you can.”
—Kara Vrist, Neurok agent]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="de-DE"><![CDATA[“Strike me once, shame on you. Strike me twice . . . Well, let’s just see if you can.”
—Kara Vrist, Neurok agent]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="es-ES"><![CDATA[“Strike me once, shame on you. Strike me twice . . . Well, let’s just see if you can.”
—Kara Vrist, Neurok agent]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="fr-FR"><![CDATA[“Strike me once, shame on you. Strike me twice . . . Well, let’s just see if you can.”
—Kara Vrist, Neurok agent]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="it-IT"><![CDATA[“Strike me once, shame on you. Strike me twice . . . Well, let’s just see if you can.”
—Kara Vrist, Neurok agent]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="jp-JA"><![CDATA[“Strike me once, shame on you. Strike me twice . . . Well, let’s just see if you can.”
—Kara Vrist, Neurok agent]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="ko-KR"><![CDATA[“Strike me once, shame on you. Strike me twice . . . Well, let’s just see if you can.”
—Kara Vrist, Neurok agent]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="ru-RU"><![CDATA[“Strike me once, shame on you. Strike me twice . . . Well, let’s just see if you can.”
—Kara Vrist, Neurok agent]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="pt-BR"><![CDATA[“Strike me once, shame on you. Strike me twice . . . Well, let’s just see if you can.”
—Kara Vrist, Neurok agent]]></LOCALISED_TEXT>
  </FLAVOURTEXT>
  <TYPE metaname="Enchantment" />
  <EXPANSION value="DPG" />
  <RARITY metaname="R" />
    <TRIGGERED_ABILITY dangerous="1" filter_zone="ZONE_IN_PLAY">
    <LOCALISED_TEXT LanguageCode="en-US"><![CDATA[Whenever a permanent deals damage to you, return it to its owner’s hand.]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="de-DE"><![CDATA[Whenever a permanent deals damage to you, return it to its owner’s hand.]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="es-ES"><![CDATA[Whenever a permanent deals damage to you, return it to its owner’s hand.]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="fr-FR"><![CDATA[Whenever a permanent deals damage to you, return it to its owner’s hand.]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="it-IT"><![CDATA[Whenever a permanent deals damage to you, return it to its owner’s hand.]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="jp-JA"><![CDATA[Whenever a permanent deals damage to you, return it to its owner’s hand.]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="ko-KR"><![CDATA[Whenever a permanent deals damage to you, return it to its owner’s hand.]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="ru-RU"><![CDATA[Whenever a permanent deals damage to you, return it to its owner’s hand.]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="pt-BR"><![CDATA[Whenever a permanent deals damage to you, return it to its owner’s hand.]]></LOCALISED_TEXT>
  <TRIGGER value="PLAYER_TOOK_DAMAGE" simple_qualifier="controller">
    return IsPermanent(Damage():GetSource()) and (Damage():GetSource() ~= nill)
    </TRIGGER>
    <RESOLUTION_TIME_ACTION>
    local source = Damage():GetSource()
    if source ~= nil then
       source:PutInHand()
    end
    </RESOLUTION_TIME_ACTION>
  </TRIGGERED_ABILITY>
</CARD_V2>
alexandreonly
 
Posts: 145
Joined: 04 Jul 2011, 17:27
Has thanked: 0 time
Been thanked: 8 times

Re: Dissipation Field. Help with the trigger.

Postby thefiremind » 29 Sep 2012, 09:41

First of all, it should be "~= nil", not "~= nill". Otherwise you are comparing the source with a global variable called "nill" which doesn't exist and I really don't know how the interpreter manages it.

IsPermanent is a function that I invented, so you have to include my GENERAL_FUNCTIONS.LOL for it to work.

You should also check Damage():GetSource() ~= nil first, and IsPermanent(Damage():GetSource()) after. This way, if Damage():GetSource() is nil, the next statement isn't even checked because the resulting "and" is false for sure, and you never get errors in SCRIPT_LOG.TXT (this behavior is called "short circuit rule" and it applies to lots of programming languages).
< 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: 722 times


Return to Programming Talk

Who is online

Users browsing this forum: No registered users and 8 guests

Main Menu

User Menu

Our Partners


Who is online

In total there are 8 users online :: 0 registered, 0 hidden and 8 guests (based on users active over the past 10 minutes)
Most users ever online was 9824 on 10 Nov 2025, 04:33

Users browsing this forum: No registered users and 8 guests

Login Form