Staredit Network > Forums > SC1 UMS Mapmaking Assistance > Topic: Randomized 33.3% triggers
Randomized 33.3% triggers
Oct 25 2013, 6:23 pm
By: Prophete  

Oct 25 2013, 6:23 pm Prophete Post #1



So I have a trigger set I am looking to do but when I learned mapping I started off using DC instead of switches (Never used them) so I'm a little lost with them.

I understand the basics and everything of how they work but I seem to run into a problem every time.

Now, the way I think this works is like this

Quote
Trigger("Player 1"){
Conditions:
Deaths("Current Player", "Terran Ghost", Exactly, 1);

Actions:
Set Deaths("Current Player", "Terran Ghost", Set To, 0);
Set Deaths("Current Player", "Alan Schezar (Goliath)", Set To, 96);
Preserve Trigger();
Comment("Start Respawn");
}

//-----------------------------------------------------------------//

Trigger("Player 1"){
Conditions:
Deaths("Current Player", "Alan Schezar (Goliath)", Exactly, 1);

Actions:
Set Switch("Switch1", randomize);
Set Switch("Switch2", randomize);
Set Switch("Switch3", randomize);
Preserve Trigger();
Comment("Start Randomization Of Respawn");
}

//-----------------------------------------------------------------//

Trigger("Player 1"){
Conditions:
Deaths("Current Player", "Alan Schezar (Goliath)", At least, 1);

Actions:
Set Deaths("Current Player", "Alan Schezar (Goliath)", Subtract, 1);
Preserve Trigger();
Comment("Subtract Respawn Timer");
}

//-----------------------------------------------------------------//

Trigger("Player 1"){
Conditions:
Command("Current Player", "Terran Ghost", Exactly, 0);
Deaths("Current Player", "Alan Schezar (Goliath)", Exactly, 0);
Switch("Switch1", not set);
Switch("Switch2", not set);
Switch("Switch3", not set);

Actions:
Create Unit("Current Player", "Terran Ghost", 1, "Respawn Location 1");
Set Switch("Switch1", clear);
Set Switch("Switch2", clear);
Set Switch("Switch3", clear);
Preserve Trigger();
Comment("Respawn Location 1-1");
}

//-----------------------------------------------------------------//

Trigger("Player 1"){
Conditions:
Command("Current Player", "Terran Ghost", Exactly, 0);
Deaths("Current Player", "Alan Schezar (Goliath)", Exactly, 0);
Switch("Switch1", set);
Switch("Switch2", set);
Switch("Switch3", set);

Actions:
Create Unit("Current Player", "Terran Ghost", 1, "Respawn Location 2");
Set Switch("Switch1", clear);
Set Switch("Switch2", clear);
Set Switch("Switch3", clear);
Preserve Trigger();
Comment("Respawn Location 2-1");
}

//-----------------------------------------------------------------//

Trigger("Player 1"){
Conditions:
Command("Current Player", "Terran Ghost", Exactly, 0);
Deaths("Current Player", "Alan Schezar (Goliath)", Exactly, 0);
Switch("Switch1", set);
Switch("Switch2", not set);
Switch("Switch3", not set);

Actions:
Create Unit("Current Player", "Terran Ghost", 1, "Respawn Location 3");
Set Switch("Switch1", clear);
Set Switch("Switch2", clear);
Set Switch("Switch3", clear);
Preserve Trigger();
Comment("Respawn Location 3-1");
}

//-----------------------------------------------------------------//

Trigger("Player 1"){
Conditions:
Command("Current Player", "Terran Ghost", Exactly, 0);
Deaths("Current Player", "Alan Schezar (Goliath)", Exactly, 0);
Switch("Switch1", not set);
Switch("Switch2", set);
Switch("Switch3", not set);

Actions:
Create Unit("Current Player", "Terran Ghost", 1, "Respawn Location 1");
Set Switch("Switch1", clear);
Set Switch("Switch2", clear);
Set Switch("Switch3", clear);
Preserve Trigger();
Comment("Respawn Location 1-2");
}

//-----------------------------------------------------------------//

Trigger("Player 1"){
Conditions:
Command("Current Player", "Terran Ghost", Exactly, 0);
Deaths("Current Player", "Alan Schezar (Goliath)", Exactly, 0);
Switch("Switch1", not set);
Switch("Switch2", not set);
Switch("Switch3", set);

Actions:
Create Unit("Current Player", "Terran Ghost", 1, "Respawn Location 2");
Set Switch("Switch1", clear);
Set Switch("Switch2", clear);
Set Switch("Switch3", clear);
Preserve Trigger();
Comment("Respawn Location 2-2");
}

//-----------------------------------------------------------------//

With that being said, do I need to create like, ~8 different triggers per location to complete the cycle of all 3? If theres an easier way to completely randomize this that would be great. Thanks!



None.

Oct 25 2013, 6:26 pm LoveLess Post #2

Let me show you how to hump without making love.

You are missing one.

Code
//-----------------------------------------------------------------//

Trigger("Player 1"){
Conditions:
Command("Current Player", "Terran Ghost", Exactly, 0);
Deaths("Current Player", "Alan Schezar (Goliath)", Exactly, 0);
Switch("Switch1", not set);
Switch("Switch2", not set);
Switch("Switch3", set);

Actions:
Create Unit("Current Player", "Terran Ghost", 1, "Respawn Location 2");
Set Switch("Switch1", set);
Set Switch("Switch2", clear);
Set Switch("Switch3", set);
Preserve Trigger();
Comment("Respawn Location 2-2");
}

//-----------------------------------------------------------------//


That would be the reason this is not working.



None.

Oct 25 2013, 6:37 pm Prophete Post #3



What do you mean, I stated that I hadn't done every trigger needed for this to be complete, and adding just your trigger wouldn't complete the cycle.

Also, in the actions section why would I not clear all switches for the next time I need the function to run? Why would I set certain switches.


I wen't ahead and completed the cycle.

So my question is, is this the most efficient way?

Quote
Trigger("Player 1"){
Conditions:
Deaths("Current Player", "Terran Ghost", Exactly, 1);

Actions:
Set Deaths("Current Player", "Terran Ghost", Set To, 0);
Set Deaths("Current Player", "Alan Schezar (Goliath)", Set To, 96);
Preserve Trigger();
Comment("Start Respawn");
}

//-----------------------------------------------------------------//

Trigger("Player 1"){
Conditions:
Deaths("Current Player", "Alan Schezar (Goliath)", Exactly, 1);

Actions:
Set Switch("Switch1", randomize);
Set Switch("Switch2", randomize);
Set Switch("Switch3", randomize);
Preserve Trigger();
Comment("Start Randomization Of Respawn");
}

//-----------------------------------------------------------------//

Trigger("Player 1"){
Conditions:
Deaths("Current Player", "Alan Schezar (Goliath)", At least, 1);

Actions:
Set Deaths("Current Player", "Alan Schezar (Goliath)", Subtract, 1);
Preserve Trigger();
Comment("Subtract Respawn Timer");
}

//-----------------------------------------------------------------//

Trigger("Player 1"){
Conditions:
Command("Current Player", "Terran Ghost", Exactly, 0);
Deaths("Current Player", "Alan Schezar (Goliath)", Exactly, 0);
Switch("Switch1", not set);
Switch("Switch2", not set);
Switch("Switch3", not set);

Actions:
Create Unit("Current Player", "Terran Ghost", 1, "Respawn Location 1");
Set Switch("Switch1", clear);
Set Switch("Switch2", clear);
Set Switch("Switch3", clear);
Preserve Trigger();
Comment("Respawn Location 1-1");
}

//-----------------------------------------------------------------//

Trigger("Player 1"){
Conditions:
Command("Current Player", "Terran Ghost", Exactly, 0);
Deaths("Current Player", "Alan Schezar (Goliath)", Exactly, 0);
Switch("Switch1", set);
Switch("Switch2", set);
Switch("Switch3", set);

Actions:
Create Unit("Current Player", "Terran Ghost", 1, "Respawn Location 2");
Set Switch("Switch1", clear);
Set Switch("Switch2", clear);
Set Switch("Switch3", clear);
Preserve Trigger();
Comment("Respawn Location 2-1");
}

//-----------------------------------------------------------------//

Trigger("Player 1"){
Conditions:
Command("Current Player", "Terran Ghost", Exactly, 0);
Deaths("Current Player", "Alan Schezar (Goliath)", Exactly, 0);
Switch("Switch1", set);
Switch("Switch2", not set);
Switch("Switch3", not set);

Actions:
Create Unit("Current Player", "Terran Ghost", 1, "Respawn Location 3");
Set Switch("Switch1", clear);
Set Switch("Switch2", clear);
Set Switch("Switch3", clear);
Preserve Trigger();
Comment("Respawn Location 3-1");
}

//-----------------------------------------------------------------//

Trigger("Player 1"){
Conditions:
Command("Current Player", "Terran Ghost", Exactly, 0);
Deaths("Current Player", "Alan Schezar (Goliath)", Exactly, 0);
Switch("Switch1", not set);
Switch("Switch2", set);
Switch("Switch3", not set);

Actions:
Create Unit("Current Player", "Terran Ghost", 1, "Respawn Location 1");
Set Switch("Switch1", clear);
Set Switch("Switch2", clear);
Set Switch("Switch3", clear);
Preserve Trigger();
Comment("Respawn Location 1-2");
}

//-----------------------------------------------------------------//

Trigger("Player 1"){
Conditions:
Command("Current Player", "Terran Ghost", Exactly, 0);
Deaths("Current Player", "Alan Schezar (Goliath)", Exactly, 0);
Switch("Switch1", not set);
Switch("Switch2", not set);
Switch("Switch3", set);

Actions:
Create Unit("Current Player", "Terran Ghost", 1, "Respawn Location 2");
Set Switch("Switch1", clear);
Set Switch("Switch2", clear);
Set Switch("Switch3", clear);
Preserve Trigger();
Comment("Respawn Location 2-2");
}

//-----------------------------------------------------------------//

Trigger("Player 1"){
Conditions:
Command("Current Player", "Terran Ghost", Exactly, 0);
Deaths("Current Player", "Alan Schezar (Goliath)", Exactly, 0);
Switch("Switch1", set);
Switch("Switch2", set);
Switch("Switch3", not set);

Actions:
Create Unit("Current Player", "Terran Ghost", 1, "Respawn Location 3");
Set Switch("Switch1", clear);
Set Switch("Switch2", clear);
Set Switch("Switch3", clear);
Preserve Trigger();
Comment("Respawn Location 3-2");
}

//-----------------------------------------------------------------//

Trigger("Player 1"){
Conditions:
Command("Current Player", "Terran Ghost", Exactly, 0);
Deaths("Current Player", "Alan Schezar (Goliath)", Exactly, 0);
Switch("Switch1", set);
Switch("Switch2", not set);
Switch("Switch3", set);

Actions:
Create Unit("Current Player", "Terran Ghost", 1, "Respawn Location 1");
Set Switch("Switch1", clear);
Set Switch("Switch2", clear);
Set Switch("Switch3", clear);
Preserve Trigger();
Comment("Respawn Location 1-3");
}

//-----------------------------------------------------------------//

Trigger("Player 1"){
Conditions:
Command("Current Player", "Terran Ghost", Exactly, 0);
Deaths("Current Player", "Alan Schezar (Goliath)", Exactly, 0);
Switch("Switch1", not set);
Switch("Switch2", set);
Switch("Switch3", set);

Actions:
Create Unit("Current Player", "Terran Ghost", 1, "Respawn Location 2");
Set Switch("Switch1", clear);
Set Switch("Switch2", clear);
Set Switch("Switch3", clear);
Preserve Trigger();
Comment("Respawn Location 2-3");
}

//-----------------------------------------------------------------//


Post has been edited 1 time(s), last time on Oct 25 2013, 6:46 pm by Prophete.



None.

Oct 25 2013, 6:56 pm jjf28 Post #4

Cartography Artisan

What exactly are you trying to do here? Something like this would help us come up with/explain an optimal system:

- Need X randomized values
- Each value must be between A and B
- This should be completed { immediately / in [T seconds/T trigger cycles] / ASAP (no explicit limit) }



TheNitesWhoSay - Clan Aura - github

Reached the top of StarCraft theory crafting 2:12 AM CST, August 2nd, 2014.

Oct 25 2013, 7:04 pm Prophete Post #5



When X player is killed, a timer is set (96 DC of a unit)
~ 10 Seconds in Hypertrigger time.

Need 3 randomized values, to choose where X unit is spawned when the 96 DC is expired.

This trigger set above works correctly in that, but it requires me to create 8 triggers per player, using different switches. So I was curious if this was doable in a cleaner, more efficient way.



None.

Oct 25 2013, 7:38 pm jjf28 Post #6

Cartography Artisan

So nice to have 96 cycles to work with :D

With that in mind we don't need 3-bits (3 switches), this can be done in two bits (think of 0 as cleared, 1 as set); here's our truth-esque table

Code
Sw1 Sw2 | dest
--------+---------------------
 0   0  | reroll or location 3
 0   1  | location 3
 1   0  | location 2
 1   1  | location 1


In 96 cycles, location 3's initial 25% advantage will be reduced to .2595, in other words, nothing :)

So do something to this effect...

Start Timer

If ( Sw1 is cleared and Sw2 is cleared ), randomize Sw1 and Sw2

Subtract 1 from timer

If ( Sw1 is cleared ), spawn at location 3

If ( Sw1 is set and Sw2 is cleared ), spawn at location 2

If ( Sw1 is set and Sw2 is set ), spawn at location 1

 

Post has been edited 4 time(s), last time on Oct 25 2013, 7:49 pm by jjf28.



TheNitesWhoSay - Clan Aura - github

Reached the top of StarCraft theory crafting 2:12 AM CST, August 2nd, 2014.

Oct 25 2013, 7:49 pm Prophete Post #7



Just to make sure, to "reset system" all I do is set Switch 1 and 2 to Cleared, correct? Since all switches default to cleared?



None.

Oct 25 2013, 7:52 pm jjf28 Post #8

Cartography Artisan

Yes, just clear the switches.

Optimization: Only clear switches that are/could be set, at the time you're clearing them.



TheNitesWhoSay - Clan Aura - github

Reached the top of StarCraft theory crafting 2:12 AM CST, August 2nd, 2014.

Oct 25 2013, 7:55 pm Prophete Post #9



Alright, thanks a lot for the help. If I have any problems i'll be sure to let you know. :)



None.

Oct 27 2013, 7:35 am Azrael Post #10



Quote from Prophete
This trigger set above works correctly in that, but it requires me to create 8 triggers per player, using different switches.
It shouldn't. You're randomizing, checking, and clearing the switches in the same cycle, so you can reuse them for all players.




Oct 27 2013, 1:27 pm Leeroy_Jenkins Post #11



Since you only want 33.33% chance of randomization, and since the trigger fires dependent on when the player's ghost had died, it would be easier to use a deathcount for the randomization. Just have a deathcount that continually counts between 1, 2, and 3. Then, depending on the deathcount's value at the time of respawning, you would respawn at one of the locations. This would require 1 trigger per location, not 8. (Although you could still only use 1 trigger per location with switches, with one of the switch combinations triggering a repick, as jjf described)



None.

Options
  Back to forum
Please log in to reply to this topic or to report it.
Members in this topic: None.
[03:20 am]
Symmetry -- Dang I'm up to 155 minerals gambling really pays off guys
[2026-10-11. : 6:02 am]
Donald -- Samase
[2026-10-09. : 2:53 am]
Mr.BurnLiquid -- Symmetry
Symmetry shouted: I'll check it out this weekend!
Thanks
[2026-10-09. : 2:47 am]
Symmetry -- I'll check it out this weekend!
[2026-10-09. : 2:40 am]
Mr.BurnLiquid -- Symmetry
Symmetry shouted: Another map maker? Damn we really ARE back
I invite you to try out the map I modified. I don't have the creativity to create maps from scratch, but I do have the know-how to modify existing ones; my project is to tweak community campaigns (specifically those with errors—to make them playable.
[2026-10-09. : 2:27 am]
Symmetry -- Another map maker? Damn we really ARE back
[2026-10-09. : 1:51 am]
Mr.BurnLiquid -- Ultraviolet
Ultraviolet shouted: Mr.BurnLiquid actually yeah though I wasn't really saying it to narc on you. It just caught me off guard because I don't usually see it (because it's against the rules) "The avatar may not be bigger than 150x150 pixels". Kinda silly that it relies on users to be well behaved rather than just limiting the dimensions on uploads :lol:
Now that I wanted to change my avatar, the error image is showing up, haha.
[2026-10-09. : 1:34 am]
Mr.BurnLiquid -- Ultraviolet
Ultraviolet shouted: Mr.BurnLiquid actually yeah though I wasn't really saying it to narc on you. It just caught me off guard because I don't usually see it (because it's against the rules) "The avatar may not be bigger than 150x150 pixels". Kinda silly that it relies on users to be well behaved rather than just limiting the dimensions on uploads :lol:
Mr.BurnLiquid
Mr.BurnLiquid shouted: Ultraviolet Thanks; I'm new to the site and a Spanish speaker. I must have missed the part where it was prohibited—I'll change it now.
I invite you to try out a mission I'm modifying from *StarCraft Reversed*; I'm trying to make it more playable and challenging.
[2026-10-09. : 1:33 am]
Mr.BurnLiquid -- Ultraviolet
Ultraviolet shouted: Mr.BurnLiquid actually yeah though I wasn't really saying it to narc on you. It just caught me off guard because I don't usually see it (because it's against the rules) "The avatar may not be bigger than 150x150 pixels". Kinda silly that it relies on users to be well behaved rather than just limiting the dimensions on uploads :lol:
Thanks; I'm new to the site and a Spanish speaker. I must have missed the part where it was prohibited—I'll change it now.
Please log in to shout.


Members Online: lifebot