Login    Forum    Search    FAQ

Board index » Scenarios & Scripting




Post new topic Reply to topic  [ 7 posts ] 
Author Message
 Post subject: Setting the deck
 Post Posted: Thu Mar 18, 2010 12:22 am 
Offline

Joined: Tue Jan 08, 2008 2:07 am
Posts: 1045
If you want to specify the deck the player should use you do this:

Code:
void beforeStart()
{
   Player player=getHumanPlayer(0);
   int ds=player.deckSize();
   for(int n=0; n<ds; n++)
   {
      player.removeDeckCard(0);
   }

   player.addToDeck("Card Name",0);
   // .... Do this for each card you want them to have
   player.shuffleDeck();
}


Top 
 Profile  
 
 Post subject: Re: Setting the deck
 Post Posted: Thu Mar 18, 2010 7:48 pm 
Offline

Joined: Wed Apr 08, 2009 11:23 am
Posts: 15
Location: Netherlands
I used this code and modified it a bit to give the AI a different deck. The deck I set was Elemental/Sylvan.

But when I played the scenario, the AI played MF/Sylvan... what's up with that?


Top 
 Profile  
 
 Post subject: Re: Setting the deck
 Post Posted: Thu Mar 18, 2010 8:06 pm 
Offline

Joined: Thu Dec 11, 2008 3:00 pm
Posts: 124
jed wrote:
If you want to specify the deck the player should use you do this:


Thanks for the update and letting us know.


Top 
 Profile  
 
 Post subject: Re: Setting the deck
 Post Posted: Thu Mar 18, 2010 8:33 pm 
Offline
User avatar

Joined: Thu Jun 11, 2009 5:38 am
Posts: 315
I couldnt get the code to work.


Top 
 Profile  
 
 Post subject: Re: Setting the deck
 Post Posted: Thu Mar 18, 2010 9:04 pm 
Offline

Joined: Mon Mar 02, 2009 11:00 am
Posts: 150
It seems like the above code does not remove the cards in hand. Once you remove the cards you may want to have the player draw a new hand. You can try this code:

Code:
void beforeStart()
{
   Player HumanPlayer=getHumanPlayer(0);
   while(handSize(HumanPlayer)>0){
       removeHandCard(HumanPlayer,0);
   }
   while(deckSize(HumanPlayer)>0){
       removeDeckCard(HumanPlayer,0);
   }
   addToDeck(HumanPlayer,"Card Name",0);
   // .... Do this for each card you want them to have
   shuffleDeck(HumanPlayer);
   int n;
   for(n=0; n<7; n++)
   {
       drawCard(HumanPlayer);
   }
}


also if you make your own code dont forget the semicolons;

_________________
ȁ̎̉̈̂̎͋̈́̍n͂͑̿ͥͣ́̓ġͤ͑ͯe͌̓̊ͩ͗̅l̽̓ͬͬͥ̊͗aͣ̔̃ͧ̓̾̾t͊̑̆hͤ͆̓̉̌ͣ̚e̋ͩ͒̈́ĭ̌̒̎ͧ̓̋ͪs̋ͤͧ̅̇̋̎ͫ̂̾ͨ̽̄ͫͯt͒͐̌ͭ̂̃ͪ̽ͣ͗̒ͣ


Top 
 Profile  
 
 Post subject: Re: Setting the deck
 Post Posted: Fri Mar 19, 2010 1:17 pm 
Offline

Joined: Wed Apr 08, 2009 11:23 am
Posts: 15
Location: Netherlands
Thanks to angelatheist for the tips!

I still get errors on the shuffleDeck function, but when I leave that out, I can let the AI play with a Sylvan-Elemental deck (which comes out in a preset order, so it's rather predictable, but still - it works! Yay!).

Feel free to try it out and comment: {Script,KrazieTest3,33}

I'll try other scripting thingies later... taking it step by step.


Top 
 Profile  
 
 Post subject: Re: Setting the deck
 Post Posted: Fri Mar 19, 2010 7:04 pm 
Offline

Joined: Tue Jan 08, 2008 2:07 am
Posts: 1045
beforeStart was getting called after your initial cards were drawn. It is now called before any cards are drawn so you don't need to strip the cards in your hand anymore.


Top 
 Profile  
 
Display posts from previous:  Sort by  
 
Post new topic Reply to topic  [ 7 posts ] 

Board index » Scenarios & Scripting


Who is online

Users browsing this forum: No registered users and 8 guests

 
 

 
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to: