# spawn random cards in variable positions

**URL:** <https://forum.vassalengine.org/t/spawn-random-cards-in-variable-positions/11098>\
**Category:** Module Design\
**Created:** [September 4, 2020, 9:20am UTC](https://forum.vassalengine.org/t/spawn-random-cards-in-variable-positions/11098 "2020-09-04T09:20:32Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![CesarM](https://forum.vassalengine.org/letter_avatar_proxy/v4/letter/c/b5ac83/32.png) [@CesarM](https://forum.vassalengine.org/u/CesarM)\
**Post date:** [September 4, 2020, 9:20am UTC](https://forum.vassalengine.org/t/spawn-random-cards-in-variable-positions/11098/1 "2020-09-04T09:20:32Z")

</div>

At the start of the game, you take random counters and place them in different places (depending on the scenario being played).

How could this be done?

I’m thinking about creating a “target” Piece, with Marker “target=true” and a GKC (triggered by a At-start command) that would call one random counter from the deck.

Problem is I have several targets and this approach would send the same amount of random counters, all to the same “target” piece.

Is there an ‘easy’ way to accomplish this?

---

<div class="post-metadata">

**Author:** ![CesarM](https://forum.vassalengine.org/letter_avatar_proxy/v4/letter/c/b5ac83/32.png) [@CesarM](https://forum.vassalengine.org/u/CesarM)\
**Post date:** [September 4, 2020, 9:50am UTC](https://forum.vassalengine.org/t/spawn-random-cards-in-variable-positions/11098/2 "2020-09-04T09:50:15Z")

</div>

I have tried another thing.

Created 2 numerical GP, “TargetX” and “TargetY”; each Target piece would update those GP with its own coordinates, just before issuing the GKC to fetch one counter from the deck, then the same Startup Command would delete the Target Piece.

Doesn’t work, every counter goes to the same spot, where the last Target Piece was placed.

---

<div class="post-metadata">

**Author:** ![Brent\_Easton](https://forum.vassalengine.org/user_avatar/forum.vassalengine.org/brent_easton/32/10_2.png) [@Brent\_Easton](https://forum.vassalengine.org/u/Brent_Easton)\
**Post date:** [September 4, 2020, 9:53am UTC](https://forum.vassalengine.org/t/spawn-random-cards-in-variable-positions/11098/3 "2020-09-04T09:53:56Z")

</div>

I use this same method to ‘deal’ random Flak counters to pre-defined locations that contain a Flak ‘target’ piece. All you have to do is have the arriving piece delete any target marker in the same location as it. The next piece ‘dealt’ will then find the next target marker. This also neatly gets the ‘target’ markers off the board

---

<div class="post-metadata">

**Author:** ![Brent\_Easton](https://forum.vassalengine.org/user_avatar/forum.vassalengine.org/brent_easton/32/10_2.png) [@Brent\_Easton](https://forum.vassalengine.org/u/Brent_Easton)\
**Post date:** [September 4, 2020, 9:55am UTC](https://forum.vassalengine.org/t/spawn-random-cards-in-variable-positions/11098/4 "2020-09-04T09:55:14Z")

</div>

PS. Make the target pieces as simple as possible. Put the smarts in the ‘dealt’ pieces. I use toolbar button to initiate a Map level GKC to do the dealing.

---

<div class="post-metadata">

**Author:** ![CesarM](https://forum.vassalengine.org/letter_avatar_proxy/v4/letter/c/b5ac83/32.png) [@CesarM](https://forum.vassalengine.org/u/CesarM)\
**Post date:** [September 4, 2020, 10:28am UTC](https://forum.vassalengine.org/t/spawn-random-cards-in-variable-positions/11098/5 "2020-09-04T10:28:43Z")

</div>

Yes this is what I tried but I can’t get it working yet. Can you point me to your module with those Flak ‘target’ pieces so I can take a look?

Thanks!
