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.
[2024-4-27. : 9:38 pm]
NudeRaider -- Ultraviolet
Ultraviolet shouted: NudeRaider sing it brother
trust me, you don't wanna hear that. I defer that to the pros.
[2024-4-27. : 7:56 pm]
Ultraviolet -- NudeRaider
NudeRaider shouted: "War nie wirklich weg" 🎵
sing it brother
[2024-4-27. : 6:24 pm]
NudeRaider -- "War nie wirklich weg" 🎵
[2024-4-27. : 3:33 pm]
O)FaRTy1billion[MM] -- o sen is back
[2024-4-27. : 1:53 am]
Ultraviolet -- :lol:
[2024-4-26. : 6:51 pm]
Vrael -- It is, and I could definitely use a company with a commitment to flexibility, quality, and customer satisfaction to provide effective solutions to dampness and humidity in my urban environment.
[2024-4-26. : 6:50 pm]
NudeRaider -- Vrael
Vrael shouted: Idk, I was looking more for a dehumidifer company which maybe stands out as a beacon of relief amidst damp and unpredictable climates of bustling metropolises. Not sure Amazon qualifies
sounds like moisture control is often a pressing concern in your city
[2024-4-26. : 6:50 pm]
Vrael -- Maybe here on the StarEdit Network I could look through the Forums for some Introductions to people who care about the Topics of Dehumidifiers and Carpet Cleaning?
[2024-4-26. : 6:49 pm]
Vrael -- Perhaps even here I on the StarEdit Network I could look for some Introductions.
[2024-4-26. : 6:48 pm]
Vrael -- On this Topic, I could definitely use some Introductions.
Please log in to shout.


Members Online: jjf28