Staredit Network

Staredit Network -> UMS Assistance -> Card Drawing
Report, edit, etc...Posted by iiiiLLLLi on 2004-07-21 at 16:24:31
I'm trying to set up a card drawing system that randomizes the unit picked when you draw, but also limits the number of cards. The normal system has a dropship with a location following it picking up units, but that keeps units on the very right side from being picked because moving/killing a unit at a location starts from left to right, and the rightmost units never get picked. I can't find a simple way to have a randomized unit picking system.

I want it to be that when they draw a card, it can pick any one of their units at random for it.
Report, edit, etc...Posted by Stereo on 2004-07-21 at 16:50:27
I think I had something like this once. How it worked is this:

First off, use switches to pick a random number for the unit (obviously keep it to the values that are possible)
Then give that many units - 1 to a different player
Then move 1 unit to somewhere else
Then give all units back to the original player.

Repeat.
Report, edit, etc...Posted by iiiiLLLLi on 2004-07-21 at 17:09:11
The players select Decks and a few choice cards beforehand. If I have switches set up for every card, how will I keep players from getting a card they didn't select? If the switches set them up for card A and they don't have card A, what happens? I can't keep running switches until it gets it right, that would take forever. I need it to take a unit from a location so that I can ensure they have it, but I don't want the problem of having a card that never gets selected, or having the odds being weighted towards cards at the left end.

Doing something like running a junkyard dog script would be problematic for air units and slow units like reavers would never get picked.
Report, edit, etc...Posted by Kejardon on 2004-07-21 at 18:27:02
It would take a lot of locations (2 per card), but...
Put a ton of units off somewhere in the map, in a long vertical strip. Have them repeatedly move left and right. Then just grab any one unit from the pile; since it picks the left most, it can potentially pick any unit. And the speed won't really matter much.

The best solution would still probably be to use switches, though. Have a switch for every card (in pile or not), and then use switches to pick one at random. If it's not chosen, pick another at random. You could copy that trigger 10-15 times, in which case there is an *incredibly* slim chance of it not picking an available card within a second or two if you have hyper triggers on.
Report, edit, etc...Posted by Stereo on 2004-07-21 at 19:16:10
I guess I need to explain myself more clearly.


Ok. You put every single card that the player wants to be potentially chosen within 1 location. Obviously the cards all have to be physically there, not just set in some variable. I assume this is limited so you will know how many there are, otherwise it won't work completely randomly.. Then you use a few switches as described in the randomizing switches tutorial so you get a number of outcomes greater than or equal to the number of cards. Use these outcomes to transfer ownership of the cards (switch one is set --> clear, give 1 card to player X, switch 2 is set --> clear, give 2 cards to player X, same for 3 --> 4, 4 --> 8, 5 --> 16), and so on so you have a seperate trigger for each switch. Then check if there are any cards still owned by the player, if so move it to the "randomly selected cards" location otherwise rerandomize the switches, either way give all player X's cards back to the player. If you are going to be choosing several cards I suggest giving the player some score equal to the number of cards to choose and taking 1 point off every time it successfully picks a card, and looping the whole thing until the score is 0.
Report, edit, etc...Posted by iiiiLLLLi on 2004-07-21 at 20:09:43
The problem with the first plan is that after 30 or so turns, when they've got 10 or so cards left, the trigger would have to run over and over and over again, and I don't think that's too good for a game.

As far as the second goes, that would take a while, too, and would only cause the randomization to favor the cards on the right edge of the trigger. It would start giving units away from the left edge of a location, so the remaining units would be on the right edge. I would have the same problem, except on the left edge this time.
Report, edit, etc...Posted by DT_Battlekruser on 2004-07-21 at 23:59:10
You don't need 64 locations... Make 64 units one for each card... Here, I will be nice. Use the dealing triggers form this map, call them your own. (I gave up on the map)

EDIT> No hypertriggers, so it runs kinda slow, but add HTs and it will deal them quickly.
Report, edit, etc...Posted by BeeR_KeG on 2004-07-22 at 08:20:18
Read (U)Bolt_Head's tutorial on Rondomized switches, it's very good and helpful.

I would prefer not using the card physicaly as a bug might occur, like the comp casting a spell or something.
It would be better and more efficient to use the Randomized Switches, if you don't want to card to repeat make it so that when one unit was created you disable that switch combination and there you go, you can also delete preserve trigger on the unit creation trigger, not the Randomized trigger.
Report, edit, etc...Posted by iiiiLLLLi on 2004-07-22 at 08:42:19
I can't just disable the creation alltogether, though, as some decks might have more than 1 of a card in them. I'll check out that map when I can. Also, seeing as spells will not be needed, I can disable them all.
Report, edit, etc...Posted by DT_Battlekruser on 2004-07-22 at 12:08:12
No, pysically creating the cards works better. That way, somebody can know instantly what cards they have, and you can convienently say "IF player brings one Six of Spades to location". It makes the rest of the triggering so much easier.

QUOTE
like the comp casting a spell or something.


Make the cards owned by a Neutral player, never a comp.
Report, edit, etc...Posted by iiiiLLLLi on 2004-07-22 at 13:19:03
Sorry, but the hearts draw system won't work for me. Each player will have access to 24-28 different cards in varying amounts, totalling 44 cards. Each and every unit is used for the cards. If I do that, I have 60 different values to check for, so I need to have 8 binaries. With 64 possibilities, when it boils down to 5 or so cards left in your deck, there will be 59 wrong values for the switches that will have to start it over, and even more if some of the 5 are repeats. I don't think it will go very well with a game if drawing consists of running the triggers 50 times every turn, and with four players that's like 200 triggers. If all else fails, though, I might have to.
Report, edit, etc...Posted by Stereo on 2004-07-22 at 16:11:24
Ooooooh, now I understand what the problem is. Just use a counter to count the units, and count down in binary (8, 4, 2, 1) checking to see if the control is that many enabling a switch for a randomiser - if there are at least 8, but still less than 16 enable up to the 8 (giving you a max value of 15), if there are only at least 4 but less than 8, enable up to the 4. Then run the randomiser only checking the ones with their switch enabled. That way when you have 5 units left, it enables the triggers to give 1, 2, and 4 units which means only 2&4/1&2&4 enabled will mean a reroll. You can save time by not checking how many units there are unless it successfully takes one away.
Report, edit, etc...Posted by DT_Battlekruser on 2004-07-23 at 00:49:42
Actually, re-running the trigger doesn't really hurt the game. If you look at my heats triggers, theres a lot that make it re-run, including when it draws a card tat it isn't there. Don't worry, the rerunning won't make it crash.
Next Page (1)