Page 2 of 2

Re: Functions for "Choose a Creature Type"

PostPosted: 12 Aug 2012, 02:40
by alexandreonly
Thanks, Door of Destinies is 100% now. Here in Brazil we are limited to play magic on computers on inside our houses, because we were attacked several times by evangelical christians (they claim that we are doing some kind of ritual). 3 weeks ago i broke the arm of a zealot, he and his friends had planks, ant tried to beat me and my friends, and yesterday another one came with a .38 revolver to threaten us. We are almost in a new dark age here. We can't make our friday night magic anymore :(

Re: Functions for "Choose a Creature Type"

PostPosted: 15 Aug 2012, 09:35
by thefiremind
If someone still needs an updated list of all the actual creature types, I found this one:
http://www.wizards.com/Magic/Magazine/A ... rcana/1038
:P

Re: Functions for "Choose a Creature Type"

PostPosted: 15 Aug 2012, 12:12
by sadlyblue
It's missing the un-serious creature types... :)

Re: Functions for "Choose a Creature Type"

PostPosted: 15 Aug 2012, 14:57
by RiiakShiNal
I've updated the first post with 2 more creature types that were missing from the game (completely missing this time): Hyena and Noggle. I also added the Subtype text for them though I could not find (or translate) Noggle in Korean.

Also that article is missing a couple of types that are still in the oracle text (Egg and Townsfolk). They may not be "serious" types, but they are still listed as creature types in the oracle text so I see no reason that they should be excluded.

By comparing types in the game that are missing from the article I also see that type Anemone is no longer used and type Trap is actually used for Instants not Creatures so later I may need to add at least one exception to my code so it doesn't look for Traps.

Re: Functions for "Choose a Creature Type"

PostPosted: 15 Aug 2012, 15:43
by thefiremind
I coded Noggle Ransacker without realizing that the Noggle subtype wasn't visible... #-o
My core-fixing WAD is updated with the 2 new subtypes.

Re: Functions for "Choose a Creature Type"

PostPosted: 07 Sep 2012, 08:15
by Persee
I tried to code Urza's Incubator but i have a issue.

Code: Select all
  <TRIGGERED_ABILITY forced_skip="1" active_zone="ZONE_TRANSITION">
   <LOCALISED_TEXT LanguageCode="en-US"><![CDATA[As Urza’s Incubator enters the battlefield, choose a creature type.]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="it-IT"><![CDATA[As Urza’s Incubator enters the battlefield, choose a creature type.]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="de-DE"><![CDATA[Bestimme einen Kreaturentyp, wenn Urzas Brutkasten ins Spiel kommt.]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="fr-FR"><![CDATA[Au moment où l'Incubateur d'Urza arrive sur le champ de bataille, choisissez un type de créature.]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="es-ES"><![CDATA[As Urza’s Incubator enters the battlefield, choose a creature type.]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="jp-JA"><![CDATA[As Urza’s Incubator enters the battlefield, choose a creature type.]]></LOCALISED_TEXT> 
    <LOCALISED_TEXT LanguageCode="ko-KR"><![CDATA[As Urza’s Incubator enters the battlefield, choose a creature type.]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="ru-RU"><![CDATA[As Urza’s Incubator enters the battlefield, choose a creature type.]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="pt-BR"><![CDATA[As Urza’s Incubator enters the battlefield, choose a creature type.]]></LOCALISED_TEXT>
    <TRIGGER value="ZONECHANGE_TRANSITION" simple_qualifier="self" to_zone="ZONE_IN_PLAY" />
   <RESOLUTION_TIME_ACTION>
   local player = EffectController()
   EffectDC():Make_Chest( 0 )
   RSN_FindPlayerCreatureTypesInZone( EffectDC():Get_Chest( 0 ), player, ZONE_LIBRARY )
   local nBestIndex = EffectDC():Get_Chest( 0 ):Int_Get( REGISTER_SELECTION_BEST_TYPE_INDEX )
   EffectDC():Get_Chest( 0 ):Int_Set( REGISTER_SELECTION_SELECTED_INDEX, nBestIndex )
   EffectDC():Int_Set( 10, -1 )
   </RESOLUTION_TIME_ACTION>
   <RESOLUTION_TIME_ACTION repeating="1">
   return RSN_ChooseCreatureTypeFromDC( EffectController(), EffectDC():Get_Chest( 0 ) )
   </RESOLUTION_TIME_ACTION>   
  </TRIGGERED_ABILITY>
  <STATIC_ABILITY filter_zone="ZONE_HAND">
   <LOCALISED_TEXT LanguageCode="en-US"><![CDATA[Creature spells of the chosen type cost {2} less to cast.]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="it-IT"><![CDATA[Creature spells of the chosen type cost {2} less to cast.]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="de-DE"><![CDATA[Kreaturenzauber des bestimmten Typs kosten 2 weniger zum Ausspielen.]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="fr-FR"><![CDATA[Les sorts de créature du type choisi coûtent %2 de moins à lancer.]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="es-ES"><![CDATA[Creature spells of the chosen type cost {2} less to cast.]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="jp-JA"><![CDATA[Creature spells of the chosen type cost {2} less to cast.]]></LOCALISED_TEXT> 
    <LOCALISED_TEXT LanguageCode="ko-KR"><![CDATA[Creature spells of the chosen type cost {2} less to cast.]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="ru-RU"><![CDATA[Creature spells of the chosen type cost {2} less to cast.]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="pt-BR"><![CDATA[Creature spells of the chosen type cost {2} less to cast.]]></LOCALISED_TEXT>
    <FILTER>
   local chosenType = RSN_GetChosenCreatureType( EffectDC():Get_Chest( 0 ) )
    return (FilteredCard():GetSubType():Test( chosenType ) ~= 0) and
    (FilteredCard():GetPlayer() == EffectController()) and
    (FilteredCard() ~= nil) and
    (FilteredCard():GetZone() == ZONE_HAND)
    </FILTER>   
    <CONTINUOUS_ACTION layer="8">
    if FilteredCard() ~= nil then
       FilteredCard():DecreaseCost( 2 )
    end
    </CONTINUOUS_ACTION>   
  </STATIC_ABILITY>
here's the error : [string "Content\Functions\RSN_CHOOSE_CREATURE_TYPE_FUNCS.LOL [900]"]:163: attempt to index local 'oChest' (a nil value)

here the code line 163 : local nIndex = oChest:Int_Get( REGISTER_SELECTION_SELECTED_INDEX )

This is a part of RSN_GetChosenCreatureType function.

In game, the card works at half: the selection seems to be ok but no reduction cost is applied.

Any idea ?

Thx for help.

Re: Functions for "Choose a Creature Type"

PostPosted: 07 Sep 2012, 11:48
by RiiakShiNal
That would be because you are using EffectDC() across two different abilities. EffectDC() is only valid inside a single ability (unless passed as a parameter to a delayed trigger). Try using ObjectDC() which persists while the card is in play.

Re: Functions for "Choose a Creature Type"

PostPosted: 08 Sep 2012, 23:05
by Persee
Thanks for the tip, it's works. :)

But the message is still in SCRIPT_LOG.TXT : [lua] [string "Content\Functions\RSN_CHOOSE_CREATURE_TYPE_FUNCS.LOL [1128]"]:163: attempt to index local 'oChest' (a nil value)

And I don't know why. :?

Code: Select all
<TRIGGERED_ABILITY forced_skip="1" active_zone="ZONE_TRANSITION">
   <LOCALISED_TEXT LanguageCode="en-US"><![CDATA[As Urza’s Incubator enters the battlefield, choose a creature type.]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="it-IT"><![CDATA[As Urza’s Incubator enters the battlefield, choose a creature type.]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="de-DE"><![CDATA[Bestimme einen Kreaturentyp, wenn Urzas Brutkasten ins Spiel kommt.]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="fr-FR"><![CDATA[Au moment où l'Incubateur d'Urza arrive sur le champ de bataille, choisissez un type de créature.]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="es-ES"><![CDATA[As Urza’s Incubator enters the battlefield, choose a creature type.]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="jp-JA"><![CDATA[As Urza’s Incubator enters the battlefield, choose a creature type.]]></LOCALISED_TEXT> 
    <LOCALISED_TEXT LanguageCode="ko-KR"><![CDATA[As Urza’s Incubator enters the battlefield, choose a creature type.]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="ru-RU"><![CDATA[As Urza’s Incubator enters the battlefield, choose a creature type.]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="pt-BR"><![CDATA[As Urza’s Incubator enters the battlefield, choose a creature type.]]></LOCALISED_TEXT>
    <TRIGGER value="ZONECHANGE_TRANSITION" simple_qualifier="self" to_zone="ZONE_IN_PLAY" />
   <RESOLUTION_TIME_ACTION>
   local player = EffectController()
   ObjectDC():Make_Chest( 0 )
   RSN_FindPlayerCreatureTypesInZone( ObjectDC():Get_Chest( 0 ), player, ZONE_LIBRARY )
   local nBestIndex = ObjectDC():Get_Chest( 0 ):Int_Get( REGISTER_SELECTION_BEST_TYPE_INDEX )
   ObjectDC():Get_Chest( 0 ):Int_Set( REGISTER_SELECTION_SELECTED_INDEX, nBestIndex )
   ObjectDC():Int_Set( 10, -1 )
   </RESOLUTION_TIME_ACTION>
   <RESOLUTION_TIME_ACTION repeating="1">
   return RSN_ChooseCreatureTypeFromDC( EffectController(), ObjectDC():Get_Chest( 0 ) )
   </RESOLUTION_TIME_ACTION>   
  </TRIGGERED_ABILITY>
  <STATIC_ABILITY filter_zone="ZONE_HAND">
   <LOCALISED_TEXT LanguageCode="en-US"><![CDATA[Creature spells of the chosen type cost {2} less to cast.]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="it-IT"><![CDATA[Creature spells of the chosen type cost {2} less to cast.]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="de-DE"><![CDATA[Kreaturenzauber des bestimmten Typs kosten 2 weniger zum Ausspielen.]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="fr-FR"><![CDATA[Les sorts de créature du type choisi coûtent %2 de moins à lancer.]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="es-ES"><![CDATA[Creature spells of the chosen type cost {2} less to cast.]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="jp-JA"><![CDATA[Creature spells of the chosen type cost {2} less to cast.]]></LOCALISED_TEXT> 
    <LOCALISED_TEXT LanguageCode="ko-KR"><![CDATA[Creature spells of the chosen type cost {2} less to cast.]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="ru-RU"><![CDATA[Creature spells of the chosen type cost {2} less to cast.]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="pt-BR"><![CDATA[Creature spells of the chosen type cost {2} less to cast.]]></LOCALISED_TEXT>
    <FILTER>
   local chosenType = RSN_GetChosenCreatureType( ObjectDC():Get_Chest( 0 ) )
    return (FilteredCard():GetSubType():Test( chosenType ) ~= 0) and
    (FilteredCard():GetPlayer() == EffectController()) and
    (FilteredCard() ~= nil) and
    (FilteredCard():GetZone() == ZONE_HAND)
    </FILTER>   
    <CONTINUOUS_ACTION layer="8">
    if FilteredCard() ~= nil then
       FilteredCard():DecreaseCost( 2 )
    end
    </CONTINUOUS_ACTION>   
  </STATIC_ABILITY>
Edit : I solved the problem by putting the code in only one ability like you and saving the chosen type in a ObjectDC. No message occurs.

Code: Select all
  <TRIGGERED_ABILITY forced_skip="1" active_zone="ZONE_TRANSITION">
   <LOCALISED_TEXT LanguageCode="en-US"><![CDATA[As Urza’s Incubator enters the battlefield, choose a creature type.]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="it-IT"><![CDATA[As Urza’s Incubator enters the battlefield, choose a creature type.]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="de-DE"><![CDATA[Bestimme einen Kreaturentyp, wenn Urzas Brutkasten ins Spiel kommt.]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="fr-FR"><![CDATA[Au moment où l'Incubateur d'Urza arrive sur le champ de bataille, choisissez un type de créature.]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="es-ES"><![CDATA[As Urza’s Incubator enters the battlefield, choose a creature type.]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="jp-JA"><![CDATA[As Urza’s Incubator enters the battlefield, choose a creature type.]]></LOCALISED_TEXT> 
    <LOCALISED_TEXT LanguageCode="ko-KR"><![CDATA[As Urza’s Incubator enters the battlefield, choose a creature type.]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="ru-RU"><![CDATA[As Urza’s Incubator enters the battlefield, choose a creature type.]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="pt-BR"><![CDATA[As Urza’s Incubator enters the battlefield, choose a creature type.]]></LOCALISED_TEXT>
    <TRIGGER value="ZONECHANGE_TRANSITION" simple_qualifier="self" to_zone="ZONE_IN_PLAY" />
   <RESOLUTION_TIME_ACTION>
   local player = EffectController()
   EffectDC():Make_Chest( 0 )
   RSN_FindPlayerCreatureTypesInZone( EffectDC():Get_Chest( 0 ), player, ZONE_LIBRARY )
   local nBestIndex = EffectDC():Get_Chest( 0 ):Int_Get( REGISTER_SELECTION_BEST_TYPE_INDEX )
   EffectDC():Get_Chest( 0 ):Int_Set( REGISTER_SELECTION_SELECTED_INDEX, nBestIndex )
   EffectDC():Int_Set( 10, -1 )
   </RESOLUTION_TIME_ACTION>
   <RESOLUTION_TIME_ACTION repeating="1">
   return RSN_ChooseCreatureTypeFromDC( EffectController(), EffectDC():Get_Chest( 0 ) )
   </RESOLUTION_TIME_ACTION>
   <RESOLUTION_TIME_ACTION>
    local chosenType = RSN_GetChosenCreatureType( EffectDC():Get_Chest( 0 ) )
   ObjectDC():Int_Set(0, chosenType)
   </RESOLUTION_TIME_ACTION>
  </TRIGGERED_ABILITY>
  <STATIC_ABILITY filter_zone="ZONE_HAND">
   <LOCALISED_TEXT LanguageCode="en-US"><![CDATA[Creature spells of the chosen type cost {2} less to cast.]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="it-IT"><![CDATA[Creature spells of the chosen type cost {2} less to cast.]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="de-DE"><![CDATA[Kreaturenzauber des bestimmten Typs kosten 2 weniger zum Ausspielen.]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="fr-FR"><![CDATA[Les sorts de créature du type choisi coûtent {2} de moins à lancer.]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="es-ES"><![CDATA[Creature spells of the chosen type cost {2} less to cast.]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="jp-JA"><![CDATA[Creature spells of the chosen type cost {2} less to cast.]]></LOCALISED_TEXT> 
    <LOCALISED_TEXT LanguageCode="ko-KR"><![CDATA[Creature spells of the chosen type cost {2} less to cast.]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="ru-RU"><![CDATA[Creature spells of the chosen type cost {2} less to cast.]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="pt-BR"><![CDATA[Creature spells of the chosen type cost {2} less to cast.]]></LOCALISED_TEXT>
    <FILTER>
   local chosenType = ObjectDC():Int_Get( 0 )

    return (FilteredCard():GetSubType():Test( chosenType ) ~= 0) and
    (FilteredCard():GetPlayer() == EffectController()) and
    (FilteredCard() ~= nil) and
    (FilteredCard():GetZone() == ZONE_HAND)
    </FILTER>   
    <CONTINUOUS_ACTION layer="8">
    if FilteredCard() ~= nil then
       FilteredCard():DecreaseCost( 2 )
    end
    </CONTINUOUS_ACTION>   
  </STATIC_ABILITY>
Thanks again for your help and your great function =D>

Re: Functions for "Choose a Creature Type"

PostPosted: 27 May 2013, 16:07
by RiiakShiNal
The files have now been updated to work with the latest updates from WotC.

Changes are to:
  • RSN_CHOOSE_CREATURE_TYPE_FUNCS.LOL - to update the constants
  • CREATURE_TYPES.TXT - to correct the order of SURRAKAR to match with WotC's version.
  • CREATURE_TYPE_TEXT_8192.XML - To make the text match with the new constant values.