theFarWilds.com http://thefarwilds.com/forum/ | |
Setting the deck http://thefarwilds.com/forum/viewtopic.php?f=14&t=1745 |
Page 1 of 1 |
Author: | jed [ Thu Mar 18, 2010 12:22 am ] |
Post subject: | Setting the deck |
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(); } |
Author: | KrazieOrk [ Thu Mar 18, 2010 7:48 pm ] |
Post subject: | Re: Setting the deck |
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? |
Author: | cylone [ Thu Mar 18, 2010 8:06 pm ] |
Post subject: | Re: Setting the deck |
jed wrote: If you want to specify the deck the player should use you do this: Thanks for the update and letting us know. |
Author: | UBER [ Thu Mar 18, 2010 8:33 pm ] |
Post subject: | Re: Setting the deck |
I couldnt get the code to work. |
Author: | angelatheist [ Thu Mar 18, 2010 9:04 pm ] |
Post subject: | Re: Setting the deck |
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; |
Author: | KrazieOrk [ Fri Mar 19, 2010 1:17 pm ] |
Post subject: | Re: Setting the deck |
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. |
Author: | jed [ Fri Mar 19, 2010 7:04 pm ] |
Post subject: | Re: Setting the deck |
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. |
Page 1 of 1 | All times are UTC |
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group http://www.phpbb.com/ |