need help w/ deathcount timer

Post Reply
bajadulce
Terran Dropship Flight Attendant
Terran Dropship Flight Attendant
Posts: 155
Joined: Mon Jun 25, 2007 2:30 pm
Location: Santa Cruz, CA

need help w/ deathcount timer

Post by bajadulce »

Dear gosu CC.org campaign makers:

I need help with implementing a deathcount timer to allow for a small delay (500 milliseconds) after a certain event. I can't use a wait command as this ends up desyncing replays (this is for a stripped melle.trg btw) which are vital to the experience. The game itself doesn't suffer from wait blocks thnx to hypers and the fact that all players are running the same trigs, but the resulting replay does. So the trigs have since been "simplified" to avoid the need for waits. All were able to be removed... except for one:

For this particular event, a player is choosing some options that get carried throughout the game. These options are in the form of researching certain techs. Each choice transpires almost instantly (the train time is set to 1). There are 3 things to choose from 9 choices. Upon choosing your last option, the unit that presents these choices is then removed. The problem is that the hypers are so frickin fast, that sometimes this last choice doesn't get recorded before the unit is removed (the tech doesn't finish researching). I've found that I only need 500 milliseconds to pull this off and have tried to build a simple deathcount timer running independently, but can't seem to get it to work properly. Here is what I've tried:
Spoiler
Trigger("All players"){
Conditions:
... blah blah stop this counter once it is no longer needed.

Actions:
Set Deaths("Current Player", "Ruins", Subtract, 1);
Preserve Trigger();
Comment("Reduce dcount timer by 1");
}

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

Trigger("All players"){
Conditions:
Accumulate("Current Player", At most, 0, ore and gas);
blah blah this is players first time reaching 0 ore and gas....

Actions:
Set Deaths("Current Player", "Ruins", Set To, 9);
Set Deaths("Current Player", "Independent Command Center", Set To, 1);
Comment("Player has selected a race and is human = add small ~ .75 second delay before removing DOC");
}

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

Trigger("All players"){
Conditions:
Deaths("Player 1", "Ruins", At most, 0);
Deaths("Current Player", "Independent Command Center", At least, 1);

Actions:
Set Deaths("Current Player", "Independent Command Center", Set To, 0);
blah blah blah
Comment(".75s delay up. Initiate resources and remove restrictions Player has selected a race and is human");
}

//-----------------------------------------------------------------//
My guess is that the hypers are so fast that the last trigger is firing before the ruins value can be set to 9 thus meeting the 0 condition? Tried to preset the value to 1, but that didn't seem to work. Tried adding an condition that the timer wouldn't be reduced unless the value was set to 9 + presetting the value to 1, but that also seemed to fail? What am I botching up here?

I can build a non-modded test UMS to emulate this process as well if that would help.

>> I'll have to edit later as I don't see a bbcode help button in the editor for spoiler.
Edit: can't seem to find the bbcode help button for spoiler anywhere.. this place could use a shoutbox for shit like this! :)
User avatar
IskatuMesk
Xel'naga World Shaper
Xel'naga World Shaper
Posts: 8332
Joined: Sat Feb 07, 2009 1:40 pm
Location: M͈̙̞͍͞ͅE̹H̨͇̰͈͕͇̫Ì̩̳CO̼̩̤͖͘ జ్ఞ‌ా
Contact:

Re: need help w/ deathcount timer

Post by IskatuMesk »

spoiler code broke on new board pm lav a shitton of times to get it fixed plz
Gameproc
Though we stand alone, stand we shall.
User avatar
Lavarinth
Xel'naga Administrator
Xel'naga Administrator
Posts: 6539
Joined: Wed Aug 16, 2006 5:21 pm
Location: His Ashworld Planet

Re: need help w/ deathcount timer

Post by Lavarinth »

Ugh, fineeeee!
- - Lavarinth
Campaign Creations Administrator
User avatar
Dem0nS1ayer
Terran Science Facility Guinea Pig
Terran Science Facility Guinea Pig
Posts: 210
Joined: Fri Jun 12, 2009 2:35 pm
Location: In a cave on Aiur, hiding from the Zerg

Re: need help w/ deathcount timer

Post by Dem0nS1ayer »

If you want to wait 500 ms, just add the dcs until they get to 6 deaths. 12 deaths = ~1 second. I don't see why you need to set it to 9 deaths. O.o
bajadulce
Terran Dropship Flight Attendant
Terran Dropship Flight Attendant
Posts: 155
Joined: Mon Jun 25, 2007 2:30 pm
Location: Santa Cruz, CA

Re: need help w/ deathcount timer

Post by bajadulce »

ah yes thnx good point. I wrote that 500milliseconds was all that seem needed using a wait command and did in fact try the value 6 originally. The trigs I posted however, was a second attempt in which I increased the value to .75 seconds. I thought maybe I wasn't giving enough time?
Comment("Player has selected a race and is human = add small ~ .75 second delay before removing DOC");
I must have the setup/logic botched tho as any value doesn't appear to be working "properly". It isn't working properly in that sometimes there is a small delay and all is good in the world, but other times the trig fires instantly and am thus robbed of my final selection. For now, I've stuck the wait(500) back in the triggers and just make sure not to speed up any replays until after this event (beginning of game actually) takes place. After that you're good to speed it up all you want as this trigger isn't recycled.

I'll try to build a simple test map in which a death counter removes the CC after the first SCV is built. I wanted to do this last night, but got busy playin some mods w/ ppl from forum. :) I'll try to get something up soon tho to simplify things. Thnx for the support and heads up on the timer values.
bajadulce
Terran Dropship Flight Attendant
Terran Dropship Flight Attendant
Posts: 155
Joined: Mon Jun 25, 2007 2:30 pm
Location: Santa Cruz, CA

Re: need help w/ deathcount timer

Post by bajadulce »

My guess is that the hypers are so fast that the last trigger is firing before the ruins value can be set to 9 thus meeting the 0 condition?
After some more testing, this seems to be the main issue.
To combat this zero value, I tried adding a condition that the timer wouldn't be reduced unless the value was set to 9 + presetting the value to 1, but that also seemed to fail?
haha. that failed because my trig was setup like this:

Code: Select all

Conditions:
Deaths("Current Player", "Ruins", At least, 9);
Actions:
Set Deaths("Current Player", "Ruins", Subtract, 1);
Preserve Trigger();
... and once the deaths hit 8 it was the last time the trig was ran.


So I changed that to something like this for a test map:

Code: Select all

..Always
Actions:
	Set Deaths("All players", "Cantina", Set To, 1);
//-----------------------------------------------------------------//
Conditions:
	Deaths("Current Player", "Cave", At least, 1);
Actions:
	Set Deaths("Current Player", "Cantina", Subtract, 1);
	Preserve Trigger();
//-----------------------------------------------------------------//
Conditions:
	Accumulate("Current Player", At most, 0, ore and gas);
Actions:
	Set Deaths("Current Player", "Cantina", Set To, 6);
	Set Deaths("Current Player", "Cave", Set To, 1);
//-----------------------------------------------------------------//
Conditions:
	Deaths("Current Player", "Cave", At least, 1);
	Deaths("Current Player", "Cantina", At most, 0);
Actions:
	Kill Unit("Current Player", "Terran Command Center");
And all seems to be good. Will have to try it out on the real deal later tonight. Hopefully this did the trick.

Here's the quick sample test map I made if interested or have a suggestion for a better method.
deathcounter_v1.0.scm
You do not have the required permissions to view the files attached to this post.
Post Reply