It is currently 27 Apr 2024, 14:25
   
Text Size

General XML/LUA Editing Findings

Moderator: CCGHQ Admins

Re: General XML/LUA Editing Findings

Postby Epiphany » 07 Jul 2010, 06:34

Returning back to my earlier post where I mentioned that I was trying to make Hermetic Study.

This is the code I had:

Code: Select all
    <STATIC_ABILITY layer="0" tag="HERMETIC_STUDY_RULE_1">
      <TARGET_DETERMINATION>
        return TargetCreatureGood()
      </TARGET_DETERMINATION>
      <PLAYTIME>
        ChooseTarget( "ChooseCreatureToGainPing" )
      </PLAYTIME>
      <EFFECT>
        EnchantCreature()
      </EFFECT>
    </STATIC_ABILITY>
    <ACTIVATED_ABILITY tag="HERMETIC_STUDY_RULE_2" unlikely_to_attack="1" layer="7c">
      <COST type="Mana" cost="0" />
      <TARGET_DETERMINATION>
        return TargetCreatureOrPlayerBad()
      </TARGET_DETERMINATION>
      <PLAYTIME>
        ChooseTarget( "ChooseCreatureOrPlayerOneDamage" )
      </PLAYTIME>
      <EFFECT>
        DealDamageToTarget( 1 )
      </EFFECT>
        <AI_PLAY_SCORE>
        if (MTG():GetStep() == STEP_MAIN_2 and Object():GetController():MyTurn() == 0) then
          return (2000)
        else
          if (MTG():GetStep() == STEP_DECLARE_BLOCKERS) then
            return (1000)
          else
            if (MTG():GetStep() == STEP_DECLARE_ATTACKERS) then
              return (500)
            else
              return (0)
            end
          end
        end
      </AI_PLAY_SCORE>
      <AI_AVAILABILITY behaviour="InResponseOrBeforeMyUntap"/>
    </ACTIVATED_ABILITY>
On further testing, I realise the reason why it destroyed itself every time I activated the ability was because I was testing it on players.

If I ping another creature, then the enchantment moves onto whichever creature I've targeted. So I need to work out how to target another creature without changing who is being enchanted. Maybe re-target the parent card once the effect has actioned... not sure really!
Epiphany
 
Posts: 95
Joined: 30 Jun 2010, 13:27
Has thanked: 0 time
Been thanked: 0 time

Re: General XML/LUA Editing Findings

Postby Epiphany » 07 Jul 2010, 11:23

To give you guys a quick update, I'm working my way through Tempest alphabetically and out of the 35 cards that I've tried so far, the cards that I have working are as follows:

Advance Scout
Aftershock
Altar of Dementia
Apocalypse
Auratog
Avenging Angel
Bayou Dragonfly
Benthic Behemoth
Boil
Canopy Spider
Canyon Wildcat
Chill

If you want to see the code for any of them, or even download them, let me know. For now though, I'll save off releasing them until I have made every card from Tempest that I can.
Epiphany
 
Posts: 95
Joined: 30 Jun 2010, 13:27
Has thanked: 0 time
Been thanked: 0 time

Re: General XML/LUA Editing Findings

Postby pun1sher666 » 09 Jul 2010, 14:02

Hi guys,

I'm new on this forum and I started to learn how to edit cards for Dotp.
I'm very impressed about what you already did and all the informations on this forum is very helpfull to understand how it works, even if i still don't understand everything :)
I'm getting started with some simple cards and i try to implement my favorite mono-white deck with many knight inside :)
I got to code the following cards.

White Knight
Silver Knight
Knight of Meadowgrain
Disenchant
Honor of the Pure

I'm trying to code Path to exile but i don't know if it's possible to make the opponent search his library for a basic land...
Here the code i tried but i think it's crappy...

Code: Select all
<?xml version="1.0"?>
<MULTICARDS>

  <CARD>
    <TITLE text="PATH_TO_EXILE_TITLE" />
    <FILENAME text="Path_to_exile" />
    <COLLECTIONMAX value="383" />
    <COLLECTORNUMBER value="122" />
    <ARTID value="301038" />
    <FRAMECOLOUR name="W" />
    <COLOR value="W" />
    <ARTIST name="Todd Lockwood" />
    <CASTING_COST cost="{W}" />
    <CARDNUMBER value="17" />
    <TYPE metaname="Instant" />
    <EXPANSION metaname="A" />
    <RARITY metaname="uncommon" />
    <SPELL_ABILITY tag="PATH_TO_EXILE_RULE_1" layer="0">
      <TARGET_DETERMINATION>
        return TargetCreatureNeutralBad()
      </TARGET_DETERMINATION>
      <PLAYTIME>
        ChooseTarget( "ChooseCreatureDestroy" )
      </PLAYTIME>
     <PRE_EFFECT>
      RemoveTargetCardFromGame()
      ClearFilter()
      Object():GetFilter():NotTargetted()
      Object():GetFilter():AddCardType( CARD_TYPE_LAND )
      Object():GetFilter():AddSupertype( SUPERTYPE_BASIC )
      Object():GetFilter():May()
      SearchLibrary(TargetCardsController(), "SearchYourLibraryForBasicLand" )
     </PRE_EFFECT>
      <EFFECT>
        if Object():GetTargetCard() ~= nil then         
         Object():GetTargetCard():PutIntoPlayTapped( TargetCardsController() )
      end
      TargetCardsController():ShuffleLibrary()
      </EFFECT>
    </SPELL_ABILITY>
    <AI_SCORE_MULTIPLIER zone="hand" value="20" />
  </CARD>
</MULTICARDS>
If you have an idea ...

I will carry on to do other cards... I will try

Worship
Ivory Mask
Last edited by pun1sher666 on 09 Jul 2010, 18:04, edited 1 time in total.
pun1sher666
 
Posts: 37
Joined: 09 Jul 2010, 13:49
Has thanked: 0 time
Been thanked: 0 time

Re: General XML/LUA Editing Findings

Postby Epiphany » 09 Jul 2010, 14:28

Welcome to the forums!

I've had a go, and done it as follows:

Code: Select all
<?xml version="1.0"?>
<MULTICARDS>

  <CARD>
    <TITLE text="PATH_TO_EXILE_TITLE" />
    <FILENAME text="Path_to_exile" />
    <COLLECTIONMAX value="383" />
    <COLLECTORNUMBER value="122" />
    <ARTID value="301038" />
    <FRAMECOLOUR name="W" />
    <COLOR value="W" />
    <ARTIST name="Todd Lockwood" />
    <CASTING_COST cost="{W}" />
    <CARDNUMBER value="17" />
    <TYPE metaname="Instant" />
    <EXPANSION metaname="A" />
    <RARITY metaname="uncommon" />
    <SPELL_ABILITY tag="PATH_TO_EXILE_RULE_1" layer="0">
      <TARGET_DETERMINATION>
        return TargetCreatureNeutralBad()
      </TARGET_DETERMINATION>
      <PLAYTIME>
        ChooseTarget( "ChooseCreatureDestroy" )
      </PLAYTIME>
     <PRE_EFFECT>
     </PRE_EFFECT>
      <EFFECT>
      RemoveTargetCardFromGame()
      </EFFECT>
    </SPELL_ABILITY>
    <SPELL_ABILITY simple_filter="Target" layer="0">
     <PRE_EFFECT>
      ClearFilter()
      Object():GetFilter():NotTargetted()
      Object():GetFilter():AddCardType( CARD_TYPE_LAND )
      Object():GetFilter():AddSupertype( SUPERTYPE_BASIC )
      Object():GetFilter():May()
      SearchLibrary(TargetCardsController(), "SearchYourLibraryForBasicLand" )
     </PRE_EFFECT>
      <EFFECT>
        if Object():GetTargetCard() ~= nil then         
         Object():GetTargetCard():PutIntoPlayTapped( TargetCardsController() )
      end
      TargetCardsController():ShuffleLibrary()
      </EFFECT>
    </SPELL_ABILITY>
    <AI_SCORE_MULTIPLIER zone="hand" value="20" />
  </CARD>
</MULTICARDS>
But unfortunately it asks me to pick a land from the opponents deck.

Which to be honest, isn't that bad when you're playing against mono AI. I don't know how to get the opponent to choose themselves, there must be something we're over looking! :)
Epiphany
 
Posts: 95
Joined: 30 Jun 2010, 13:27
Has thanked: 0 time
Been thanked: 0 time

Re: General XML/LUA Editing Findings

Postby Yanna » 09 Jul 2010, 15:22

Hello, and as Epiphany said, welcome to the forums !

Path to Exile seems an ok card to do, but it's more tricky to code... Epiphany was quite close indeed.

As i've recently coded an extremely tricky card as well (coming soon, i'm proud of this one :)), it made me learn more from the coding syntax.
I'll try to explain with comments how you can code Path to Exile (this is just the spell ability, i believe you got the rest of the card infos done) :

Code: Select all


        <SPELL_ABILITY tag="PATH_TO_EXILE_RULE_1" layer="0">

         <!-- /// Target Hints /// -->
         <TARGET_DETERMINATION>
            return TargetCreatureBadF()
         </TARGET_DETERMINATION>

         <!-- /// Card Player chooses which creature to Exile /// -->
         <PLAYTIME>
            ChooseTarget( "ChooseTargetCreature" )
         </PLAYTIME>

         <PRE_EFFECT>
            <!-- /// If target doesn't exist when this resolves, then do nothing /// -->
            if Object():GetTargetCard() ~= nil then

                    <!-- /// Tricky bit, we need to 'register' the creature controller in the object first, to be recalled later on /// -->
                    local CreatureController = TargetCardsController()
                    Object():Register_Player_Set( 0, CreatureController )

                    <!-- /// Creature goes to oblivion ! /// -->
                    Object():GetTargetCard():RemoveFromGame()

                    <!-- /// Now set up a new filter, including Lands from the creature controller's library /// -->
                    Object():GetFilter():Clear()
                    Object():GetFilter():SetPlayer( CreatureController )
                    Object():GetFilter():SetZone( ZONE_LIBRARY )
                    Object():GetFilter():NotTargetted()
                    Object():GetFilter():AddCardType( CARD_TYPE_LAND )

                    <!-- /// Let the Creature's controller select a valid target (ie : a basic land from HIS deck /// -->
                    CreatureController:ChooseTarget( "SearchYourLibraryForBasicLand" )
           end
         </PRE_EFFECT>

         <EFFECT>
            <!-- /// If target doesn't exist when this resolves, then do nothing /// -->
            if (Object():GetTargetCard() ~= nil) then

                    <!-- /// Recall the previously registered player. This is done because meanwhile, the object's targets are different /// -->
                    local RemovedCreatureController = Object():Register_Player_Get( 0 )

                    <!-- /// The targetted land is put into play under the control of its owner /// -->
                    Object():GetTargetCard():PutIntoPlayTapped( RemovedCreatureController )
            end

            <!-- /// Then his library is shuffled up /// -->
            RemovedCreatureController:ShuffleLibrary()

          </EFFECT>

        </SPELL_ABILITY>


This card works as intended in my test deck ^^

See you soon !

YannA a.k.a NOVA
Image
User avatar
Yanna
 
Posts: 137
Joined: 03 Mar 2009, 14:52
Has thanked: 0 time
Been thanked: 1 time

Re: General XML/LUA Editing Findings

Postby Epiphany » 09 Jul 2010, 15:55

Beautiful work mate! I'm really impressed.

So basically:

Code: Select all
local CreatureController = TargetCardsController()
Creates a local variable called CreatureController with the card controller set as the object.

then:

Code: Select all
Object():Register_Player_Set( 0, CreatureController )
What does the above do? Presumably it registers the variable into the system?

Then presumably:

Code: Select all
local RemovedCreatureController = Object():Register_Player_Get( 0 )
Retrieves that variable later?
Epiphany
 
Posts: 95
Joined: 30 Jun 2010, 13:27
Has thanked: 0 time
Been thanked: 0 time

Re: General XML/LUA Editing Findings

Postby Yanna » 09 Jul 2010, 16:24

Thanks mate ^^

You're right on the spot ! You can register variables in the objects's properties, with Set() then retrieve it later with Get().
Looking at the code of Counterbore and blightning taught me that... And it's really needed when you do things like :

1°) Set up a filter, then have some target be chosen (the targets are then linked to the card you're playing)
2°) Set up another filter, then have some new targets be chosen (the new targets erase the previous ones)

So for Path to Exile you have one target (the creature) and another target (the controller's basic land) : you can't have them 'stored' at the same time... At least that's what i think.

Still working on the DLC, made much card/decks/AI so far. Here's a list of some cards in it (hints on the decks themes ^^):

Goblin Piledriver
Lord Of The Undead
Roiling Terrain
Crypt Rats
Diamond Valley
Stitch Together

YannA a.k.a NOVA
Image
User avatar
Yanna
 
Posts: 137
Joined: 03 Mar 2009, 14:52
Has thanked: 0 time
Been thanked: 1 time

Re: General XML/LUA Editing Findings

Postby pun1sher666 » 09 Jul 2010, 16:44

Thanks both of you :)

Yanna, I tried your code, but the AI still don't look for the library for a basic land.
I understood your code but there is one line i do'nt understand.

Code: Select all
CreatureController:ChooseTarget( "SearchYourLibraryForBasicLand" )
Is this line has to make the AI lookfor the basic land ?
pun1sher666
 
Posts: 37
Joined: 09 Jul 2010, 13:49
Has thanked: 0 time
Been thanked: 0 time

Re: General XML/LUA Editing Findings

Postby pun1sher666 » 09 Jul 2010, 17:22

In fact everything is ok !
I think because sometime the AI don't want to use the ability.
I just tested again and it is working, soryy for that... good job Yanna :)
pun1sher666
 
Posts: 37
Joined: 09 Jul 2010, 13:49
Has thanked: 0 time
Been thanked: 0 time

Re: General XML/LUA Editing Findings

Postby Epiphany » 09 Jul 2010, 18:47

Yanna wrote:Thanks mate ^^

You're right on the spot ! You can register variables in the objects's properties, with Set() then retrieve it later with Get().
Looking at the code of Counterbore and blightning taught me that... And it's really needed when you do things like :

1°) Set up a filter, then have some target be chosen (the targets are then linked to the card you're playing)
2°) Set up another filter, then have some new targets be chosen (the new targets erase the previous ones)

So for Path to Exile you have one target (the creature) and another target (the controller's basic land) : you can't have them 'stored' at the same time... At least that's what i think.

Still working on the DLC, made much card/decks/AI so far. Here's a list of some cards in it (hints on the decks themes ^^):

Goblin Piledriver
Lord Of The Undead
Roiling Terrain
Crypt Rats
Diamond Valley
Stitch Together

YannA a.k.a NOVA
Nice!

I was hoping that I could use variables to uniquely track a creature. For example, Apes of Rath don't untap during your next untap phase, and I figured I could use variables to record whether it's time to untap or not, but I can't get it to work! Oh well.

My fave cards that I've managed to make so far are:

Altar of Dementia
Avenging Angel
Chill

It's kinda fun being able to make the cards with the slightly unusual effects.
Epiphany
 
Posts: 95
Joined: 30 Jun 2010, 13:27
Has thanked: 0 time
Been thanked: 0 time

Re: General XML/LUA Editing Findings

Postby pun1sher666 » 09 Jul 2010, 23:28

Good evening,

I spent a long time today to try to code Land Tax and i think i'm on the right way even so it still miss some things to make it work correctly..
Every upkeep a question is asked to know if you want to use the ability or not, but i still didn't got to make it happen only if the opponent have more land than me, i think i mess up with the trigger. The other point is when i selected the lands i want, i don't know how to do to put them all in my hand i just got to put one.
Here is my code for Land Tax
Code: Select all
<?xml version="1.0"?>
<MULTICARDS>
 
  <CARD>
    <TITLE text="LAND_TAX_TITLE" />
    <FILENAME text="Land_Tax" />
    <COLLECTIONMAX value="301" />
    <COLLECTORNUMBER value="128" />
    <ARTID value="301040" />
    <FRAMECOLOUR name="W" />
    <COLOR value="W" />
    <ARTIST name="Glen Angus" />
    <CASTING_COST cost="{W}" />
    <CARDNUMBER value="2" />
    <FLAVOURTEXT text="LAND_TAX_FLAVOUR" />
    <TYPE metaname="Enchantment" />
    <EXPANSION metaname="A" />
    <RARITY metaname="rare" />
    <TRIGGERED_ABILITY tag="LAND_TAX_RULE_1" forced_skip="1" layer="0">
      <TARGET_DETERMINATION>
        return TargetOpponent( Object():GetPlayer() )
      </TARGET_DETERMINATION>
      <TRIGGER value="COMES_INTO_PLAY">
        return SelfTriggered() and ChooseAnOpponent( Object():GetPlayer() )
      </TRIGGER>
      <PRE_EFFECT>
        ChooseAnOpponent( Object():GetPlayer() )
        ChooseTarget( "ChooseOpponentForTheRack" )
      </PRE_EFFECT>
      <EFFECT>
        Object():Register_Player_Set( 0, Object():GetTargetPlayer() )
      </EFFECT>
    </TRIGGERED_ABILITY>
    <TRIGGERED_ABILITY tag="LAND_TAX_RULE_2" layer="0">
      <TRIGGER value="BEGINNING_OF_STEP">       
        return MyUpkeep()
      <!--and CountLandsControlledBy( You() ) &lt; CountLandsControlledBy( Object():Register_Player_Get( 0 ) ) )-->
      </TRIGGER>
      <PLAYTIME>
        if (MTG():FromAIPerspective() == 0) then
         Object():GetPlayer():BeginNewMultipleChoice()
         Object():GetPlayer():AddMultipleChoiceAnswer( "YES" )
         Object():GetPlayer():AddMultipleChoiceAnswer( "NO" )
         Object():GetPlayer():AskMultipleChoiceQuestion( "HowManyLandYouWantToPick" )      
        end
      </PLAYTIME>
     <PRE_EFFECT>
      if( Object():GetMultipleChoiceResult() == 0 ) then
         ChooseNLandFromLibrary2( You(), "SearchYourLibraryForBasicLand", 3 )
      end
     </PRE_EFFECT>
      <EFFECT>
      if (Object():GetTargetCard() ~= nil) then
        Object():GetTargetCard():PutInHand()
        Object():GetTargetCard():GuidedReveal( ZONE_LIBRARY, ZONE_HAND )
      
        Object():GetOwner():ShuffleLibrary()
      end      
     </EFFECT>
    </TRIGGERED_ABILITY>
    <HELP title="INFO_BADGE_TITLE_1" body="INFO_BADGE_BODY_1" />
  </CARD>
</MULTICARDS>
I start to be too much fixed on it to think well :) I will move to Worship i think, not sure it will be a piece of cake...
pun1sher666
 
Posts: 37
Joined: 09 Jul 2010, 13:49
Has thanked: 0 time
Been thanked: 0 time

Re: General XML/LUA Editing Findings

Postby Uresti » 10 Jul 2010, 03:23

Wslcome pun1sher666 feel at home!

Wow yanna yuo really beat me with that Path to exile. was the fist card i tried without susses, you can find a preliminary one in the first dlc. thats why sword to plowshares and alpha cards came cause i couldnt made a path to exile! :) congratz for that! now with your code a lot of possibilities are open!
Uresti
 
Posts: 151
Joined: 25 Jun 2010, 15:26
Has thanked: 0 time
Been thanked: 0 time

Re: General XML/LUA Editing Findings

Postby otherright » 10 Jul 2010, 05:24

I'm not finding your DLCs on here. Is there any chance of you guys posting daily updates of your DLCs for us to install. So, we can use the newest cards daily? That would be great if you could.

It may be an idea to create a post in the forum titled custom DLCs.

As you can read elsewhere in the forum, I fully support the modding of this game and the efforts of the fan community to make this game even better. Thank you guys for your hard work.
otherright
 
Posts: 63
Joined: 29 Sep 2009, 17:46
Has thanked: 4 times
Been thanked: 6 times

Re: General XML/LUA Editing Findings

Postby Epiphany » 10 Jul 2010, 09:53

Welcome to the forums.

I haven't released any of my cards yet, because I didn't think people would be interested in incomplete work.

I'll try to have a collection of what I've done so far ready by the end of today, if you're willing to playtest it, that is! :)

I cannot vouch for any of my cards being perfect or working 100%, but will be glad if people want to try to play with them.
Epiphany
 
Posts: 95
Joined: 30 Jun 2010, 13:27
Has thanked: 0 time
Been thanked: 0 time

Re: General XML/LUA Editing Findings

Postby Uresti » 10 Jul 2010, 15:35

Welcome otherright!

you can find some alpha cards there
http://www.slightlymagic.net/forum/viewtopic.php?f=62&t=2820

and some slivers there:

http://rapidshare.com/files/404772451/Data_DLC_7777.rar
Uresti
 
Posts: 151
Joined: 25 Jun 2010, 15:26
Has thanked: 0 time
Been thanked: 0 time

PreviousNext

Return to Documentation

Who is online

Users browsing this forum: No registered users and 10 guests


Who is online

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

Login Form