It is currently 11 Jun 2025, 20:09
   
Text Size

Could I ask a question, please?

New decks and cards for Stainless Games' release

Moderator: CCGHQ Admins

Re: Could I ask a question, please?

Postby Takhen » 12 Feb 2013, 20:54

Please forgive the nonsense that I write, they need me to explain how much better about a science I don't know in a language I know little.
I hope I am able to explain what I mean :)
User avatar
Takhen
 
Posts: 235
Joined: 04 Feb 2013, 19:35
Has thanked: 0 time
Been thanked: 0 time

Re: Could I ask a question, please?

Postby thefiremind » 12 Feb 2013, 23:14

Takhen wrote:A great hand would be to know how to link the pieces of code: "()" ":" "~nil"
And those are not a lot
Then I need to chose the correct code
Didn't RiiakShiNal already explain what "()" and ":" mean? "nil" is a special value that means "nothing". If a variable is equal to "nil", it means there's nothing stored in it. "~=" means "not equal to".

Takhen wrote:If I see this:
Code: Select all
CountCardsInYourGraveyardOfType = function(l_5_0)
  Object():GetFilter():Clear()
  Object():GetFilter():SetZone(ZONE_GRAVEYARD)
  Object():GetFilter():AddSubType(l_5_0)
  Object():GetFilter():SetPlayer(Object():GetPlayer())
  Object():GetFilter():NotTargetted()
  return Object():GetFilter():Count()
I can image that this count the number of card in the graveyard of a tipe
So there is a zone's filter that say "only in the graveyard", then the type of the card, that is "1, 5, 0"
No, "l_5_0" (the first one is a "L") and anything similar to it on that page is the result of decompiling the LOL files in the official core WAD: the name of the variables can't be retrieved from a compiled LOL file, so the decompiler gave that kind of name to the variables.

Takhen wrote:This is only a counter (not return in play or remove, or other), I would use this if I have to make a card like "this creature has power like the number of creatures in your (not targeted) graveyard"
Almost right. That function needs a parameter that will be used for setting the sub-type you want to count, so for example if you write
Code: Select all
local mickey_mouse = CountCardsInYourGraveyardOfType(CREATURE_TYPE_GOBLIN)
the variable mickey_mouse (just to emphasize that the name of the variables has no importance :lol:) will contain the number of Goblin cards in your graveyard.

Takhen wrote:But when I see so many numbers and less words like here:
Code: Select all
AtLeastOneTargetFromDefinition = function(l_1_0)
  local l_1_1 = Object():LoadTargetDefinition(l_1_0)
  local l_1_2, l_1_3 = l_1_1:CountStopAt, l_1_1
  local l_1_4 = 1
  return l_1_2(l_1_3, l_1_4)
end
How I could suppose if I know only this is a filter for something (that is also different from the filter I used about the graveyard fact)?
If you look at the existing cards you can see that AtLeastOneTargetFromDefinition is used in the TARGET_DETERMINATION blocks to check if there's at least one target that corresponds to the definition whose ID is passed as a parameter. Don't try to understand how the function is written, because the decompiler made it overly complicated and I have some problems understanding it, too. Just focus on the function name (AtLeastOneTargetFromDefinition) and use it as you see it's used in the existing cards.

Takhen wrote:So I don't say I want to learn it fast
But if in a topic like this
viewtopic.php?f=65&t=7330
it was

*Clear() => This have to be used (for examples), like opening of a filter
*SetMarkedObjectsOnly() => This filters only objects with counters on them
*SetMinEnchantmentCount(Number) => This serves when...
*SetParentPlayer => This serves when...

Otherwise those are like a shopping list with the costs but not the commodity to be bought: I know what to give, but I don't know what the game will do "in return" of these codes-prices
I understand this very well, in fact I started to make something like this for DotP2012:
http://www.slightlymagic.net/wiki/Objec ... tP_2012%29
but I gave up because nobody was helping me, and it was too time-consuming for only one person.

Takhen wrote:Of course you have every reason in the world to say that if one had the foundations of computer science would know automatically the things I say confuse me, but for people like me who does not, is not possible with a little effort and the right aid know the steps that need to be made ​​to learn?
You ask for a little effort, but have you tried to put a little effort yourself? I had a conversation by PM with another user of this forum who managed to code the 3 Urza's lands by copy-pasting existing code with little modification, and even if there were some errors in his code, most of his work was OK... but the amazing thing is that judging from his errors, I'm convinced that he hasn't much more experience than you. That's how the forum is supposed to work: first you try, then you ask help on specific things you haven't been able to code, instead of asking to write a book for you. :lol:
< 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

Re: Could I ask a question, please?

Postby Takhen » 12 Feb 2013, 23:52

I don't know if to study LOL by myself would be too general related with the target of the game
I could try and maybe my doubts will be more specific
What was LOL's complete name?
User avatar
Takhen
 
Posts: 235
Joined: 04 Feb 2013, 19:35
Has thanked: 0 time
Been thanked: 0 time

Re: Could I ask a question, please?

Postby thefiremind » 13 Feb 2013, 00:21

Do you mean Lua?
< 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

Re: Could I ask a question, please?

Postby RiiakShiNal » 13 Feb 2013, 00:24

Takhen wrote:So, if I understand, LOL (LUA in DOTP 2012) is the language I use in the XML files
LUA is indeed the language used, LOL files are simply files that contains code snippets that can be accessed multiple times while only needing to be loaded once and they can either be compiled (like the original game files) or plain text (like we modders make them). It is used in card XML files for Abilities and custom scoring for certain cards.

Takhen wrote:
RiiakShiNal wrote:No, there is no such list because many functions are used for all types of cards when and where they are needed. Making such a list would be virtually impossible.
About this I link you this:
viewtopic.php?f=65&t=7337
In this topic there is a list called "EFFECTS", so I know I have to use that to have an effect (If I want to draw, or discard, or regenerate), or also a list called "FILTERS" so I know I have to use that if I need "that player discard a card FROM HIS DECK", "destroy a creature AN OPPONENT CONTROL"
Those are not lists they are general groupings that the original developers made for some "helper" functions, they are not really built-in functions like those in the list from this topic. If you look closely at the "FILTERS" then you will see that some of those functions are not actually used for filters, but actually are used for triggers like SelfTriggered(), OpponentTriggered(), BlueSpell(), LandFall(), Intimidate(), etc....

Also if you look at the functions in those 2 files some of them make use of the same built-in functions like GetCardType().

Takhen wrote:But about lists called "MISC" or "EXTRACTINFO" I can't imagine their usage, so when I search in that list that I need, I don't know neither what I am reading
If Extract info was something like "those pieces of code say to the game -use this card as an instant- -use this card as a enchantment-", so I will read the list knowing a little more I have to find in that
Misc sets up some basics for accessing certain objects like Object(), EffectDC(), and TriggerPlayer() which is then further fleshed out in ExtractInfo which also contains functions that are useful in several places. You can't say that those LOL files are for one specific card type or another it just doesn't work like that.

Takhen wrote:In third type of list, I read "COSTANTS" and I see a lot of number I know the game will read as it was an ability, a zone or other, but I don't know where to use
Now look at this:
Code: Select all
HELP title="MORE_INFO_BADGE_TITLE_3" body="MORE_INFO_BADGE_BODY_3" zone="ZONE_ANY" />
This is the line that say to the game "give information about Deaththouch", right?

If it was like
Code: Select all
HELP title="MORE_INFO_BADGE_TITLE_*inserthereBADGENUMBERfromCONSTANTlist*" body="MORE_INFO_BADGE_BODY_3" zone="ZONE_ANY" />
It will be easy to understand a part of the "CONSTANT" list

Conversely, if I start from the list to understand how to use the constant, it is hard
The Constants are useful for many things including NOT having to know the numbers. For example Deathtouch, if we want to give Deathtouch to a creature we use:
Code: Select all
Object():GetCurrentCharacteristics():Characteristic_Set( CHARACTERISTIC_DEATHTOUCH, 1 )
We don't have to know that CHARACTERISTIC_DEATHTOUCH is 0, just that we use CHARACTERISTIC_DEATHTOUCH when setting or checking for Deathtouch. We don't really care what the value is just that it exists and has a name we can remember and use.

Takhen wrote:This is good, knowing the use of "()" or "object", I could more simply understand why those parentesis are sometimes empty or full
So I am now able to translate
Code: Select all
Object():GetCurrentCharacteristics():Characteristic_Set( CHARACTERISTIC_FIRST_STRIKE, 1 )
In
Code: Select all
On this card: Active the next characteristic: Characteristic from a set of them (The specifc characteristic is "First Strike", Active that -where "Active" is the numer one after the comma- )
Knowing a little more of rules than before, this line looks like it was more clear
Not quite right, it's more like:

Using this card: Using it's current characteristics: Change the "First Strike" flag to 1 (active).

Takhen wrote:So I can speculate that
Code: Select all
local nNumCounters = Object():CountCounters( MTG():PlusOnePlusOneCounters() )
means
Code: Select all
Remember the number of counters -to use in the effect of token- = On this card: Add Counters: Type of counters is +1/+1
In English it would be more along the lines:

Using this card count the number of +1/+1 counters and store that number in a new location called nNumCounters.

Takhen wrote:And now we should say when those must be added, something like (invented, obviusly, otherwise if I was able to do to real I would just done it!)
Code: Select all
When Object goes in PLAY ZONE
Send from the zone PLAY ZONE to GRAVEYARD ZONE
Number: Any number
Filter: Creature
________Filter: You control

local nNumCounters = Object():CountCounters( MTG():PlusOnePlusOneCounters() )

Where local nNumCounters = number Creature moved from PLAY ZONE to GRAVEYARD in this way

In UNKEEP_STEP
Effect: add to PLAY ZONE under your control
Number: 2*nNumCounters
EffectObject: 1/1 token, see ID "blablabla" which links this token with a pre-existent one in the game's database
Now, that I wrote, is obviusly not a code, but this is more or less what the game want to know from my card
I don't need to know what I have to say in the card, but I have to know how to do this
This makes little sense because the game does not inherently give you anyway to count the number of objects that transition from In Play to Graveyard, that calculation would all have to be done manually 1 object at a time. Also it seems as if you are mixing multiple different abilities here without separating or classifying which is which because the first part seems like you are trying to describe Devour while the second part seems like the second ability of Mycoloth except you seem to have moved where the multiplier of 2 is used. Also nNumCounters where you have it will always return 0 because at that point you have not adding any counters yet.

Takhen wrote:A great hand would be to know how to link the pieces of code: "()" ":" "~nil"
And those are not a lot
Then I need to chose the correct code

If I see this:
Code: Select all
CountCardsInYourGraveyardOfType = function(l_5_0)
  Object():GetFilter():Clear()
  Object():GetFilter():SetZone(ZONE_GRAVEYARD)
  Object():GetFilter():AddSubType(l_5_0)
  Object():GetFilter():SetPlayer(Object():GetPlayer())
  Object():GetFilter():NotTargetted()
  return Object():GetFilter():Count()
I can image that this count the number of card in the graveyard of a tipe
So there is a zone's filter that say "only in the graveyard", then the type of the card, that is "1, 5, 0"
Looking here
Code: Select all
CARD_TYPE_ARTIFACT = 0
CARD_TYPE_CREATURE = 1
CARD_TYPE_ENCHANTMENT = 2
CARD_TYPE_INSTANT = 3
CARD_TYPE_LAND = 4
CARD_TYPE_PLANESWALKER = 5
CARD_TYPE_SORCERY = 6
CARD_TYPE_TRIBAL = 7
CARD_TYPE_SCHEME = 8
CARD_TYPE_PLANE = 9
CARD_TYPE_PHENOMENON = 10
I think in the example the type of card to filter in the graveyard is a Planeswalker, or a Creature, or an Artifact

This is only a counter (not return in play or remove, or other), I would use this if I have to make a card like "this creature has power like the number of creatures in your (not targeted) graveyard"

This MUST be wrong, but it let me suppose something on experiment
You're right, that is wrong.
Code: Select all
CountCardsInYourGraveyardOfType = function(l_5_0)
  Object():GetFilter():Clear()
  Object():GetFilter():SetZone(ZONE_GRAVEYARD)
  Object():GetFilter():AddSubType(l_5_0)
  Object():GetFilter():SetPlayer(Object():GetPlayer())
  Object():GetFilter():NotTargetted()
  return Object():GetFilter():Count()
This can be read as:

CountCardsInYourGraveyardOfType is a function that accepts 1 parameter named "l_5_0". This function will first clear the filter on the object, set the zone to look in to ZONE_GRAVEYARD, look for the type that was passed in as "l_5_0", restrict to only things owned by the current controller of this card, and this filter does not target anything. Then count how many objects match the new filter and send that number back to whatever called this function. Note that "l_5_0" is defined by the caller and could be of ANY ONE type. Also that is a lower case "L" not the number "1"

Parenthesis are used for 2 purposes enclosing parameters and specifying order of operations.

The Colon is used to access a function from an object instance.

Nil is nothing, an unset variable, something that has not been defined, etc....

Takhen wrote:But when I see so many numbers and less words like here:
Code: Select all
AtLeastOneTargetFromDefinition = function(l_1_0)
  local l_1_1 = Object():LoadTargetDefinition(l_1_0)
  local l_1_2, l_1_3 = l_1_1:CountStopAt, l_1_1
  local l_1_4 = 1
  return l_1_2(l_1_3, l_1_4)
end
How I could suppose if I know only this is a filter for something (that is also different from the filter I used about the graveyard fact)?
This in and of itself is not a filter, but instead uses a filter that has been predefined in the card XML. It loads that filter into variable "l_1_1", accesses that filter to call function CountStopAt(), then stores the result in "l_1_2", and ultimately returning whether at least 1 object matched what was in the the filter.

Takhen wrote:So I don't say I want to learn it fast
But if in a topic like this
viewtopic.php?f=65&t=7330
it was

*Clear() => This have to be used (for examples), like opening of a filter
*SetMarkedObjectsOnly() => This filters only objects with counters on them
*SetMinEnchantmentCount(Number) => This serves when...
*SetParentPlayer => This serves when...

Otherwise those are like a shopping list with the costs but not the commodity to be bought: I know what to give, but I don't know what the game will do "in return" of these codes-prices
There are reasons why I did not do that in that thread.
  • When the post was made we didn't know exactly what the functions did, just that those were the names (some may not even work as they could be leftovers from previous versions).
  • We didn't and still don't know the parameters for all of the functions (I tried to add the parameters for those functions we found out, but I haven't been able to keep up with it).
  • Functions can be used in multiple instances and may or may not be needed in other instances.
So for some of those functions it is exactly as you say "Here is a function that can be used, but I don't know exactly what the game will do with it."

Takhen wrote:Of course you have every reason in the world to say that if one had the foundations of computer science would know automatically the things I say confuse me, but for people like me who does not, is not possible with a little effort and the right aid know the steps that need to be made ​​to learn?
I'm not saying that having the foundations of programming will allow you to know what to do with all of this, but I can say that it does help tremendously. Even just having base knowledge of what functions, objects, instances, and a few other basic programming concepts will help immensely.

Edit: I should also mention that walls of text are hard to respond to and generally discourage people from reading them. I generally recommend trying to keep posts short if possible while still providing enough information that we can figure out what the problem is (as that will usually get better answers).

Trying to explain how to program (which seems to be where you are trying to lead this thread) is well beyond the scope of this forum and beyond the capabilities of most of us to teach (myself included).

Short and simple: Creating non-simple cards equals programming, if you can't handle simple programming then you can't make non-simple cards. Complex cards generally require even more programming skills.
RiiakShiNal
Programmer
 
Posts: 2188
Joined: 16 May 2011, 21:37
Has thanked: 75 times
Been thanked: 497 times

Re: Could I ask a question, please?

Postby Takhen » 13 Feb 2013, 15:49

I'm sorry for the nonsense about the codes I wrote, it wasn't necessary to make this clear, although I thank the dedication, it was a way to explain what I can guess and what not to my current level to see if we could patch up with more information

It would seem that I need more than some tinkering here and there a real basis of computer science
I will try to learn a little of LUA if able (and if it is correct now: that I have to learn LUA, LOL are game's files that uses LUA language) and as I was advised, I will post something to discuss more specific like a card I tried to make in particular

Thanks again for the attention given to me, I hope to soon be able to realize at least a small piece of code to discuss :)
User avatar
Takhen
 
Posts: 235
Joined: 04 Feb 2013, 19:35
Has thanked: 0 time
Been thanked: 0 time

Re: Could I ask a question, please?

Postby NEMESiS » 13 Feb 2013, 18:19

This thread has been an interesting read and made me realize that I will most likely be limited to making simple cards and asking for advice. Takhen about a month ago I had no idea I could even mod DotP13 and had even less of a clue how to code. Only reason why I "hunted down" a forum like this is because I wanted the Bolas deck, because it fit my playing style to a "T" (minus the MOXen :p). With that said, there are many tools available in this site and people willing to help you with questions and things you might not know about so I dove right in and started to open everything I could. So far I have managed to make several different cards on my own mostly by Frankensteining them together, sometimes even surprising me that they actually work like I wanted (Also by harassing thefiremind for information :p). We all learn differently but me personally I always learn better by doing things on my own and seeing the results myself.
User avatar
NEMESiS
 
Posts: 460
Joined: 03 Jan 2013, 04:02
Location: Pools of Becoming
Has thanked: 70 times
Been thanked: 21 times

Re: Could I ask a question, please?

Postby RiiakShiNal » 14 Feb 2013, 02:24

Doing things on your own and testing things out generally is the best way to learn because then you can see the results and if there is a problem usually you can either find the problem yourself or you have something real to use and reference when asking for help.
RiiakShiNal
Programmer
 
Posts: 2188
Joined: 16 May 2011, 21:37
Has thanked: 75 times
Been thanked: 497 times

Re: Could I ask a question, please?

Postby Takhen » 15 Feb 2013, 01:27

I like to ask before to try because too many fails could make me dissatisfied and little incentive to continue.
However, motivated by what firemind said (a user with my skills may be able to achieve something), I also tried and this is my dysfunctional Mycoloth:

Code: Select all
<?xml version='1.0' encoding='UTF-8'?>

<CARD_V2>
  <FILENAME text="MYCOLOTH_271161" />
  <CARDNAME text="MYCOLOTH" />

  <ARTID value="MYCOLOTH_271161" />
  <ARTIST name="Raymond Swanland" />

  <TYPE metaname="Creature" />
  <SUB_TYPE metaname="Fungus" order_de-DE="0" order_es-ES="0" order_fr-FR="0" order_it-IT="0" order_jp-JA="0" order_ko-KR="0" order_pt-BR="0" order_ru-RU="0" />

  <CASTING_COST cost="{G}" />
  <POWER value="4" />
  <TOUGHNESS value="4" />

  <MULTIVERSEID value="271161" />
  <EXPANSION value="DPE" />
  <RARITY metaname="R" />

  <TITLE>
    <LOCALISED_TEXT LanguageCode="en-US"><![CDATA[Mycoloth]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="de-DE"><![CDATA[Mykoloth]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="es-ES"><![CDATA[Micolot]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="fr-FR"><![CDATA[Mycoloth]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="it-IT"><![CDATA[Fungoloth]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="jp-JA"><![CDATA[マイコロス]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="ko-KR"><![CDATA[Mycoloth]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="ru-RU"><![CDATA[Mycoloth]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="pt-BR"><![CDATA[Mycoloth]]></LOCALISED_TEXT>
  </TITLE>

  <TRIGGERED_ABILITY replacement_query="1" filter_zone="ZONE_IN_PLAY" active_zone="ZONE_TRANSITION">
    <LOCALISED_TEXT LanguageCode="en-US"><![CDATA[Devour 2 (As this enters the battlefield, you may sacrifice any number of creatures. This creature enters the battlefield with twice that many +1/+1 counters on it.)]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="de-DE"><![CDATA[Verschlingen 2 (Sowie diese Karte ins Spiel kommt, kannst du eine beliebige Anzahl an Kreaturen opfern. Diese Kreatur kommt mit doppelt so vielen +1/+1-Marken ins Spiel.)]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="es-ES"><![CDATA[Devorar 2. (En cuanto esto entra al campo de batalla puedes sacrificar cualquier cantidad de criaturas. Esta criatura entra al campo de batalla con el doble esa cantidad de contadores +1/+1 sobre ella.)]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="fr-FR"><![CDATA[Dévorement 2 (Au moment où cette créature arrive sur le champ de bataille, vous pouvez sacrifier le nombre de créatures de votre choix. Cette créature arrive sur le champ de bataille avec deux fois ce nombre de marqueurs +1/+1 sur elle.)]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="it-IT"><![CDATA[Divorare 2 (Mentre questa creatura entra nel campo di battaglia, puoi sacrificare un qualsiasi numero di creature. Entra nel campo di battaglia con il doppio di segnalini +1/+1.)]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="jp-JA"><![CDATA[貪食 2 (これが戦場に出るに際し、あなたは望む数のクリーチャーを生け贄に捧げてもよい。 このクリーチャーは、その数に等しい数の2倍に等しい+1/+1カウンターが置かれた状態で戦場に出る。)]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="ko-KR"><![CDATA[Devour 2 (As this enters the battlefield, you may sacrifice any number of creatures. This creature enters the battlefield with twice that many +1/+1 counters on it.)]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="ru-RU"><![CDATA[Devour 2 (As this enters the battlefield, you may sacrifice any number of creatures. This creature enters the battlefield with twice that many +1/+1 counters on it.)]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="pt-BR"><![CDATA[Devour 2 (As this enters the battlefield, you may sacrifice any number of creatures. This creature enters the battlefield with twice that many +1/+1 counters on it.)]]></LOCALISED_TEXT>
    <TRIGGER value="ZONECHANGE_TRANSITION" simple_qualifier="self" to_zone="ZONE_IN_PLAY" />
    <TARGET_DEFINITION id="0">
    local filter = Object():GetFilter()
    filter:Clear()
    filter:AddCardType( CARD_TYPE_CREATURE )
    filter:SetPlayer( EffectController() )
    filter:May()
    filter:SetZone( ZONE_IN_PLAY )
    filter:SetHint( HINT_ENEMY, EffectController() )
    filter:AIMay()
    filter:IgnoreIfChangingZone()
    </TARGET_DEFINITION>
    <TARGET_DETERMINATION>
    return AtLeastOneTargetFromDefinition(0)
    </TARGET_DETERMINATION>
    <PLAY_TIME_ACTION>
    local filter = Object():LoadTargetDefinition(0)
    local max_victims = filter:Count()
    local player = EffectController()
          
    if max_victims &gt; 0 then
       player:SetTargetCount(max_victims)
       for i=0,max_victims-1 do
          player:SetTargetPrompt( i, "CARD_QUERY_CHOOSE_CREATURE_TO_DEVOUR_2" )
       end 
       player:ChooseTargets( 0, EffectDC():Make_Targets(0) )
    end
    </PLAY_TIME_ACTION>
    <RESOLUTION_TIME_ACTION>


       
    MTG():CreateDelayedTrigger(1, delayDC)
    </RESOLUTION_TIME_ACTION>
    <RESOLUTION_TIME_ACTION>
    local filter = Object():LoadTargetDefinition(0)
    local max_victims = filter:Count()
    local player = EffectController()
    local devour_count = 0
          
    for i=0,max_victims-1 do
       local victim = EffectDC():Get_Targets(0):Get_CardPtr(i)
       if victim ~= nil then
          player:Sacrifice(victim)
          devour_count = devour_count + 2
       end
    end
          
    if EffectSource() ~= nil then
       EffectSource():AddCounters( MTG():PlusOnePlusOneCounters(), devour_count )
    end
    </RESOLUTION_TIME_ACTION>
  </TRIGGERED_ABILITY>

  <TRIGGERED_ABILITY auto_skip="1" filter_zone="ZONE_IN_PLAY">
    <LOCALISED_TEXT LanguageCode="en-US"><![CDATA[At the beginning of your upkeep, put a 1/1 green Saproling creature token onto the battlefield for each +1/+1 counter on Mycoloth.]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="de-DE"><![CDATA[Bringe zu Beginn deines Versorgungssegments für jede +1/+1-Marke auf dem Mykoloth einen 1/1 grünen Saproling-Kreaturenspielstein ins Spiel.]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="es-ES"><![CDATA[Al comienzo de tu mantenimiento, pon en el campo de batalla una ficha de criatura Saprolín verde 1/1 por cada contador +1/+1 sobre el Micolot.]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="fr-FR"><![CDATA[Au début de votre entretien, mettez sur le champ de bataille un jeton de créature 1/1 verte Saprobionte pour chaque marqueur +1/+1 sur le Mycoloth.]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="it-IT"><![CDATA[All'inizio del tuo mantenimento, metti sul campo di battaglia una pedina creatura Saprolingio 1/1 verde per ogni segnalino +1/+1 sul Fungoloth.]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="jp-JA"><![CDATA[あなたのアップキープの開始時に、マイコロスの上に置かれている+1/+1カウンター1個につき、緑の1/1の苗木・クリーチャー・トークンを1体戦場に出す。]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="ko-KR"><![CDATA[At the beginning of your upkeep, put a 1/1 green Saproling creature token onto the battlefield for each +1/+1 counter on Mycoloth.]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="ru-RU"><![CDATA[At the beginning of your upkeep, put a 1/1 green Saproling creature token onto the battlefield for each +1/+1 counter on Mycoloth.]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="pt-BR"><![CDATA[At the beginning of your upkeep, put a 1/1 green Saproling creature token onto the battlefield for each +1/+1 counter on Mycoloth.]]></LOCALISED_TEXT>
    <TRIGGER value="BEGINNING_OF_STEP" simple_qualifier="controller">
    return ( EffectController():MyTurn() ~= 0 ) and ( MTG():GetStep() == STEP_UPKEEP )
    </TRIGGER>
    <RESOLUTION_TIME_ACTION>
    local token_count = devour_count
    if token_count &gt; 0 then
       MTG():PutTokensIntoPlay( "TOKEN_SAPROLING_1_1_277461", token_count, EffectController() )
    end
    </RESOLUTION_TIME_ACTION>
  </TRIGGERED_ABILITY>
  <TOKEN_REGISTRATION reservation="1" type="TOKEN_SAPROLING_1_1_277461" />

  <HELP title="MORE_INFO_TITLE_DEVOUR" body="MORE_INFO_BODY_DEVOUR" zone="ZONE_ANY" />
  <SFX text="COMBAT_DRAGON_LARGE_ATTACK" power_boundary_min="4" power_boundary_max="-1" />
  <SFX text="COMBAT_DRAGON_SMALL_ATTACK" power_boundary_min="1" power_boundary_max="3" />
  <AI_BASE_SCORE score="1200" zone="ZONE_HAND" />
</CARD_V2>
It works with Devour 2, with my great surprise because everything seemed much more complicated than the part that doesn't work.
I copied Devour from Voracious Dragon, so I deleted all I found about the specific goblin type, then I moved "+1" to "+2"...
It worked with very poor changes for a so long text part...
I am doubtful about the fact that I changed something in this text to see if I could have some difference, but it worked with no errors, no difference...

However, about the not working piece.
I changed the token type, so it is ok.
Then I take the time for the trigged ability from Roaring Primadox, and this should be ok too.

The problem is about the number of tokens.
I take the Token's code from Dragonlair Spider, and standard number of token is 1 that I can simply change in to 99 to feel COOL.
But when I tried, with more attempts, to change "local token_count" = the number of devour counters (it would be a bug because if I add with another card some +1/+1 on Mycoloth, they adds to the effect, but better start easy...) I have no tokens.

I changed more times, but nothig.
So I had a final, and failed, thought: maybe in this piece
Code: Select all
    for i=0,max_victims-1 do
       local victim = EffectDC():Get_Targets(0):Get_CardPtr(i)
       if victim ~= nil then
          player:Sacrifice(victim)
          devour_count = devour_count + 2
       end
    end
          
The "end" closes the role of "devour_count" as a "nNunCounters", so if I use it as I pasted: after the "end", "devour_count" doesn't mean anything more

But if I add a "devour_count = nNumCounters", thinking "I want to save in nNumCounters that number of devour_count that I will lose after the END", Devour works no more

I am very annoyed to understand than a maximum 10% of the code, so feeling very weak from the point of view of what I can try to change and what is best not to move at all.
So if the first card of the part runs, probably there is something of useless I didn't understand so I didn't delete, or something that could be better...

I've also had a look at a tutorial about LUA, although I can not find a way to test small pieces of code that are not functional for the game, for example a simple colored text just to see if I understand the grammar

This is the best I found still now, because altrough it refers to the Play Station Portable, at least explains what parentheses and commas trying to make some small example.

http://rinnegatamante.altervista.org/LUA1.html
http://rinnegatamante.altervista.org/LUA2.html
http://rinnegatamante.altervista.org/LUA3.html
http://rinnegatamante.altervista.org/LUA4.html
http://rinnegatamante.altervista.org/LUA5.html

Although it must be said that 5 pages are too little to learn something...
but as a beginner tutorials about LUA is one of the best I've found, just imagine...
User avatar
Takhen
 
Posts: 235
Joined: 04 Feb 2013, 19:35
Has thanked: 0 time
Been thanked: 0 time

Re: Could I ask a question, please?

Postby RiiakShiNal » 15 Feb 2013, 04:01

Takhen wrote:I like to ask before to try because too many fails could make me dissatisfied and little incentive to continue.
However, motivated by what firemind said (a user with my skills may be able to achieve something), I also tried and this is my dysfunctional Mycoloth:

Code: Select all
<?xml version='1.0' encoding='UTF-8'?>

<CARD_V2>
  <FILENAME text="MYCOLOTH_271161" />
  <CARDNAME text="MYCOLOTH" />

  <ARTID value="MYCOLOTH_271161" />
  <ARTIST name="Raymond Swanland" />

  <TYPE metaname="Creature" />
  <SUB_TYPE metaname="Fungus" order_de-DE="0" order_es-ES="0" order_fr-FR="0" order_it-IT="0" order_jp-JA="0" order_ko-KR="0" order_pt-BR="0" order_ru-RU="0" />

  <CASTING_COST cost="{G}" />
  <POWER value="4" />
  <TOUGHNESS value="4" />

  <MULTIVERSEID value="271161" />
  <EXPANSION value="DPE" />
  <RARITY metaname="R" />

  <TITLE>
    <LOCALISED_TEXT LanguageCode="en-US"><![CDATA[Mycoloth]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="de-DE"><![CDATA[Mykoloth]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="es-ES"><![CDATA[Micolot]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="fr-FR"><![CDATA[Mycoloth]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="it-IT"><![CDATA[Fungoloth]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="jp-JA"><![CDATA[マイコロス]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="ko-KR"><![CDATA[Mycoloth]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="ru-RU"><![CDATA[Mycoloth]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="pt-BR"><![CDATA[Mycoloth]]></LOCALISED_TEXT>
  </TITLE>

  <TRIGGERED_ABILITY replacement_query="1" filter_zone="ZONE_IN_PLAY" active_zone="ZONE_TRANSITION">
    <LOCALISED_TEXT LanguageCode="en-US"><![CDATA[Devour 2 (As this enters the battlefield, you may sacrifice any number of creatures. This creature enters the battlefield with twice that many +1/+1 counters on it.)]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="de-DE"><![CDATA[Verschlingen 2 (Sowie diese Karte ins Spiel kommt, kannst du eine beliebige Anzahl an Kreaturen opfern. Diese Kreatur kommt mit doppelt so vielen +1/+1-Marken ins Spiel.)]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="es-ES"><![CDATA[Devorar 2. (En cuanto esto entra al campo de batalla puedes sacrificar cualquier cantidad de criaturas. Esta criatura entra al campo de batalla con el doble esa cantidad de contadores +1/+1 sobre ella.)]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="fr-FR"><![CDATA[Dévorement 2 (Au moment où cette créature arrive sur le champ de bataille, vous pouvez sacrifier le nombre de créatures de votre choix. Cette créature arrive sur le champ de bataille avec deux fois ce nombre de marqueurs +1/+1 sur elle.)]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="it-IT"><![CDATA[Divorare 2 (Mentre questa creatura entra nel campo di battaglia, puoi sacrificare un qualsiasi numero di creature. Entra nel campo di battaglia con il doppio di segnalini +1/+1.)]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="jp-JA"><![CDATA[貪食 2 (これが戦場に出るに際し、あなたは望む数のクリーチャーを生け贄に捧げてもよい。 このクリーチャーは、その数に等しい数の2倍に等しい+1/+1カウンターが置かれた状態で戦場に出る。)]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="ko-KR"><![CDATA[Devour 2 (As this enters the battlefield, you may sacrifice any number of creatures. This creature enters the battlefield with twice that many +1/+1 counters on it.)]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="ru-RU"><![CDATA[Devour 2 (As this enters the battlefield, you may sacrifice any number of creatures. This creature enters the battlefield with twice that many +1/+1 counters on it.)]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="pt-BR"><![CDATA[Devour 2 (As this enters the battlefield, you may sacrifice any number of creatures. This creature enters the battlefield with twice that many +1/+1 counters on it.)]]></LOCALISED_TEXT>
    <TRIGGER value="ZONECHANGE_TRANSITION" simple_qualifier="self" to_zone="ZONE_IN_PLAY" />
    <TARGET_DEFINITION id="0">
    local filter = Object():GetFilter()
    filter:Clear()
    filter:AddCardType( CARD_TYPE_CREATURE )
    filter:SetPlayer( EffectController() )
    filter:May()
    filter:SetZone( ZONE_IN_PLAY )
    filter:SetHint( HINT_ENEMY, EffectController() )
    filter:AIMay()
    filter:IgnoreIfChangingZone()
    </TARGET_DEFINITION>
    <TARGET_DETERMINATION>
    return AtLeastOneTargetFromDefinition(0)
    </TARGET_DETERMINATION>
    <PLAY_TIME_ACTION>
    local filter = Object():LoadTargetDefinition(0)
    local max_victims = filter:Count()
    local player = EffectController()
          
    if max_victims &gt; 0 then
       player:SetTargetCount(max_victims)
       for i=0,max_victims-1 do
          player:SetTargetPrompt( i, "CARD_QUERY_CHOOSE_CREATURE_TO_DEVOUR_2" )
       end 
       player:ChooseTargets( 0, EffectDC():Make_Targets(0) )
    end
    </PLAY_TIME_ACTION>
    <RESOLUTION_TIME_ACTION>


       
    MTG():CreateDelayedTrigger(1, delayDC)
    </RESOLUTION_TIME_ACTION>
    <RESOLUTION_TIME_ACTION>
    local filter = Object():LoadTargetDefinition(0)
    local max_victims = filter:Count()
    local player = EffectController()
    local devour_count = 0
          
    for i=0,max_victims-1 do
       local victim = EffectDC():Get_Targets(0):Get_CardPtr(i)
       if victim ~= nil then
          player:Sacrifice(victim)
          devour_count = devour_count + 2
       end
    end
          
    if EffectSource() ~= nil then
       EffectSource():AddCounters( MTG():PlusOnePlusOneCounters(), devour_count )
    end
    </RESOLUTION_TIME_ACTION>
  </TRIGGERED_ABILITY>

  <TRIGGERED_ABILITY auto_skip="1" filter_zone="ZONE_IN_PLAY">
    <LOCALISED_TEXT LanguageCode="en-US"><![CDATA[At the beginning of your upkeep, put a 1/1 green Saproling creature token onto the battlefield for each +1/+1 counter on Mycoloth.]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="de-DE"><![CDATA[Bringe zu Beginn deines Versorgungssegments für jede +1/+1-Marke auf dem Mykoloth einen 1/1 grünen Saproling-Kreaturenspielstein ins Spiel.]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="es-ES"><![CDATA[Al comienzo de tu mantenimiento, pon en el campo de batalla una ficha de criatura Saprolín verde 1/1 por cada contador +1/+1 sobre el Micolot.]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="fr-FR"><![CDATA[Au début de votre entretien, mettez sur le champ de bataille un jeton de créature 1/1 verte Saprobionte pour chaque marqueur +1/+1 sur le Mycoloth.]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="it-IT"><![CDATA[All'inizio del tuo mantenimento, metti sul campo di battaglia una pedina creatura Saprolingio 1/1 verde per ogni segnalino +1/+1 sul Fungoloth.]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="jp-JA"><![CDATA[あなたのアップキープの開始時に、マイコロスの上に置かれている+1/+1カウンター1個につき、緑の1/1の苗木・クリーチャー・トークンを1体戦場に出す。]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="ko-KR"><![CDATA[At the beginning of your upkeep, put a 1/1 green Saproling creature token onto the battlefield for each +1/+1 counter on Mycoloth.]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="ru-RU"><![CDATA[At the beginning of your upkeep, put a 1/1 green Saproling creature token onto the battlefield for each +1/+1 counter on Mycoloth.]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="pt-BR"><![CDATA[At the beginning of your upkeep, put a 1/1 green Saproling creature token onto the battlefield for each +1/+1 counter on Mycoloth.]]></LOCALISED_TEXT>
    <TRIGGER value="BEGINNING_OF_STEP" simple_qualifier="controller">
    return ( EffectController():MyTurn() ~= 0 ) and ( MTG():GetStep() == STEP_UPKEEP )
    </TRIGGER>
    <RESOLUTION_TIME_ACTION>
    local token_count = devour_count
    if token_count &gt; 0 then
       MTG():PutTokensIntoPlay( "TOKEN_SAPROLING_1_1_277461", token_count, EffectController() )
    end
    </RESOLUTION_TIME_ACTION>
  </TRIGGERED_ABILITY>
  <TOKEN_REGISTRATION reservation="1" type="TOKEN_SAPROLING_1_1_277461" />

  <HELP title="MORE_INFO_TITLE_DEVOUR" body="MORE_INFO_BODY_DEVOUR" zone="ZONE_ANY" />
  <SFX text="COMBAT_DRAGON_LARGE_ATTACK" power_boundary_min="4" power_boundary_max="-1" />
  <SFX text="COMBAT_DRAGON_SMALL_ATTACK" power_boundary_min="1" power_boundary_max="3" />
  <AI_BASE_SCORE score="1200" zone="ZONE_HAND" />
</CARD_V2>
It works with Devour 2, with my great surprise because everything seemed much more complicated than the part that doesn't work.
I copied Devour from Voracious Dragon, so I deleted all I found about the specific goblin type, then I moved "+1" to "+2"...
It worked with very poor changes for a so long text part...
I am doubtful about the fact that I changed something in this text to see if I could have some difference, but it worked with no errors, no difference...

However, about the not working piece.
I changed the token type, so it is ok.
Then I take the time for the trigged ability from Roaring Primadox, and this should be ok too.

The problem is about the number of tokens.
I take the Token's code from Dragonlair Spider, and standard number of token is 1 that I can simply change in to 99 to feel COOL.
But when I tried, with more attempts, to change "local token_count" = the number of devour counters (it would be a bug because if I add with another card some +1/+1 on Mycoloth, they adds to the effect, but better start easy...) I have no tokens.
The problem with the second ability on your posted code is that you are trying to use devour_count which is "local" to the particular RESOLUTION_TIME_ACTION in the first ability. Local variables only exist within their particular scope. So in the second ability you actually need to count how many tokens are on the card (for this you can use part of the code I provided earlier).

So your token_count line will become this:
Code: Select all
    local token_count = Object():CountCounters( MTG():PlusOnePlusOneCounters() )
The rest of the code for the second ability looks fine.
RiiakShiNal
Programmer
 
Posts: 2188
Joined: 16 May 2011, 21:37
Has thanked: 75 times
Been thanked: 497 times

Re: Could I ask a question, please?

Postby Takhen » 15 Feb 2013, 15:40

I tried "local token_count = PlusOnePlusOneCounters", so I would solve also the problem of add to the count each +1/+1 and not only those that comes from devour, but I didn't think about the line you wrote because I didn't understand why number of token is equal to a function and not a single number
Sorry if you wrote it before :lol:

All the other is fine?
No useless parts, no some logical problem or bug, or some support as the HELP TEXT or near?

Also about this I copied without knowing and I didn't find in all the other cards?
Code: Select all
  <AI_BASE_SCORE score="1200" zone="ZONE_HAND" />
It seems to me so more weird than Akroma that was so clean and clear XD

Beh, if it is I have to try the next :D
I hope I never go away from creatures XD
User avatar
Takhen
 
Posts: 235
Joined: 04 Feb 2013, 19:35
Has thanked: 0 time
Been thanked: 0 time

Re: Could I ask a question, please?

Postby Takhen » 15 Feb 2013, 16:03

PS: I copied the basic text from an app found on this link

http://poc-dotpg.herokuapp.com/?search=mycoloth

but today I can't open the app
Could I save this app on my windows so I could open every time I want as with Localised?
User avatar
Takhen
 
Posts: 235
Joined: 04 Feb 2013, 19:35
Has thanked: 0 time
Been thanked: 0 time

Re: Could I ask a question, please?

Postby Takhen » 15 Feb 2013, 20:00

And instead I went right to sorcery :)

This is Beacon of Creation, and it seems to work!
I post it to confirm if there are any unnecessary pieces, improvements to be made, bug and to share with the forum :)

Code: Select all
<?xml version='1.0' encoding='UTF-8'?>

<CARD_V2>
  <FILENAME text="BEACON_OF_CREATION_51613" />
  <CARDNAME text="BEACON_OF_CREATION" />

  <ARTID value="BEACON_OF_CREATION_51613" />
  <ARTIST name="Mark Tedin" />

  <TYPE metaname="Sorcery" />
  <CASTING_COST cost="{3}{G}" />
  <MULTIVERSEID value="51613" />
  <EXPANSION value="DPE" />
  <RARITY metaname="R" />

  <TITLE>
    <LOCALISED_TEXT LanguageCode="en-US"><![CDATA[Beacon of Creation]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="de-DE"><![CDATA[Leitstern der Schöpfung]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="es-ES"><![CDATA[Faro de creación]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="fr-FR"><![CDATA[Flambeau de la Création]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="it-IT"><![CDATA[Faro della Creazione]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="jp-JA"><![CDATA[創造の標]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="ko-KR"><![CDATA[Beacon of Creation]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="ru-RU"><![CDATA[Beacon of Creation]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="pt-BR"><![CDATA[Guia da Criação]]></LOCALISED_TEXT>
  </TITLE>

  <FLAVOURTEXT>
    <LOCALISED_TEXT LanguageCode="en-US"><![CDATA[A chorus of life heralds the arrival of Mirrodin's final sun.]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="de-DE"><![CDATA[Ein vielstimmiger Chor des Lebens verkündet die Ankunft von Mirrodins fehlender Sonne.]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="es-ES"><![CDATA[Un coro de vida anuncia el arribo del último sol de Mirrodin.]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="fr-FR"><![CDATA[Une véritable explosion de vie annonce l'arrivée du dernier soleil de Mirrodin.]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="it-IT"><![CDATA[Un coro di vita annuncia l'arrivo dell'ultimo sole di Mirrodin.]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="jp-JA"><![CDATA[生命の歌声が、ミラディン最後の太陽誕生の先触れとなる。]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="ko-KR"><![CDATA[A chorus of life heralds the arrival of Mirrodin's final sun.]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="ru-RU"><![CDATA[A chorus of life heralds the arrival of Mirrodin's final sun.]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="pt-BR"><![CDATA[Um coro de vida anuncia a chegada do último sol de Mirrodin.]]></LOCALISED_TEXT>
  </FLAVOURTEXT>

  <SPELL_ABILITY>
    <LOCALISED_TEXT LanguageCode="en-US"><![CDATA[Put a 1/1 green Insect creature token onto the battlefield for each Forest you control. Shuffle Beacon of Creation into its owner's library.]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="de-DE"><![CDATA[Bringe für jeden Wald, den du kontrollierst, einen 1/1 grünen Insektenspielstein ins Spiel. Mische den Leitstern der Schöpfung in die Bibliothek seines Besitzers.]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="es-ES"><![CDATA[Pon en juego una ficha de criatura Insecto verde 1/1 por cada bosque que controles. Baraja el Faro de creación en la biblioteca de su propietario.]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="fr-FR"><![CDATA[Mettez en jeu un jeton de créature 1/1 verte Insecte pour chaque forêt que vous contrôlez. Mélangez le Flambeau de la Création à la bibliothèque de son propriétaire.]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="it-IT"><![CDATA[Metti in gioco una pedina creatura Insetto 1/1 verde per ogni Foresta che controlli.Rimescola il Faro della Creazione nel grimorio del suo proprietario.]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="jp-JA"><![CDATA[緑の1/1の昆虫クリーチャー・トークンを、あなたがコントロールしている森1つにつき1個場に出す。創造の標をオーナーのライブラリーに加えて切り直す。]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="ko-KR"><![CDATA[Put a 1/1 green Insect creature token onto the battlefield for each Forest you control. Shuffle Beacon of Creation into its owner's library.]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="ru-RU"><![CDATA[Put a 1/1 green Insect creature token onto the battlefield for each Forest you control. Shuffle Beacon of Creation into its owner's library.]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="pt-BR"><![CDATA[Coloque em jogo uma ficha de criatura verde 1/1 do tipo Inseto para cada Floresta que você controla. Embaralhe Guia da Criação no grimório de seu dono.]]></LOCALISED_TEXT>
    <RESOLUTION_TIME_ACTION>

    local total = 0 
    local filter = Object():GetFilter() 
    filter:Clear() 
    filter:SetZone( ZONE_IN_PLAY ) 
    filter:AddSubType( LAND_TYPE_FOREST ) 
    filter:SetController( EffectController() ) 
    filter:NotTargetted() 
    total = filter:Count()

    local token_count = filter:Count()
    if token_count &gt; 0 then
       MTG():PutTokensIntoPlay( "TOKEN_INSECT_1_1_277471", token_count, EffectController() )
    end
    </RESOLUTION_TIME_ACTION>
    <RESOLUTION_TIME_ACTION>
    Object():SetResolutionZone(ZONE_LIBRARY)
    </RESOLUTION_TIME_ACTION>


    <SFX text="TARGET_LIGHTNING_PLAY" />
  </SPELL_ABILITY>


  <TOKEN_REGISTRATION reservation="1" type="TOKEN_INSECT_1_1_277471" />
  <AI_BASE_SCORE score="1200" zone="ZONE_HAND" />
</CARD_V2>
I admit I don't know what are these and if they make bugs:
Code: Select all
    <SFX text="TARGET_LIGHTNING_PLAY" />
Code: Select all
  <TOKEN_REGISTRATION reservation="1" type="TOKEN_INSECT_1_1_277471" />
Code: Select all
  <AI_BASE_SCORE score="1200" zone="ZONE_HAND" />
To do this I used Beacon of Immortality for the deck-return effect
Call to Mind to see if a sorcery need some particular line of code (it seems only instant and enchantment need)
Mycoloth to add tokens
Dungrove Elder to have the filter of the number of forests:
I can not believe that it works, I have to be very lucky HAHAHAHAHAAHHAHAHAHAH :lol:

Maybe some hope of learn with practice could be :)
Hoping that I can also give you a little support :)
User avatar
Takhen
 
Posts: 235
Joined: 04 Feb 2013, 19:35
Has thanked: 0 time
Been thanked: 0 time

Re: Could I ask a question, please?

Postby thefiremind » 15 Feb 2013, 21:40

Good work, the code is OK!

Takhen wrote:I admit I don't know what are these and if they make bugs:
Code: Select all
    <SFX text="TARGET_LIGHTNING_PLAY" />
Code: Select all
  <TOKEN_REGISTRATION reservation="1" type="TOKEN_INSECT_1_1_277471" />
Code: Select all
  <AI_BASE_SCORE score="1200" zone="ZONE_HAND" />
The SFX block sets an animation for the spell. Usually, the animation names that start with TARGET_ are made for pointing the animation to the spell target (see Shock for example, which bursts the lightning against its target): if you don't have targets and you use an animation that requires one, you'll see the animation pointing out of the battlefield to the right. Animation names that start with GLOBAL_ cover the whole battlefield and are made for spells that affect multiple cards/players. If you remember a card that does an animation that you want to replicate on a custom card, open that card and copy the SFX block. Note that you have to include the block inside the ability that you want to animate (a SPELL_ABILITY, ACTIVATED_ABILITY or TRIGGERED_ABILITY).

The TOKEN_REGISTRATION is needed everytime a card makes tokens. To be honest I don't know the exact purpose of it, but if you forget to include it, the game will probably crash when you end the duel, so I guess it frees the memory used by the tokens or something like that. If you produce multiple types of tokens with just one card, it will need one TOKEN_REGISTRATION for each type. The reservation has no importance in DotP2013 as far as I know: all cards have that tag set to "1", so just do the same.

The AI_BASE_SCORE adds a score that influences how much the AI gives importance to the card when it is in a certain zone. A high score on ZONE_IN_PLAY will make that permanent important so that the AI will more likely try to remove it if it's yours or protect it if it's his. A high score on ZONE_HAND will make that card important so that the AI will be more inclined to play it, or to make you discard it with cards like Duress. If you look at the official cards, a score on ZONE_HAND is given to instants, sorceries and permanents that have an enter-the-battlefield effect, while a score on ZONE_IN_PLAY is given to permanents that have important abilities when on the battlefield. Some things are already taken care by the AI so you don't have to count them for the AI_BASE_SCORE, these include the most common static abilities (flying, trample, etc.), power and toughness, and other things I can't remember right now.
< 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

Re: Could I ask a question, please?

Postby RiiakShiNal » 15 Feb 2013, 21:47

Takhen wrote:I tried "local token_count = PlusOnePlusOneCounters", so I would solve also the problem of add to the count each +1/+1 and not only those that comes from devour, but I didn't think about the line you wrote because I didn't understand why number of token is equal to a function and not a single number
Sorry if you wrote it before :lol:
Well simply having the "token_count = PlusOnePlusOneCounters" won't work because PlusOnePlusOneCounters without the MTG() object is undefined and even then you are missing the parenthesis. Also that function returns a string not a number. The line I gave uses the CountCounters() function on the card object which actually counts how many of a specified type of counter are currently on that card (even if some counters were added later).

Takhen wrote:All the other is fine?
No useless parts, no some logical problem or bug, or some support as the HELP TEXT or near?

Also about this I copied without knowing and I didn't find in all the other cards?
Code: Select all
  <AI_BASE_SCORE score="1200" zone="ZONE_HAND" />
It seems to me so more weird than Akroma that was so clean and clear XD

Beh, if it is I have to try the next :D
I hope I never go away from creatures XD
The rest of the code seemed fine to me, at the very least I didn't notice any glaring errors. As for bugs we can't always find bugs simply by looking over the code and even code from experienced people on this forum is not always bug free. If we find a bug we find a way to squash it and hopefully not make the same mistake elsewhere.

As for the AI_BASE_SCORE tag that simply gives a "value" to the card so the AI can rate whether it would be a good thing to play or get rid of the card depending on who is using it. Higher values make the card more valuable and will make the AI prioritize it, but as for what each card's value should be is quite subjective so it's generally up to the coder as to how valuable the card should be in the eyes of the AI.

Takhen wrote:And instead I went right to sorcery :)

This is Beacon of Creation, and it seems to work!
I post it to confirm if there are any unnecessary pieces, improvements to be made, bug and to share with the forum :)

Code: Select all
<?xml version='1.0' encoding='UTF-8'?>

<CARD_V2>
  <FILENAME text="BEACON_OF_CREATION_51613" />
  <CARDNAME text="BEACON_OF_CREATION" />

  <ARTID value="BEACON_OF_CREATION_51613" />
  <ARTIST name="Mark Tedin" />

  <TYPE metaname="Sorcery" />
  <CASTING_COST cost="{3}{G}" />
  <MULTIVERSEID value="51613" />
  <EXPANSION value="DPE" />
  <RARITY metaname="R" />

  <TITLE>
    <LOCALISED_TEXT LanguageCode="en-US"><![CDATA[Beacon of Creation]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="de-DE"><![CDATA[Leitstern der Schöpfung]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="es-ES"><![CDATA[Faro de creación]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="fr-FR"><![CDATA[Flambeau de la Création]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="it-IT"><![CDATA[Faro della Creazione]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="jp-JA"><![CDATA[創造の標]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="ko-KR"><![CDATA[Beacon of Creation]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="ru-RU"><![CDATA[Beacon of Creation]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="pt-BR"><![CDATA[Guia da Criação]]></LOCALISED_TEXT>
  </TITLE>

  <FLAVOURTEXT>
    <LOCALISED_TEXT LanguageCode="en-US"><![CDATA[A chorus of life heralds the arrival of Mirrodin's final sun.]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="de-DE"><![CDATA[Ein vielstimmiger Chor des Lebens verkündet die Ankunft von Mirrodins fehlender Sonne.]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="es-ES"><![CDATA[Un coro de vida anuncia el arribo del último sol de Mirrodin.]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="fr-FR"><![CDATA[Une véritable explosion de vie annonce l'arrivée du dernier soleil de Mirrodin.]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="it-IT"><![CDATA[Un coro di vita annuncia l'arrivo dell'ultimo sole di Mirrodin.]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="jp-JA"><![CDATA[生命の歌声が、ミラディン最後の太陽誕生の先触れとなる。]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="ko-KR"><![CDATA[A chorus of life heralds the arrival of Mirrodin's final sun.]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="ru-RU"><![CDATA[A chorus of life heralds the arrival of Mirrodin's final sun.]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="pt-BR"><![CDATA[Um coro de vida anuncia a chegada do último sol de Mirrodin.]]></LOCALISED_TEXT>
  </FLAVOURTEXT>

  <SPELL_ABILITY>
    <LOCALISED_TEXT LanguageCode="en-US"><![CDATA[Put a 1/1 green Insect creature token onto the battlefield for each Forest you control. Shuffle Beacon of Creation into its owner's library.]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="de-DE"><![CDATA[Bringe für jeden Wald, den du kontrollierst, einen 1/1 grünen Insektenspielstein ins Spiel. Mische den Leitstern der Schöpfung in die Bibliothek seines Besitzers.]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="es-ES"><![CDATA[Pon en juego una ficha de criatura Insecto verde 1/1 por cada bosque que controles. Baraja el Faro de creación en la biblioteca de su propietario.]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="fr-FR"><![CDATA[Mettez en jeu un jeton de créature 1/1 verte Insecte pour chaque forêt que vous contrôlez. Mélangez le Flambeau de la Création à la bibliothèque de son propriétaire.]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="it-IT"><![CDATA[Metti in gioco una pedina creatura Insetto 1/1 verde per ogni Foresta che controlli.Rimescola il Faro della Creazione nel grimorio del suo proprietario.]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="jp-JA"><![CDATA[緑の1/1の昆虫クリーチャー・トークンを、あなたがコントロールしている森1つにつき1個場に出す。創造の標をオーナーのライブラリーに加えて切り直す。]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="ko-KR"><![CDATA[Put a 1/1 green Insect creature token onto the battlefield for each Forest you control. Shuffle Beacon of Creation into its owner's library.]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="ru-RU"><![CDATA[Put a 1/1 green Insect creature token onto the battlefield for each Forest you control. Shuffle Beacon of Creation into its owner's library.]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="pt-BR"><![CDATA[Coloque em jogo uma ficha de criatura verde 1/1 do tipo Inseto para cada Floresta que você controla. Embaralhe Guia da Criação no grimório de seu dono.]]></LOCALISED_TEXT>
    <RESOLUTION_TIME_ACTION>

    local total = 0 
    local filter = Object():GetFilter() 
    filter:Clear() 
    filter:SetZone( ZONE_IN_PLAY ) 
    filter:AddSubType( LAND_TYPE_FOREST ) 
    filter:SetController( EffectController() ) 
    filter:NotTargetted() 
    total = filter:Count()

    local token_count = filter:Count()
    if token_count &gt; 0 then
       MTG():PutTokensIntoPlay( "TOKEN_INSECT_1_1_277471", token_count, EffectController() )
    end
    </RESOLUTION_TIME_ACTION>
    <RESOLUTION_TIME_ACTION>
    Object():SetResolutionZone(ZONE_LIBRARY)
    </RESOLUTION_TIME_ACTION>


    <SFX text="TARGET_LIGHTNING_PLAY" />
  </SPELL_ABILITY>


  <TOKEN_REGISTRATION reservation="1" type="TOKEN_INSECT_1_1_277471" />
  <AI_BASE_SCORE score="1200" zone="ZONE_HAND" />
</CARD_V2>
In this piece of code you do have something that is a bit useless/redundant:
Code: Select all
    local total = 0 
    local filter = Object():GetFilter() 
    filter:Clear() 
    filter:SetZone( ZONE_IN_PLAY ) 
    filter:AddSubType( LAND_TYPE_FOREST ) 
    filter:SetController( EffectController() ) 
    filter:NotTargetted() 
    total = filter:Count()

    local token_count = filter:Count()
    if token_count &gt; 0 then
       MTG():PutTokensIntoPlay( "TOKEN_INSECT_1_1_277471", token_count, EffectController() )
    end
Looking at the code you define total, set it to 0, then assign it the count of how many forests then just throw it away (because you don't use it afterwards). As for the count of the lands you are storing that into token_count on the next code line so you really don't need "total" to begin with. I would recommend if you are not going to use "total" to simply remove it so that the code looks like this:
Code: Select all
    local filter = Object():GetFilter()
    filter:Clear()
    filter:SetZone( ZONE_IN_PLAY )
    filter:AddSubType( LAND_TYPE_FOREST )
    filter:SetController( EffectController() )
    filter:NotTargetted()

    local token_count = filter:Count()
    if token_count &gt; 0 then
       MTG():PutTokensIntoPlay( "TOKEN_INSECT_1_1_277471", token_count, EffectController() )
    end
Leaving it in won't cause problems, but it is more efficient to remove the useless lines.

Takhen wrote:I admit I don't know what are these and if they make bugs:
Code: Select all
    <SFX text="TARGET_LIGHTNING_PLAY" />
Code: Select all
  <TOKEN_REGISTRATION reservation="1" type="TOKEN_INSECT_1_1_277471" />
Code: Select all
  <AI_BASE_SCORE score="1200" zone="ZONE_HAND" />
To do this I used Beacon of Immortality for the deck-return effect
Call to Mind to see if a sorcery need some particular line of code (it seems only instant and enchantment need)
Mycoloth to add tokens
Dungrove Elder to have the filter of the number of forests:
I can not believe that it works, I have to be very lucky HAHAHAHAHAAHHAHAHAHAH :lol:

Maybe some hope of learn with practice could be :)
Hoping that I can also give you a little support :)
SFX = Special Effects. It is used to determine what pretty animations the play when the ability is used.

TOKEN_REGISTRATION is used to have the engine load card information for a card that is not necessarily in the deck. It is basically required when making cards that create tokens because otherwise the definition for the token won't be loaded and the token can't be created because there is no definition. Though there is one instance where this is not true and that is tokens creating tokens, in that case putting a TOKEN_REGISTRATION in the token definition will crash the engine. If the token is creating a token different from itself (other than simply copying cards) then that other token must be registered on the card that created the original token. If the token is simply creating more tokens like itself then the TOKEN_REGISTRATION is not needed as it was already done on the card that created the original token.

AI_BASE_SCORE is used as I stated earlier in my post to give the card a value in the eyes of the AI. Though some cards simply don't need it because the AI can figure out the value of the abilities on its own for simple abilities like deathtouch, lifelink, trample, and similar.
RiiakShiNal
Programmer
 
Posts: 2188
Joined: 16 May 2011, 21:37
Has thanked: 75 times
Been thanked: 497 times

PreviousNext

Return to Magic: The Gathering - Duels of the Planeswalkers

Who is online

Users browsing this forum: No registered users and 12 guests


Who is online

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

Login Form