Wav. problem

F

Fury-hawk

Guest
:( I'm having a problem with something that should be easy but doesn't seem to work.
All I wish to do is : when force 1 kills (X) of any unit, create (X) amount of units at a loc., then play a wav, and have the units attack another loc. But, I wish this to happen EVERYTIME force 1 kills (X) amount of units.

Condition :Force 1 kills (x) amount of units

Action: wait (X) millisec.
play wav.
create (X)amount of units for Force 2 at loc. (X)
All of any uint at loc (X) (attack) all of any unit at loc.(X2)
owned by force 1
Preserve Trig.


The thing is, it either, creates unlimited amounts of (say zerglings) till it can't fit no more in the loc. or, plays the wav over and over,or sometimes it only makes the units and they just stand there. All I want is when the player, kills 5 units, then play a wav, and a then 5 new units attack them, and for this to remain constant thoughout the scenario.
Please... what am I doing wrong, is it the preserve trig, or to many actions for one trig. to run. I be grateful for any help! :)
 

Ilendil

Most Respected Former Admin
Reaction score
1
Sigh.... this is the same problem kills to resources many, many people have... search the forums if you can't understand the explanation. (It's going to be pretty long)

Copied from Campaign Creations

RESOURCES FOR KILLS

The question: Is it possible to have a player receive a specific amount of minerals/gas for each specific kill he or she gets? The answer: Yes, of course. Frankly, the reason why so many people don't seem to know this simple method yet eclipses me. The very fact is: everyone knows that you have a specific calculation of the "points" you get from each kill with the Kills Score. Yet, everyone seems to forget about that, and goes through all these strange methods involving hundreds of redundant unit-to-unit triggers that don't even work in all cases. Why? I dunno. But here is the easy way to do it:

The idea is to utilize the Kills Score (what we all know and love =) and transfer it directly to the minerals/gas "score." Here is the base trigger:

Owner:
- Player 1
Conditions:
- Current player Kills score is at least 1.
Actions:
- Modify score for Current player: Subtract 1 Kills.
- Modify resources for Current player: Add 1 Ore.
- Preserve trigger.

That little trigger will do the trick. It's rather elementary: for every 1 Kill point, the player will get 1 mineral. Because it is continuous (preserved), it will keep doing this until all the Kill points are turned into minerals. Simple as that. However, while this single trigger will function correctly and without exception, it will work very, very slowly since Starcraft only checks triggers every 2 seconds. That means it will transfer 1000 Kill points into 1000 minerals, but at the rate of 1 mineral every 2 seconds. Probably not what you desired.

But, expanding this simple trigger idea just a little and we can make the transfer occur in no time. First, instead of the trigger above, make the following:

Owner:
- Player 1
Conditions:
- Current player Kills score is exactly 1.
Actions:
- Modify score for Current player: Subtract 1 Kills.
- Modify resources for Current player: Add 1 Ore.
- Preserve trigger.

Then make:

Owner:
- Player 1
Conditions:
- Current player Kills score is at least 2.
- Current player Kills score is at most 3.
Actions:
- Modify score for Current player: Subtract 2 Kills.
- Modify resources for Current player: Add 2 Ore.
- Preserve trigger.

Now, follow this pattern…

Owner:
- Player 1
Conditions:
- Current player Kills score is at least X.
- Current player Kills score is at most Y.
Actions:
- Modify score for Current player: Subtract X Kills.
- Modify resources for Current player: Add X Ore.
- Preserve trigger.

… for X-Y combinations of 4-7, 8-15, 16-31, 32-63, 64-127, 128-255, 256-511, and 512-1023. And lastly make this trigger:

Owner:
- Player 1
Conditions:
- Current player Kills score is at least 1024.
Actions:
- Modify score for Current player: Subtract 1024 Kills.
- Modify resources for Current player: Add 1024 Ore.
- Preserve trigger.

This is a grand total of 11 triggers -- and that's all you'll need. If you don't already see where these triggers are going, let me explain. They are all essentially the same as the base trigger at the top, but split up the job of transferring the Kill points to minerals. For example, let's say a player has 1987 Kill points at one instant. Then:

First, the 1024 trigger initiates, subtracting 1024 Kills and leaving 963.
Now, the 512-1023 trigger initiates, subtracting 512 and leaving 451.
Next, the 256-551 trigger initiates, subtracting 256 and leaving 195.
Then, the 128-255 trigger initiates, subtracting 128 and leaving 67.
Now, the 64-127 trigger initiates, subtracting 64 and leaving 3.
Next, the 2-3 trigger initiates, subtracting 2 and leaving 1.
Finally, the 1 trigger initiates and transfers the last 1.
Because they are all separate triggers, they can all initiate at the same time, and thus our 1987 Kill points are turned into 1987 minerals instantly. (It may be proper to make the triggers backwards -- starting with 1024 and working your way to 1 -- since Starcraft likes to check triggers in order and you want the "larger" ones to initiate first) This system is elegantly simple, and yet, very effective.

Now that you understand what is going on, you may be asking, "But what if the player has more than 1024 Kill points -- like 50,000? Won't the 1024 trigger have to initiate more than once?" Well, yes, it does. However, there are two major reasons why you don't need to make triggers for scores above 1024. First of all, it is very unlikely that a player will accumulate something like 50,000 points in two seconds (the time between trigger checks and activation). Second, the mineral count takes about 2 seconds to go up 1000 points any ways, so the flow of incoming minerals would appear smooth even if it had to initiate the 1024 trigger multiple times.

If you wish to include Razing points, just use the Kills and Razings Score instead. And of course you realize that the owners of these triggers can be altered to suit your needs. =) Hope that helps.

DI
March 10, 1999
 
G

Guest

Guest
i did exactly as u said:

Owner:
- Player 1
Conditions:
- Current player Kills score is at least 1.
Actions:
- Modify score for Current player: Subtract 1 Kills.
- Modify resources for Current player: Add 1 Ore.
- Preserve trigger.

and even if i have only 1 kill, the resources keep on increasing.
 

Ilendil

Most Respected Former Admin
Reaction score
1
Thats because kills are the points a units give.

I.E. a Marine is 100 kills and Zerglings at 50 kills.
 
F

Fury-hawk

Guest
Thank-you

Thank you for the assistance, sorry didn't mean to bring up a problem that was similar to theother problem, I did read the other threads and saw that people were borthering you guys with the min. problem. I had know idea mine was the same thing, didn't mean to upset anyone ;). I will try to be more careful of my questions in the future. As for the problem, well I try to follow all you said, but I still had some problems. pretty much the same as the unregistered guys reply was, it keeps making more and more.
So it seem easy to one degree and complex to another. So I just decided to drop the idea.
But don't get me wrong I truely thank you for the help! I just found another way to go about it. Not quite the same but it works!
I simply set it to create (x) units at a loc.
Order them to attack another loc.
and wait like 100000 milli secs
then preserved it.

This make them, has them attack, and repeats it every so often :)
But once again thanks!
 
General chit-chat
Help Users
  • No one is chatting at the moment.

      The Helper Discord

      Staff online

      Members online

      Affiliates

      Hive Workshop NUON Dome World Editor Tutorials

      Network Sponsors

      Apex Steel Pipe - Buys and sells Steel Pipe.
      Top