Author |
Message |
jed
|
Post subject: Setting the deck Posted: Thu Mar 18, 2010 12:22 am |
|
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(); }
|
|
|
|
|
KrazieOrk
|
Post subject: Re: Setting the deck Posted: Thu Mar 18, 2010 7:48 pm |
|
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?
|
|
|
|
|
cylone
|
Post subject: Re: Setting the deck Posted: Thu Mar 18, 2010 8:06 pm |
|
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.
|
|
|
|
|
UBER
|
Post subject: Re: Setting the deck Posted: Thu Mar 18, 2010 8:33 pm |
|
Joined: Thu Jun 11, 2009 5:38 am Posts: 315
|
I couldnt get the code to work.
|
|
|
|
|
angelatheist
|
Post subject: Re: Setting the deck Posted: Thu Mar 18, 2010 9:04 pm |
|
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͒͐̌ͭ̂̃ͪ̽ͣ͗̒ͣ
|
|
|
|
|
KrazieOrk
|
Post subject: Re: Setting the deck Posted: Fri Mar 19, 2010 1:17 pm |
|
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.
|
|
|
|
|
jed
|
Post subject: Re: Setting the deck Posted: Fri Mar 19, 2010 7:04 pm |
|
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.
|
|
|
|
|
|