Staredit Network

Staredit Network -> UMS Assistance -> for every unit u control
Report, edit, etc...Posted by r[s]t on 2005-06-03 at 17:14:52
lets say....


for every marine i have at a certain location, i get 2 mins for every marine every while


how do i do that? easily weith out lots of complex trigs?
Report, edit, etc...Posted by KiLLeR2001 on 2005-06-03 at 17:26:01
The simplest way:

Player brings X amount of UNIT at LOCATION
--
Modify resources for Player add 2 minerals
Wait X amount of milliseconds
Preserve Trigger

However be cautious, having a wait run continuously could interfere with other waits in your map.
Report, edit, etc...Posted by The_Shattered_moose on 2005-06-03 at 17:32:27
Ok, this system should be fairly simple if you understand physical timers
Trigger
Players:
¤ Player with marines
Conditions:
¤ Current player brings at most/least(depends on what you want) 1 marine to "money place"
¤ Current player brings 1 whatever unit to physical timer end
Actions:
¤ Modify resources for player 1, add 2 minerals
¤ Teleport(move) 1 whatever unit to physical timer start
¤ Order 1 whatever unit to move to physical timer end
¤ preserve trigger

More information on physical timers can be found in this tutorial
However, if you want to measure the number of marines at a location, it gets a bit trickier, as you would either have to write triggers for every possible number of marines, so it would be the same trigger as above, except with differnt mineral amounts for different numbers of marines.
Report, edit, etc...Posted by Heimdal on 2005-06-03 at 18:58:39
Uh...None of these are really great solutions.

Assuming that you can live with the marines changing owners for a very short time (it will be unnoticeable, but if you have them selected you will lose the selection), here is a good way to do it:

Trigger
Conditions:
¤ Current Player brings at least 128 marines to some location
Actions:
¤ Give 128 marines for current player at some location to player 12
¤ Set resources for current player: add 256 minerals
¤ Preserve Trigger


Trigger
Conditions:
¤ Current Player brings at least 64 marines to some location
Actions:
¤ Give 64 marines for current player at some location to player 12
¤ Set resources for current player: add 128 minerals
¤ Preserve Trigger



...Repeat, while halving the number of minerals and marines, until you get to 1 marine and 2 minerals. Finally,

Trigger
Conditions:
¤ Current Player brings exactly 0 marines to some location
Actions:
¤ Give all marines for player 12 at some location to current player
¤ Preserve Trigger



This set of triggers will run once every normal trigger cycle (2 game seconds). Hyper triggers will make it go a lot faster, in which case you'll probably want to add some kind of timing condition. If you're going to have several players that you want this to execute for (in the same location), you will have to modify this a bit. You can either supply one "extra" player for each human player in the game, or implement an indicator of the current player you're "counting" for, and increment that. I'd recommend the latter. If you need help doing that, just let me know.

One bonus of using player 12 is that when you give your units to it, the unit's color doesn't change, so it's even harder to tell that the owner changed.
Report, edit, etc...Posted by in_a_biskit on 2005-06-03 at 20:52:07
Heimdal's method would be quite good if the exchange from the human to p12 and back to human didn't happen every trigger cycle. Currently, the marines change ownership at least every 2 game seconds, making the marines essentially impossible to control, since every trigger cycle all marines at the location will be deselected. To fix this, you would probably use a death-counter timer that restricted the triggers from running so often.

The "simplest" way (the method that is easiest to understand) of counting the number of marines at a location is to make a trigger for each possible number of marines. This is the method that Killer2001 was proposing.
The "simplest" way of making triggers run slower than once every trigger cycle is to use a wait action:

Trigger
Conditions:
¤ Current Player brings exactly X marines to 'location'.
Actions:
¤ Modify resources for Current Player: Add 2X ore.
¤ Wait 10000 milliseconds.
¤ Preserve Trigger.

Make one of these triggers for each value of X from 1 up to the maximum number of marines in the location.

The "simplest" way also happens to be quite an inefficient method, because you may require over two hundred triggers just to achieve what you want to achieve. It can be reduced if you're happy to settle for giving minerals for the number of marines being in a small range, rather than being 'exactly' each number. This method is also dodgy because the wait action: (i) doesn't stop the other triggers from firing, but (ii) will stop any other wait actions from running for the same player whilst it is running.
A slightly better (but still considered newbish) method is to use a countdown timer instead of a wait action.
A better still but more difficult-to-understand method would be to implement a death counter timer. Check the tutorials.

An interesting solution would be to use the "command the most at" condition.
This would involve counting off each marine by creating one for the computer at the same location until the computer controlled just as many marines as the human player did - so commands (equally) the most marines at the location - and so for each marine created, you would give the human 2 minerals. Then remove all marines for the computer player.
Trigger
Conditions:
¤ Computer Player commands the least marines at 'location'.
¤ [Whatever conditions on the timing of these triggers]
Actions:
¤ Create 1 marine for Computer Player at 'location'.
¤ Modify resources for Human Player: Add 2 ore.
¤ Preserve trigger.

Copy the above trigger as many times as the maximum number of marines at the location will be, and then make:

Trigger
Conditions:
¤ Computer Player commands the most marines at 'location'.
Actions:
¤ Remove all marines for Computer Player at 'location'.
¤ Modify resources for Human Player: Subtract 2 ore.
¤ [Restart whatever timing action you're using]
¤ Preserve trigger.

We have to subtract 2 minerals because we've actually counted one more marine than there actually is at the location.

Even this method is quite restricted, because it would be hard to find enough space to fit both the computer's and human's marines in the same location.
Report, edit, etc...Posted by Urmom(U) on 2005-06-04 at 13:29:02
you may want to rethink your 10 second wait biskit. id use something sort of like heimdals.
Report, edit, etc...Posted by in_a_biskit on 2005-06-06 at 06:41:46
Did you read the notes I wrote on why wait actions are dodgy and on other timing methods at the end of my explanation of that method, or the second method that I proposed?

(Yes, I agree that in this situation I would not use a wait action)
Report, edit, etc...Posted by Ultimo on 2005-06-06 at 10:07:36
I think using the countdown timer combined with Heimdal's method would be most efficient and useful in this situtation.
Report, edit, etc...Posted by Heimdal on 2005-06-06 at 12:41:04
I wouldn't use a countdown timer unless you want the players to see how much time is left until they get minerals. This would be especially bad if the timing was less than 10 seconds or so. A death counter timer would probably be your best timing solution.
Report, edit, etc...Posted by PhoenixRajoNight on 2005-06-06 at 20:37:29
Death Counter, its all you need and all ull ever need for timing, never use wait in any trigger with preserve unless its the only wait trigger and u dont mind the rest of your triggers waiting to go with it, or do non waited triggs still go, i dunno cant remember but once i found out about how stupid the wait trigger is, ive never looked back, well except for hypertriggers, which i still have no clue y they work, but w/e, I have a death counter timer for my minerals in my map, because i have hypertriggers and i want them to get 3 mins per sec not 12 at the least, so my suggestion is that, is to use death counters, unless its longer than 30 secs, then id just say use a countdown timer, like in diplo.
Report, edit, etc...Posted by r0botluv on 2005-06-06 at 22:08:09
going off of Hemidals idea, couldn't you just move the marines to a different location instead of switching their control?

btw, thats a brilliant system, counting down and all...
Report, edit, etc...Posted by Ultimo on 2005-06-07 at 00:48:04
The system + countdown timer is reliant on times more then 10 seconds, so I suppose. How would you differenate the player 1 units given to p12 then the player 2 units given to p12?
Report, edit, etc...Posted by in_a_biskit on 2005-06-07 at 03:56:06
QUOTE(DevliN_ @ Jun 7 2005, 02:48 PM)
The system + countdown timer is reliant on times more then 10 seconds, so I suppose. How would you differenate the player 1 units given to p12 then the player 2 units given to p12?
[right][snapback]228543[/snapback][/right]

What's interesting is that Heimdal's triggers, as he as written them, probably don't need any modification at all to accomodate more players!
The reason is that if we make enough triggers to account for the maximum number of marines that will fit in the location, then the triggers will run and finish within one trigger cycle, meaning that no two players will conflict on the p12 marines - because they never see p12 marines that aren't from their own marines.
This happens because the triggers are run player by player; Player 1 will run the whole trigger list and will recieve minerals, as well as resetting any marines that he gave to p12. Then player 2 will run the trigger list and recieve minerals in the same way. He never knows that there were p12 things in the location before he ran the triggers because he never sees them.

If you don't like that, then you could always use another player (p9-11); or have some mechanism to let you know which player you are currently processing such as a death counter.

R0botluv: Moving the marines isn't a bad idea, but every time the triggers occur, the marines would get teleported to the middle of the location.


[center]I challenge everyone to come up with a system that will allow for the maximum control of the marines - that will not deselect them, or move them, or cause them to stop moving - yet takes the least triggers and is always reliable.[/center]
Next Page (1)