Staredit Network

Staredit Network -> UMS Assistance -> Randomizing isn't working
Report, edit, etc...Posted by LethaL on 2005-03-20 at 23:17:41
I'm making a map where there's 1 force, and a random player from that force is chosen to be the 'Launcher' of a map I'm working on. At the start, it randomizes 3 switches, 1 setting sets Player 1, another sets 2, etc (There are 5 players) and the extra 3 rerandomize it.

NOW, my problem. When I try randomizing the players, it occured that it sometimes gives the 'Launcher' units to a player isn't there (If there's players 1-4, it MIGHT give it to Player 5). Here are my triggers:

Trigger
Conditions:
¤ Always
Actions:
¤ Randomize Switch 1
¤ Randomize Switch 2
¤ Randomize Switch 3


Trigger
Conditions:
¤ Switch 1 is Set
¤ Switch 2 is Set
¤ Switch 3 is Set
Actions:
¤ Give all Launcher owned by Player 7 at Anywhere to Player 1
¤ Modify death counts for Player 1: Set to 0 for '1 = Victim'
¤ Modify death counts for Players 2-5: Set to 1 for '1 = Victim'


Trigger
Conditions:
¤ Current Player Commands at least 1 Launcher
¤ Current Player Commands exactly 0 Ban Player
Actions:
¤ Give all Launcher owned by Players at Anywhere to Player 7
¤ Randomize Switch 1
¤ Randomize Switch 2
¤ Randomize Switch 3


SO, at the start, it randomizes the switches. Through normal randomizing processes, it gives units to players accordingly. What's SUPPOSED to happen, is that a player gets a defeat (banned) if they do not have the 'Ban Trigger' unit. By default, if a player isn't there, any preplaced units for that player won't be placed.

When I play the map, Randomizing ALWAYS chooses Player 5. There is nothing I can find that's wrong with the triggering, but it always chooses Player 5 to be the Launcher player. Not only that, the last trigger doesn't work (Not all conditions are satisfied?). But Player 5 in fact does not have the Ban Player unit and DOES have the Launcher Unit.

FINALLY, can anybody see if there's anything wrong? I can provide the map, but triggering is very complicated (At least 400 triggers) and you might not be able to find/understand it all.
Report, edit, etc...Posted by notnuclearrabbit on 2005-03-20 at 23:21:29
[center]All switches automatically start out 'Cleared' I'm assuming that Player 5's conditions are all 'Cleared'...[/center]
Report, edit, etc...Posted by chuiu on 2005-03-20 at 23:27:42
Have a trigger that detects to see if the player is in game and re-randomize if he isn't. So that it repeats untill it hits a player that is in the game.
Report, edit, etc...Posted by LethaL on 2005-03-20 at 23:36:02
Nuclearrabbit: That's true, Player 5 is all Cleared, but not there's no wait between the action, so it starts the randomizing right when the game starts (Wait WAS 500 seconds, so it started off choosing P5. Now there's no wait and randomization works).

For the third trigger I changed the Condition 'Current Player Commands at least 1 Launcher' to 'Current Player has suffered exactly 0 deaths of 1 = Victim.' Amazingly, it worked, and I became the launcher. I thought the problem was fixed, but then I tried the map with a friend. It chose Player 3 (A player that wasn't there) and just stayed there.

I thought the problem was resolved for at least 1 player, but I tried again to make sure, and it wasn't. Again, it chose Player 3 (A player that wasn't there) and stayed there.

Chu: The Spider Mine unit 'Ban Player' is a unit that detects if the player is there or not. If there is no mine for Player X but Player X has the Launcher unit, it gives the Launcher unit back to Player 7 and rerandomizes the triggers (Repeating every time it chooses a player that isn't there).
Report, edit, etc...Posted by (U)Bolt_Head on 2005-03-21 at 00:04:11
Do you really want the Launcher to be random or do you just want to make sure there is a launcher there. If you just want to make sure there is a Launcher do this.

Trigger
Players:
¤ Human Players
Conditions:
¤ Force 1 commands exactly 0 Launcher
Actions:
¤ Create one Launcher for Current Player at Location.


And that will give the launcher to lowest numbered player whenever no one has any. (it will even give it to the runner up if the first player leaves).

Anyways if you want it to be random I suggest you wipe the whole system and take a whole different approach. This is what I would do.

Trigger
Players:
¤ Human Players
Conditions:
¤ Always
Actions:
¤ Randomize Switch 1
¤ Randomize Switch 2
¤ Randomize Switch 3


Trigger
Players:
¤ Human Players
Conditions:
¤ Switch 1 is set
Actions:
¤ Add 1 Custom Score for Current Player


Trigger
Players:
¤ Human Players
Conditions:
¤ Switch 2 is set
Actions:
¤ Add 2 Custom Score for Current Player


Trigger
Players:
¤ Human Players
Conditions:
¤ Switch 3 is set
Actions:
¤ Add 4(yes 4 not 3) Custom Score for Current Player


Trigger
Players:
¤ Human Players
Conditions:
¤ Elasped Time is at least 2 Seconds (this allows the other players triggers to run first)
¤ Current Player has the highest Score of Custom
¤ Force 1 Commands Exactly 0 Launcher.
Actions:
¤ Create one Launcher Unit for Current Player @ Location


What this does is assigns all the human players a random custom score between 0-5. Then you use the ‘highest score’ condition to give the player with the highest score the Launcher.

The only problem in this is if there is a tie between players the lower numbered player will receive the unit, because his trigger fires first. This is only a minor defect not a problem though.
-If you want to reduce the chances of this, add more switches and double the custom score added for each one.
Report, edit, etc...Posted by LordVodka on 2005-03-21 at 00:09:33
http://www.staredit.net/index.php?showtopic=2851

Tutorial for ALMOST everything at SEN.

EDIT:
8. How do I create random events?
See Bolt_Head's Tutorial: http://www.staredit.net/index.php?showtopic=2851

According to MiniMoose, it is a Tut.
Report, edit, etc...Posted by LethaL on 2005-03-21 at 00:16:50
Hmm, is there a way to fix it without completely wiping the whole system? I'm about 90% done with the entire map, and a lot of it revolves on the concept that I already implemented.

I also have a trigger where if a player brings a unit to a location, all Launcher units turn to back to Player 7 and the players are randomized again. For about 3 turns when I bring the unit to the location, nothing happens. On the next turn, the choosing unit changes to a random player (It's supposed to, but it's also supposed to change the launching units, which it does not do).

ADDITION: LordVodka: I know how to randomize triggers. The randomizing works fine part of the time, but other parts it doesn't. Also, you didn't even link me to a tutorial, you linked me to a thread where Bolt described how to do random triggers (Which doesn't solve my problem).
Report, edit, etc...Posted by (U)Bolt_Head on 2005-03-21 at 00:28:45
I'm only saying to scrap the Randomize triggers. The problem with your system is you have to do ALOT of extra work to detect what players are present in the game and then randomize accordingly. (or make fail safes to pick a differnant player)

The method I decribed works on a current player basis, witch means if the player is there, there included in the random ordering, It's a much more effecnt than the way your doing it.

Also my system could be converted to work multiple times pretty easly.

PS. The thread Lord Vodka Linked to is the same content as the Randomization Tutorial. I posted it there to get feed back on how helpfull it was before using it. (i did however make a few changes to the tutorial recently, not updated in that thread.)
Report, edit, etc...Posted by LethaL on 2005-03-21 at 01:09:55
The only work I used to detect players in the game was one trigger, and it just rerandomizes the launcher/victim status if a player isn't there.
Report, edit, etc...Posted by sckor on 2005-03-21 at 05:52:27

Trigger
Description:
Randomize
Players:
¤ Players
Conditions:
¤ Always
¤ Switch 1 is Cleared
¤ Switch 5 is cleared
Actions:
¤ Set Switch 1
¤ Randomize Switch [1]
¤ Randomize switch [3]
¤ Randomize switch [4]
¤ Preserve Trigger



Trigger
Description:
Event 1
Players:
¤ Players
Conditions:
¤ Switch 1 is set
¤ Switch 2 is set
¤ Switch 3 is set
¤ Switch 4 is set
Actions:
¤ Give launcher to player
¤ other actions
¤ Clear Switch 1
¤ Set switch 5



Trigger
Description:
Re rnadomize
Players:
¤ players
Conditions:
¤ Switch 1 is set
¤ Switch 2 is cleared
¤ Switch 3 is cleared
¤ Switch 4 is cleared
Actions:
¤ Clear switch 1
¤ Preserve Trigger



Trigger
Description:
Randomize once again
Conditions:
¤ Some event or condition is met
¤ Switch 5 is set
Actions:
¤ Clear switch 5
¤ Preserve trigger

Report, edit, etc...Posted by (U)Bolt_Head on 2005-03-21 at 14:43:25
Lethal: you don't have to take my advise if you don't want to.

Sckor: what the hell is that?
Next Page (1)