Board index Programs with AI or Rules Enforcement Magic: The Gathering - Duels of the Planeswalkers Programming Talk
First DotP2014 modding problems
Moderator: CCGHQ Admins
Re: First DotP2014 modding problems
by sumomole » 08 Jul 2013, 07:24
I have a question, in 2013 we used "ObjectDC (): Set_CardPtr (0, target)" to save a data, another card can use "first_card: GetDataChest (): Get_CardPtr (0)" to read the target, if I use your code, how do I do this?RiiakShiNal wrote:Well it should be easy to use. Instead of LinkedDC() use RSN_ObjectDC() and hopefully it will work for you.
-
sumomole - Programmer
- Posts: 611
- Joined: 07 Jun 2011, 08:34
- Has thanked: 51 times
- Been thanked: 234 times
Re: First DotP2014 modding problems
by thefiremind » 08 Jul 2013, 08:37
By looking at the LOL file I see that "RSN_ObjectDC()" is a wrapper for "RSN_GetObjectDC( Object(), true )" where the first parameter is the card and the second tells if you want to create the chest when it hasn't been found. So, the analogue for the old "first_card:GetDataChest()" should be "RSN_GetObjectDC(first_card, false)" with false because GetDataChest() wasn't initializing the chest (you can use true if you want it to happen).sumomole wrote:I have a question, in 2013 we used "ObjectDC (): Set_CardPtr (0, target)" to save a data, another card can use "first_card: GetDataChest (): Get_CardPtr (0)" to read the target, if I use your code, how do I do this?RiiakShiNal wrote:Well it should be easy to use. Instead of LinkedDC() use RSN_ObjectDC() and hopefully it will work for you.
< Former DotP 2012/2013/2014 modder >
Currently busy with life...
Currently busy with life...
-
thefiremind - Programmer
- Posts: 3515
- Joined: 07 Nov 2011, 10:55
- Has thanked: 118 times
- Been thanked: 721 times
Re: First DotP2014 modding problems
by sumomole » 08 Jul 2013, 09:05
Great, I will go to try his code one by one.thefiremind wrote:By looking at the LOL file I see that "RSN_ObjectDC()" is a wrapper for "RSN_GetObjectDC( Object(), true )" where the first parameter is the card and the second tells if you want to create the chest when it hasn't been found. So, the analogue for the old "first_card:GetDataChest()" should be "RSN_GetObjectDC(first_card, false)" with false because GetDataChest() wasn't initializing the chest (you can use true if you want it to happen).sumomole wrote:I have a question, in 2013 we used "ObjectDC (): Set_CardPtr (0, target)" to save a data, another card can use "first_card: GetDataChest (): Get_CardPtr (0)" to read the target, if I use your code, how do I do this?RiiakShiNal wrote:Well it should be easy to use. Instead of LinkedDC() use RSN_ObjectDC() and hopefully it will work for you.
-
sumomole - Programmer
- Posts: 611
- Joined: 07 Jun 2011, 08:34
- Has thanked: 51 times
- Been thanked: 234 times
Re: First DotP2014 modding problems
by RiiakShiNal » 08 Jul 2013, 12:51
Pretty much exactly like thefiremind said. The reason that RSN_GetObjectDC is slightly different from cardPointer:GetDataChest() is because in DotP2013 it would not under any circumstances initialize the data chest, whereas there may be an instance where you would want the data chest to be initialized and usable.thefiremind wrote:By looking at the LOL file I see that "RSN_ObjectDC()" is a wrapper for "RSN_GetObjectDC( Object(), true )" where the first parameter is the card and the second tells if you want to create the chest when it hasn't been found. So, the analogue for the old "first_card:GetDataChest()" should be "RSN_GetObjectDC(first_card, false)" with false because GetDataChest() wasn't initializing the chest (you can use true if you want it to happen).sumomole wrote:I have a question, in 2013 we used "ObjectDC (): Set_CardPtr (0, target)" to save a data, another card can use "first_card: GetDataChest (): Get_CardPtr (0)" to read the target, if I use your code, how do I do this?
Though due to the way that LUA handles parameters to LUA functions you can actually use RSN_GetObjectDC( cardPointer ) to work just like old DotP 2013 (because it will make the parameter bCreate nil which will not equal true, thus has equivalent operation to RSN_GetObjectDC( cardPointer, false )). The second parameter is only required if you want to initialize the ObjectDC.
There is documentation on all the (non-internal) functions here as well:
DotP 2014: ObjectDC Functions
Just getting started: Xander9009's DotP 2014 Community Wad
Need a deck builder: DotP 2014 Deck Builder
Problems Modding: DotP 2014 Frequent Modding Mistakes
Need a deck builder: DotP 2014 Deck Builder
Problems Modding: DotP 2014 Frequent Modding Mistakes
- RiiakShiNal
- Programmer
- Posts: 2185
- Joined: 16 May 2011, 21:37
- Has thanked: 75 times
- Been thanked: 497 times
Re: First DotP2014 modding problems
by thefiremind » 08 Jul 2013, 22:10
OK, this is really weird... I was making some experiments on the forecast mechanic, and I managed to create an invisible token that can be programmed through a LOL file to check if any card needs an upkeep time window. But this is not the problem. The following is the forecast ability from Pride of the Clouds after I undercosted it for test purposes and took almost everything out of it:
- Code: Select all
<ACTIVATED_ABILITY active_zone="ZONE_HAND">
<LOCALISED_TEXT LanguageCode="en-US"><![CDATA[Forecast — {2}{W}{U}, Reveal Pride of the Clouds from your hand: Put a 1/1 white and blue Bird creature token with flying onto the battlefield.]]></LOCALISED_TEXT>
<LOCALISED_TEXT LanguageCode="fr-FR"><![CDATA[Prévision — {2}{W}{U}, révélez la Bande des nuages depuis votre main : Mettez en jeu un jeton de créature 1/1 blanche et bleue Oiseau avec le vol.]]></LOCALISED_TEXT>
<LOCALISED_TEXT LanguageCode="es-ES"><![CDATA[Presagiar — {2}{W}{U}, mostrar la Manada de nubes de tu mano: Pon en juego una ficha de criatura Ave blanca y azul 1/1 con la habilidad de volar.]]></LOCALISED_TEXT>
<LOCALISED_TEXT LanguageCode="de-DE"><![CDATA[Vorhersage — {2}{W}{U}, zeige Stolz der Wolken aus deiner Hand offen vor: Bringe einen 1/1 weißen und blauen Vogelspielstein mit Flugfähigkeit ins Spiel.]]></LOCALISED_TEXT>
<LOCALISED_TEXT LanguageCode="it-IT"><![CDATA[Previsione — {2}{W}{U}, Rivela l’Orgoglio delle Nubi dalla tua mano: Metti sul campo di battaglia una pedina creatura Uccello 1/1 bianca e blu con volare.]]></LOCALISED_TEXT>
<LOCALISED_TEXT LanguageCode="jp-JA"><![CDATA[予見 ― {2}{W}{U}, あなたの手札から雲の群れを公開する:飛行を持つ白であり青である1/1の鳥クリーチャー・トークンを1体場に出す。]]></LOCALISED_TEXT>
<LOCALISED_TEXT LanguageCode="ko-KR"><![CDATA[Forecast — {2}{W}{U}, Reveal Pride of the Clouds from your hand: Put a 1/1 white and blue Bird creature token with flying onto the battlefield.]]></LOCALISED_TEXT>
<LOCALISED_TEXT LanguageCode="ru-RU"><![CDATA[Предвидение — {2}{W}{U}, Покажите Облачный прайд из своей руки: Введите в игру фишку белого и синего существа Птица 1/1 с Полетом.]]></LOCALISED_TEXT>
<LOCALISED_TEXT LanguageCode="pt-BR"><![CDATA[Prever — {2}{W}{U}, Revele Alcatéia das Nuvens de sua mão: Coloque em jogo uma ficha de criatura branca e azul 1/1 do tipo Ave com a habilidade de voar.]]></LOCALISED_TEXT>
<COST mana_cost="{1}" type="Mana" />
<RESOLUTION_TIME_ACTION>
EffectController():GainLife(1) -- just to see if it resolves
</RESOLUTION_TIME_ACTION>
</ACTIVATED_ABILITY>
< Former DotP 2012/2013/2014 modder >
Currently busy with life...
Currently busy with life...
-
thefiremind - Programmer
- Posts: 3515
- Joined: 07 Nov 2011, 10:55
- Has thanked: 118 times
- Been thanked: 721 times
Re: First DotP2014 modding problems
by gorem2k » 09 Jul 2013, 18:01
It hangs when I have 2 colors available.thefiremind wrote:Could someone else test if the result is the same, and maybe try to find the reason?
don't know what could cause this. maybe engine bug? yeah I guess this time is not card fault, I mean, no complex code here!
EDIT: will try again this time, changing to
EDIT II: changing to a more specific cost makes it playable.
Last edited by gorem2k on 09 Jul 2013, 18:11, edited 1 time in total.
Re: First DotP2014 modding problems
by thefiremind » 09 Jul 2013, 18:06
I thought the same, and since cycling doesn't have this problem, the only thing I can guess is that it hangs when the card needs to stay in hand after paying the cost. If that's true, DotP2014 can't have not only forecast, but also ninjutsu, which is quite sad.gorem2k wrote:don't know what could cause this. maybe engine bug? yeah I guess this time is not card fault, I mean, no complex code here!
< Former DotP 2012/2013/2014 modder >
Currently busy with life...
Currently busy with life...
-
thefiremind - Programmer
- Posts: 3515
- Joined: 07 Nov 2011, 10:55
- Has thanked: 118 times
- Been thanked: 721 times
Re: First DotP2014 modding problems
by xenavire » 30 Jul 2013, 21:55
thefiremind, I had an idea - would the cost resolve if the card left the hand, then return? For example, by adding in a temporary exile? I can't think of any cards off the top of my head that use a card being exiled from the hand as a trigger, so if it worked it might be an acceptable workaround.
I wish I knew more about coding, I might have other, better ideas, but I hope this helps.
I wish I knew more about coding, I might have other, better ideas, but I hope this helps.
- xenavire
- Posts: 2
- Joined: 30 Jul 2013, 21:52
- Has thanked: 0 time
- Been thanked: 0 time
Re: First DotP2014 modding problems
by thefiremind » 30 Jul 2013, 22:02
Thanks for the idea, but we still don't know this problem deeply enough: kevlahnota coded ninjutsu without problems, so the reason why my code doesn't work is a mystery.
< Former DotP 2012/2013/2014 modder >
Currently busy with life...
Currently busy with life...
-
thefiremind - Programmer
- Posts: 3515
- Joined: 07 Nov 2011, 10:55
- Has thanked: 118 times
- Been thanked: 721 times
Re: First DotP2014 modding problems
by xenavire » 30 Jul 2013, 22:07
Ah, well I wish you luck then. I am a little behind with the progress on 2014 modding, as I refuse to buy it in it's current form. I got burned by 2013, and hated it until I figured out that I could mod it (which actually took months).
So while I try to keep tabs on what has happened, it's all either gibberish or isn't relevant to me (yet). But I can't help but try to help if I think I see a solution. I have learned a lot reading these threads though, so I hope I can find a way to be useful.
So while I try to keep tabs on what has happened, it's all either gibberish or isn't relevant to me (yet). But I can't help but try to help if I think I see a solution. I have learned a lot reading these threads though, so I hope I can find a way to be useful.
- xenavire
- Posts: 2
- Joined: 30 Jul 2013, 21:52
- Has thanked: 0 time
- Been thanked: 0 time
Re: First DotP2014 modding problems
by thefiremind » 31 Jul 2013, 22:49
I'm quoting myself because this problem is now solved, thanks to Miraika who found the solution. In DotP2014 you can still refer to resource_id's of the original card from an ability granted to another card: you just need to grant all the abilities you need to refer to, together with the "main" one.thefiremind wrote:I stumbled onto another problem. Now that I can grant activated abilities to cards in the graveyard, I have another issue that prevents me from coding Sedris, the Traitor King. In DotP2014 you can't refer to resource_id's of the original card from an ability granted to another card. This doesn't allow me to create the exiling delayed triggers when I unearth a creature using the ability granted by Sedris. Does anyone have a clever idea to overcome the problem?
Isn't it great? A Grixis/unearth deck with Sedris as main star will be soon included in my mod.
< Former DotP 2012/2013/2014 modder >
Currently busy with life...
Currently busy with life...
-
thefiremind - Programmer
- Posts: 3515
- Joined: 07 Nov 2011, 10:55
- Has thanked: 118 times
- Been thanked: 721 times
Re: First DotP2014 modding problems
by sumomole » 01 Aug 2013, 03:56
If RiiakShiNal know this, he will be more happy, since his Mikaeus, the Unhallowed.thefiremind wrote:I'm quoting myself because this problem is now solved, thanks to Miraika who found the solution. In DotP2014 you can still refer to resource_id's of the original card from an ability granted to another card: you just need to grant all the abilities you need to refer to, together with the "main" one.thefiremind wrote:I stumbled onto another problem. Now that I can grant activated abilities to cards in the graveyard, I have another issue that prevents me from coding Sedris, the Traitor King. In DotP2014 you can't refer to resource_id's of the original card from an ability granted to another card. This doesn't allow me to create the exiling delayed triggers when I unearth a creature using the ability granted by Sedris. Does anyone have a clever idea to overcome the problem?
Isn't it great? A Grixis/unearth deck with Sedris as main star will be soon included in my mod.
-
sumomole - Programmer
- Posts: 611
- Joined: 07 Jun 2011, 08:34
- Has thanked: 51 times
- Been thanked: 234 times
Re: First DotP2014 modding problems
by RiiakShiNal » 01 Aug 2013, 13:46
I am happier because now I can eliminate the requirements for the Core Fixes mod. Though I also noticed something, you actually don't have to grant the ability that you want to grant/use later from the granted ability. So with Mikaeus, the Unhallowed this actually does work:sumomole wrote:If RiiakShiNal know this, he will be more happy, since his Mikaeus, the Unhallowed.
- Code: Select all
<STATIC_ABILITY>
<LOCALISED_TEXT LanguageCode="en-US"><![CDATA[Other non-Human creatures you control get +1/+1 and have undying.]]></LOCALISED_TEXT>
<!-- Text Snipped -->
<FILTER>
local filter = ClearFilter()
filter:Add( FE_CARD_INSTANCE, OP_NOT, EffectSource() )
filter:Add( FE_SUBTYPE, OP_NOT, CREATURE_TYPE_HUMAN )
filter:Add( FE_TYPE, OP_IS, CARD_TYPE_CREATURE )
filter:Add( FE_CONTROLLER, OP_IS, EffectController() )
</FILTER>
<CONTINUOUS_ACTION layer="7C" filter_id="0">
if FilteredCard() ~= nil then
local characteristics = FilteredCard():GetCurrentCharacteristics()
characteristics:Power_Add( 1 )
characteristics:Toughness_Add( 1 )
end
</CONTINUOUS_ACTION>
<CONTINUOUS_ACTION layer="6" filter_id="0">
if FilteredCard() ~= nil then
local characteristics = FilteredCard():GetCurrentCharacteristics()
characteristics:GrantAbility(1)
end
</CONTINUOUS_ACTION>
</STATIC_ABILITY>
<TRIGGERED_ABILITY resource_id="1" badge="BADGE_UNDYING">
<LOCALISED_TEXT LanguageCode="en-US"><![CDATA[Undying]]></LOCALISED_TEXT>
<!-- Text Snipped -->
<TRIGGER value="ZONECHANGE_BEGIN" simple_qualifier="self" to_zone="ZONE_GRAVEYARD" from_zone="ZONE_BATTLEFIELD" />
<INTERVENING_IF ignore_resolution_check="1">
return (TriggerObject():CountCounters(MTG():PlusOnePlusOneCounters()) == 0) and (TriggerObject():IsToken() == false)
</INTERVENING_IF>
<RESOLUTION_TIME_ACTION>
if ((TriggerObject() ~= nil) and (TriggerObject():IsToken() == false)) then
local oDelayDC = EffectDC():Make_Chest(0)
oDelayDC:Set_CardPtr(0, TriggerObject())
oDelayDC:Protect_CardPtr(0)
MTG():CreateDelayedTrigger(2, oDelayDC)
end
</RESOLUTION_TIME_ACTION>
<RESOLUTION_TIME_ACTION>
if (TriggerObject() ~= nil) then
TriggerObject():PutOntoBattlefield( TriggerObject():GetOwner() )
end
</RESOLUTION_TIME_ACTION>
<RESOLUTION_TIME_ACTION>
MTG():RemoveDelayedTrigger(2)
</RESOLUTION_TIME_ACTION>
</TRIGGERED_ABILITY>
<TRIGGERED_ABILITY resource_id="2" replacement_effect="1">
<TRIGGER value="ZONECHANGE_TRANSITION" to_zone="ZONE_BATTLEFIELD" from_zone="ZONE_ANY">
return (TriggerObject() == EffectDC():Get_CardPtr(0))
</TRIGGER>
<RESOLUTION_TIME_ACTION>
if (TriggerObject() ~= nil) then
TriggerObject():AddCounters( MTG():PlusOnePlusOneCounters(), 1)
end
</RESOLUTION_TIME_ACTION>
</TRIGGERED_ABILITY>
I have also verified that it doesn't interfere with other abilities with resource_ids on the target card.
Just getting started: Xander9009's DotP 2014 Community Wad
Need a deck builder: DotP 2014 Deck Builder
Problems Modding: DotP 2014 Frequent Modding Mistakes
Need a deck builder: DotP 2014 Deck Builder
Problems Modding: DotP 2014 Frequent Modding Mistakes
- RiiakShiNal
- Programmer
- Posts: 2185
- Joined: 16 May 2011, 21:37
- Has thanked: 75 times
- Been thanked: 497 times
Re: First DotP2014 modding problems
by thefiremind » 01 Aug 2013, 13:54
Then I'm surprised as well... I wonder what went wrong the first time I tried. Maybe there was an error somewhere else and I overlooked it, those were the first days modding DotP2014 so it's very likely.
< Former DotP 2012/2013/2014 modder >
Currently busy with life...
Currently busy with life...
-
thefiremind - Programmer
- Posts: 3515
- Joined: 07 Nov 2011, 10:55
- Has thanked: 118 times
- Been thanked: 721 times
Re: First DotP2014 modding problems
by RiiakShiNal » 01 Aug 2013, 14:06
Don't feel too bad, I managed to somehow overlook it as well with my first version of Mikaeus, the Unhallowed so I think it is pretty easy to miss.thefiremind wrote:Then I'm surprised as well... I wonder what went wrong the first time I tried. Maybe there was an error somewhere else and I overlooked it, those were the first days modding DotP2014 so it's very likely.
Just getting started: Xander9009's DotP 2014 Community Wad
Need a deck builder: DotP 2014 Deck Builder
Problems Modding: DotP 2014 Frequent Modding Mistakes
Need a deck builder: DotP 2014 Deck Builder
Problems Modding: DotP 2014 Frequent Modding Mistakes
- RiiakShiNal
- Programmer
- Posts: 2185
- Joined: 16 May 2011, 21:37
- Has thanked: 75 times
- Been thanked: 497 times
67 posts
• Page 4 of 5 • 1, 2, 3, 4, 5
Who is online
Users browsing this forum: No registered users and 33 guests