It is currently 27 Apr 2024, 02:32
   
Text Size

Play a card any time you could play an instant paying "plus"

Moderator: CCGHQ Admins

Play a card any time you could play an instant paying "plus"

Postby Zambooo » 18 Jul 2012, 21:23

I encountered this problem creating Saproling Symbiosis (http://magiccards.info/in/en/209.html). Do you think it is possible to code? :?: :?:

Code: Select all
<?xml version='1.0'?>
<CARD_V2>
  <FILENAME text="SAPROLING_SYMBIOSIS_24670" />
  <CARDNAME text="SAPROLING_SYMBIOSIS" />
  <TITLE>
    <LOCALISED_TEXT LanguageCode="en-US"><![CDATA[Saproling Symbiosis]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="it-IT"><![CDATA[Simbiosi dei Saprolingi]]></LOCALISED_TEXT>
  </TITLE>
  <MULTIVERSEID value="24670" />
  <ARTID value="2848" />
  <ARTIST name="Ciruelo" />
  <CASTING_COST cost="{3}{G}" />
  <TYPE metaname="Sorcery" />
  <EXPANSION value="INV" />
  <RARITY metaname="R" />
   <STATIC_ABILITY active_zone="ZONE_HAND">
   <LOCALISED_TEXT LanguageCode="en-US"><![CDATA[You may cast Saproling Symbiosis any time you could cast an instant if you pay {2} more to cast it.]]></LOCALISED_TEXT>
   <LOCALISED_TEXT LanguageCode="it-IT"><![CDATA[Puoi lanciare Simbiosi dei Saprolingi in qualunque momento in cui potresti lanciare un istantaneo se paghi {2} in più per lanciarlo.]]></LOCALISED_TEXT>
   <CONTINUOUS_ACTION>
   Object():GetCurrentCharacteristics():Characteristic_Set( CHARACTERISTIC_FLASH, 1 )
   </CONTINUOUS_ACTION>
   <CONTINUOUS_ACTION layer="8">
   if (EffectController():SorceryTime() == 0) then
    Object():IncreaseCost(2)
   end
   </CONTINUOUS_ACTION>
  </STATIC_ABILITY>
  <SPELL_ABILITY filter_zone="ZONE_IN_PLAY">
   <LOCALISED_TEXT LanguageCode="en-US"><![CDATA[Put a 1/1 green Saproling creature token onto the battlefield for each creature you control.]]></LOCALISED_TEXT>
   <LOCALISED_TEXT LanguageCode="it-IT"><![CDATA[Metti sul campo di battaglia una creatura pedina Saprolingio 1/1 verde per ogni creatura che controlli.]]></LOCALISED_TEXT>
   <RESOLUTION_TIME_ACTION>
    local total = 0 
    local filter = Object():GetFilter() 
    filter:Clear() 
    filter:SetZone( ZONE_IN_PLAY ) 
    filter:AddCardType( CARD_TYPE_CREATURE ) 
    filter:SetController( EffectController() ) 
    filter:NotTargetted() 
    total = filter:Count()
   MTG():PutTokensIntoPlay( "TOKEN_SAPROLING_1_1_277461", total, EffectController() )
    </RESOLUTION_TIME_ACTION>
  </SPELL_ABILITY>
</CARD_V2>
Last edited by Zambooo on 19 Jul 2012, 13:25, edited 3 times in total.
User avatar
Zambooo
 
Posts: 242
Joined: 01 Jul 2012, 21:33
Has thanked: 19 times
Been thanked: 17 times

Re: Play a card any time you could play an instant paying "p

Postby thefiremind » 18 Jul 2012, 22:07

This is a possible idea:
Code: Select all
  <STATIC_ABILITY active_zone="ZONE_HAND">
    <CONTINUOUS_ACTION>
    Object():GetCurrentCharacteristics():Characteristic_Set( CHARACTERISTIC_FLASH, 1 )
    </CONTINUOUS_ACTION>
    <CONTINUOUS_ACTION layer="8">
    if not EffectController():SorceryTime() then
       Object():IncreaseCost(2)
    end
    </CONTINUOUS_ACTION>
  </STATIC_ABILITY>
The card would have flash, but it would cost {2} more when it's not sorcery time. I'm not sure if this could have some bad consequences in particular cases... I can't think of any.

There are no examples of SorceryTime usage, but I hope I got it right. Please let me know if it works.
< 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: Play a card any time you could play an instant paying "p

Postby Zambooo » 19 Jul 2012, 10:13

Well I could actually use it as it was an instant, but it didn't make me pay the surplus. I used it in the enemy's turn paying only its cost
User avatar
Zambooo
 
Posts: 242
Joined: 01 Jul 2012, 21:33
Has thanked: 19 times
Been thanked: 17 times

Re: Play a card any time you could play an instant paying "p

Postby thefiremind » 19 Jul 2012, 11:09

I tend to forget that most functions don't return a boolean... the correct code is the following:
Code: Select all
  <STATIC_ABILITY active_zone="ZONE_HAND">
    <CONTINUOUS_ACTION>
    Object():GetCurrentCharacteristics():Characteristic_Set( CHARACTERISTIC_FLASH, 1 )
    </CONTINUOUS_ACTION>
    <CONTINUOUS_ACTION layer="8">
    if EffectController():SorceryTime() == 0 then
       Object():IncreaseCost(2)
    end
    </CONTINUOUS_ACTION>
  </STATIC_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: Play a card any time you could play an instant paying "p

Postby Zambooo » 19 Jul 2012, 12:52

I've updated the first post with the code, but now the card is not even shown in the deck editor. Probably is a silly mistake but I didn't change anything >.>
User avatar
Zambooo
 
Posts: 242
Joined: 01 Jul 2012, 21:33
Has thanked: 19 times
Been thanked: 17 times

Re: Play a card any time you could play an instant paying "p

Postby thefiremind » 19 Jul 2012, 12:57

Code: Select all
  <FILENAME text="SAPROLING_SYMBIOSIS_2848" />
  <MULTIVERSEID value="277040" />
  <ARTID value="2848" />
You are doing something wrong with the IDs. It should be:
Code: Select all
  <FILENAME text="SAPROLING_SYMBIOSIS_277040" />
  <MULTIVERSEID value="277040" />
  <ARTID value="2848" />
or maybe:
Code: Select all
  <FILENAME text="SAPROLING_SYMBIOSIS_2848" />
  <MULTIVERSEID value="2848" />
  <ARTID value="277040" />
and check that the actual XML filename is the same that you wrote in the file.
< 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: Play a card any time you could play an instant paying "p

Postby Zambooo » 19 Jul 2012, 13:02

Mmmm... I think they didn't influence at all. The ID of the card is 24670. What am I supposed to do?

LoL the page reloaded only now...

Well all the cards I've made have a sort of "random multiverseID" but they still works
User avatar
Zambooo
 
Posts: 242
Joined: 01 Jul 2012, 21:33
Has thanked: 19 times
Been thanked: 17 times

Re: Play a card any time you could play an instant paying "p

Postby thefiremind » 19 Jul 2012, 13:12

Zambooo wrote:Well all the cards I've made have a sort of "random multiverseID" but they still works
You can choose a random number if you really want to, but once you have chosen it, always use that: in the actual file name, in the FILENAME block, and in the MULTIVERSEID block. If you don't use a little order, the more cards you make, the more chances you have to create a collision. All the blocks in the XML are correctly opened and closed so you can't have done anything else wrong.
< 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: Play a card any time you could play an instant paying "p

Postby Zambooo » 19 Jul 2012, 13:26

I've changed it to
Code: Select all
<FILENAME text="SAPROLING_SYMBIOSIS_24670" />
  <CARDNAME text="SAPROLING_SYMBIOSIS" />
  <MULTIVERSEID value="24670" />
  <ARTID value="2848" />
but it's still not shown :( (I changed also the XML name) Are you sure isn't just something wrong with the code? I've updated the first post...

I corrected it: the problem was just the letter "ù" in the Italian translation :lol:
Now it works perfectly thanks!
User avatar
Zambooo
 
Posts: 242
Joined: 01 Jul 2012, 21:33
Has thanked: 19 times
Been thanked: 17 times

Re: Play a card any time you could play an instant paying "p

Postby thefiremind » 19 Jul 2012, 14:19

Zambooo wrote:I corrected it: the problem was just the letter "ù" in the Italian translation :lol:
Now it works perfectly thanks!
Always save the XML files with UTF-8 encoding if you want to avoid this problem. Notepad warns you only if you include Japanese or other foreign characters, but the game also can't read "ù", "è", etc. when the default ANSI encoding is used. If you want to be super-safe, always start from a copy of an existing core XML, those are already encoded in UTF-8 and they will preserve the encoding when saved.
< 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 32 guests


Who is online

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

Login Form