Staredit Network

Staredit Network -> UMS Assistance -> Binary System.
Report, edit, etc...Posted by Laser_Dude on 2006-08-27 at 17:17:36
I currently have a binary system in the map I'm making that involves giving a certain amount of gas to a player every second depending on how many power plants he has.

If he has 1 he gets 1 gas
If he has 2 he gets 2 gas
and so on...

I used a binary countoff system in which, it gives the plants to P8 so that it won't detect them in the next trigger.

I believe it's still detecting them, even though they belong to P8.
I'll update with more info in a few secs, the trigs are on my other comp.

UPDATE: here are the trigs


Trigger
Description:
trigger 1
Players:
¤ Player 1
Conditions:
¤ Command(P1, AtLeast, 2, Power Plant);
Actions:
¤ SetResources(P1, Add, 2, Gas);
¤ GiveUnits(2, Power Plant, P1, Anywhere, P8);
¤ PreserveTrigger();
¤ Wait(1000);
¤ Comment(" ");



Trigger
Description:
trigger 2
Players:
¤ Player 1
Conditions:
¤ Command(P1, AtLeast, 1, Power Plant);
Actions:
¤ SetResources(P1, Add, 1, Gas);
¤ GiveUnits(1, Power Plant, P1, Anywhere, P8);
¤ PreserveTrigger();
¤ Wait(1000);
¤ Comment(" ");


I have doubling numbers above those too, those are letter for letter(copy-and-paste) from starforge.
I also have one more trigger at the end of the list


Trigger
Description:
Return Power Plants
Players:
¤ Player 1
Conditions:
¤ Always();
Actions:
¤ GiveUnits(All, Power Plant, P8, Anywhere, P1);
¤ PreserveTrigger();
¤ Comment("Return Power Plants");


still letter for letter.

NOTE: It seems to be alternating between 2 and 3 when I get 2 power plants. I don't know why.

I also have numerous other triggers in the mix that might be messing with it.
Report, edit, etc...Posted by Kenoli on 2006-08-27 at 17:46:55
There is no point in having a wait at the end of the actions list. The only possible thing that can do is cause wait blocks.
Report, edit, etc...Posted by fritfrat(U) on 2006-08-27 at 17:47:55
Use "Brings atleast 2 Power Plant to Anywhere" instead of Command. Command doesn't update until the end of the trigger cycle.

EDIT: And listen to Ken, take out those waits.
Report, edit, etc...Posted by PCFredZ on 2006-08-27 at 19:39:46
You should take some steps to ensure that gas is given properly if the player had more Power Plants than the maximum number you made via trigger.

For the very first trigger (with the biggest number) you should modify the Command condition so that it uses At Least instead of Exactly.

For the very last trigger (giving back) you should add a condition If P1 Commands 0 Power Plants.

If fritfrat's right then you'd want to change Command to Bring as well but I can't vouch for him.
Report, edit, etc...Posted by MoonlighTurtle on 2006-08-27 at 19:54:33
QUOTE(fritfrat(U) @ Aug 27 2006, 04:47 PM)
Use "Brings atleast 2 Power Plant to Anywhere" instead of Command. Command doesn't update until the end of the trigger cycle.

EDIT: And listen to Ken, take out those waits.
[right][snapback]552052[/snapback][/right]


What gave you the idea that command doesn't update until the end of a trigger cycle?

I even did a test with three triggers:
QUOTE
Always
Create 10 marine
Preserve

Commands 10 marines
Display message
Preserve

Always
Remove 10 marine
Preserve


And sure enough, the message displayed.

Hmm, this is odd, I did a more extensive test creating 10 more marines and trying to detect those, but it seems like it didn't.
Report, edit, etc...Posted by Urmom(U) on 2006-08-27 at 20:07:45
I've heard that command doesn't update either. I think it's if units are killed, not created. Here's where I learned it from.

http://www.staredit.net/index.php?tutorial=4
Report, edit, etc...Posted by Kenoli on 2006-08-27 at 20:18:33
QUOTE(urmom)
I've heard that command doesn't update either. I think it's if units are killed, not created. Here's where I learned it from.

http://www.staredit.net/index.php?tutorial=4
When a unit is killed by a trigger, it dosen't really "die" untill the trigger cycle is over.
If you create a marine, kill it, and check to see if it's still there, it will be.
His trigger don't have any kill triggers, though, so it's not exactly on topic.
That tutorial really could use some... linebreaks.
Report, edit, etc...Posted by MoonlighTurtle on 2006-08-27 at 20:24:17
I think it's a little more complicated than that. I'm getting weird results through the testing of these triggers:

QUOTE
Trigger("Player 1"){
Conditions:
Always();

Actions:
Create Unit("Player 1", "Terran Marine", 10, "Anywhere");
Set Switch("Switch0", set);
Display Text Message(Always Display, "first");
}

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

Trigger("Player 1"){
Conditions:
Command("Current Player", "Terran Marine", Exactly, 10);
Switch("Switch0", set);

Actions:
Display Text Message(Always Display, "command 10");
}

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

Trigger("Player 1"){
Conditions:
Always();

Actions:
Remove Unit At Location("Current Player", "Terran Marine", All, "Anywhere");
}

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

Trigger("Player 1"){
Conditions:
Always();

Actions:
Create Unit("Player 1", "Terran Marine", 10, "Anywhere");
}

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

Trigger("Player 1"){
Conditions:
Bring("Current Player", "Terran Marine", "Anywhere", Exactly, 10);
Switch("Switch0", set);

Actions:
Display Text Message(Always Display, "bring 10");
}

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

Trigger("Player 1"){
Conditions:
Command("Current Player", "Terran Marine", At least, 12);
Switch("Switch0", set);

Actions:
Display Text Message(Always Display, "command at least 12");
}

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

Trigger("Player 1"){
Conditions:
Always();

Actions:
Remove Unit At Location("Current Player", "Terran Marine", All, "Anywhere");
Set Switch("Switch0", clear);
Display Text Message(Always Display, "last");
}

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


It displays

QUOTE
first
command 10
bring 10
command at least 12
last


It's like it's updating sometimes.

I believe it's that command doesn't update when units are removed. A more specific test needs to be done to prove this.

A further test seems to verify this theory, here's the triggers:
QUOTE
Trigger("Player 1"){
Conditions:
Always();

Actions:
Create Unit("Player 1", "Terran Marine", 1, "Anywhere");
Display Text Message(Always Display, "first");
}

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

Trigger("Player 1"){
Conditions:
Always();

Actions:
Remove Unit At Location("Current Player", "Terran Marine", All, "Anywhere");
}

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

Trigger("Player 1"){
Conditions:
Command("Current Player", "Terran Marine", Exactly, 1);

Actions:
Display Text Message(Always Display, "command exactly 1");
}

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

Trigger("Player 1"){
Conditions:
Always();

Actions:
Display Text Message(Always Display, "last");
}

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


The result was the following output:
QUOTE
first
command exactly 1
last


And to make sure, I substituted the command with bring, and only "first" and "last" was displayed.

Now the output of these next triggers is interesting:
QUOTE
Trigger("Player 1"){
Conditions:
Always();

Actions:
Create Unit("Player 1", "Terran Marine", 1, "Anywhere");
Display Text Message(Always Display, "first");
}

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

Trigger("Player 1"){
Conditions:
Always();

Actions:
Remove Unit At Location("Current Player", "Terran Marine", All, "Anywhere");
}

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

Trigger("Player 1"){
Conditions:
Always();

Actions:
Create Unit("Player 1", "Terran Marine", 2, "Anywhere");
Display Text Message(Always Display, "create 2");
}

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

Trigger("Player 1"){
Conditions:
Command("Current Player", "Terran Marine", Exactly, 2);

Actions:
Display Text Message(Always Display, "command exactly 2");
}

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

Trigger("Player 1"){
Conditions:
Command("Current Player", "Terran Marine", Exactly, 3);

Actions:
Display Text Message(Always Display, "command exactly 3");
}

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

Trigger("Player 1"){
Conditions:
Always();

Actions:
Display Text Message(Always Display, "last");
}

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


The output is
QUOTE
first
create 2
command 3
last
command 2


This shows that even though 1 marine was created and removed, and 2 more were created, within that trigger cycle, command will take the total, 3, and not take into account that 1 marine was removed.

The "command 2" output is in the next trigger cycle.
Report, edit, etc...Posted by fritfrat(U) on 2006-08-27 at 21:09:18
Very nice research, moonlight.

In the end, though, if he changes it to Bring to Anywhere, there won't be a problem.
Report, edit, etc...Posted by PCFredZ on 2006-08-27 at 21:42:04
Moonlight, did you create your triggers in the exact same order as you typed?

That is, you didn't have to use Move Up or Move Down at all.
Report, edit, etc...Posted by MoonlighTurtle on 2006-08-27 at 21:48:29
Yes, that is the trigger order. I made sure the triggers were checked in the order I wanted. Hence the lack of preserves, and text output for most of the triggers, including the first and last triggers.
Report, edit, etc...Posted by Laser_Dude on 2006-08-27 at 22:05:26
QUOTE(Kenoli @ Aug 27 2006, 02:46 PM)
There is no point in having a wait at the end of the actions list. The only possible thing that can do is cause wait blocks.
[right][snapback]552049[/snapback][/right]


I wanted it to give one mineral every second, if I took the wait out, I would get gajillions(probably not a real number) of resources very quickly(actually 12 times as much as I want).

I'll check the bring thing.
Report, edit, etc...Posted by PCFredZ on 2006-08-27 at 22:15:09
QUOTE(laser_dude @ Aug 27 2006, 10:05 PM)
I wanted it to give one mineral every second, if I took the wait out, I would get gajillions(probably not a real number) of resources very quickly(actually 12 times as much as I want).

I'll check the bring thing.
[right][snapback]552204[/snapback][/right]

The problem is that you could easily get the waits to stack and your triggers to go out of wack, so you should definitely use death counters or the countdown timer (assuming the countdown has no other use).
Report, edit, etc...Posted by Laser_Dude on 2006-08-27 at 23:01:03
I don't need any other waits for the specific player, and I figured simpler is better. It's definately not a problem with waits, The gas is coming in at the right intervals, just not the right amounts.

It seems to be alternating between 2 and 3 gas (when I have 2 plants).

I'll upload the map.

Report, edit, etc...Posted by Kenoli on 2006-08-28 at 00:09:08
QUOTE(laser_dude)
It's definately not a problem with waits
You clearly don't understand how waits work.
Using a death count timer would be appropriate.
Report, edit, etc...Posted by Laser_Dude on 2006-08-28 at 01:17:43
QUOTE(Kenoli @ Aug 27 2006, 09:08 PM)
QUOTE(laser_dude)
It's definately not a problem with waits
You clearly don't understand how waits work.
Using a death count timer would be appropriate.
[right][snapback]552247[/snapback][/right]


after re-reading my post and thinking about it for a few minutes, I realized that my multiple triggers (my binary system) may be screwing up my triggers, you're all probably right. I'll fix it in the morning. But it still should only be firing one trigger with 2 plants, I'll have a look at it.

Actually, they may be overlapping, causing both to fire. I've delt with waits numerous times, they're simple, but I hate all the overlapping stuff. As I said, I'll deal with this in the morning.
Report, edit, etc...Posted by Tuxedo Templar on 2006-08-28 at 09:10:02
Might have been answered, but you'll want to use a binary countoff for all Plants for each player, add gas for each, then (with hyper triggers in effect) wait 12 trigger loops by setting an invisible counter to 12, and using a seperate trigger to subtract it by 1 for each trigger loop. Repeat the countoff when it hits 0.
Report, edit, etc...Posted by Laser_Dude on 2006-08-28 at 18:39:51
QUOTE(Tuxedo Templar @ Aug 28 2006, 06:09 AM)
Might have been answered, but you'll want to use a binary countoff for all Plants for each player, add gas for each, then (with hyper triggers in effect) wait 12 trigger loops by setting an invisible counter to 12, and using a seperate trigger to subtract it by 1 for each trigger loop.  Repeat the countoff when it hits 0.
[right][snapback]552408[/snapback][/right]


I did this, and for some strange reason, the gas stopped giving altogether. It lags at startup (cause starforge lags my verrrrry slow comp), and I end up with 3 gas. (using 2 power plants)

EDIT: fixed that problem, it was trigger order. New problem, instead of giving 2 gas each time, it gives three, so I'm thinking it has to do with what I thought it did originally.

ADDITION: I just realized, if I put each trigger on a countdown beat, then give them all back on the next "beat" I might be able to fix this, e.i. check one on 9,8,7...

ADDITION: It worked!!! It must've been the trigger not detecting the unit that was given. Thank you all for your help

>>Topic [not] Locked

ADDITION: How do you lock topics and give them that "solved" icon?

ADDITION: Found new problem, I am using a similar system for my power batteries, except instead of firing every second, they fire every "beat", a death count system fixed the problem of waits and of ownership, 2 birds with one stone, but now I've only got one bird to kill.

ADDITION AGAIN: Problem solved, but I still don't know how to lock this
Next Page (1)