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