Suprise Attack

MissKerrigan

Active Member
Reaction score
23
Hi guys,

I am a little embarrassed to ask so many things here but it seems the only way to figure things out :)

I made 6 diffirent trigger actions:

1. Create 6 hydralisks
2. Create 12 zerglings + 4 banelings
3. Create 8 mutalisks
4. Create 2 ultralisks
5. Create 8 roaches
6. Create 2 broodlord + 4 corruptors

You might ask yourself, what's the meaning of this well I tell you :)
I made a game where the computer attacks you at certain times
The computer must select 1 of this random groups above here when attacking you

For the start of the game, the computer must attack you after every 3 minutes
But later in game (15 minutes) the computer must come every 2 minutes and finaly he comes every minute! (25 minutes)

There is 1 exeption! the computer may not attack with the broodlords or the ultralisks the first 15 minutes!

There is also a protoss base which attacks you several times with random units
But I think when I understand the zerg random attacks I'll be able to create the protoss attacks too

It's probaly something simple again but can somebody help me with this?

MissKerrigan
 

Epicurus

New Member
Reaction score
1
I wouldn't use 6 different triggers. There is a way to do it better. When I get home I'll look for a map where I did something similar to this. It was a long time ago and more complex so I can't remember it off the top of my head.
 

Kyuft

Member
Reaction score
11
IN THE PROCESS OF BEING EDITED!
I'm not at home, so I do not know the exact names for the trigger options, but I think you'll get the point.
First, we need to make a variable with type: timer. Leave the default setting empty. We also need a variable with type: boolean. Set the default to false.
Now, we need to make a trigger that starts this timer.
Trigger:
  • Trigger
    • Events
      • Map Initialization
    • Local Variables
    • Conditions
    • Actions
      • Set Variable (The timer) One Shot 900

Next, we need to make a trigger that sets the boolean variable to true if the timer ends.
Trigger:
  • Trigger
    • Events
      • Timer (the one we made) expires.
    • Local Variables
    • Conditions
    • Actions
      • Set variable (the boolean one) true.

Now, edit your spawning trigger actions to look like this:
Trigger:
  • Actions
    • If
      • Variable (boolean one) = true
    • Then
      • (All of the actions you originally had that choose units and spawn them)
    • Else
      • (Same as the above, but don't include the choice of broodlords or ultralisks)


-Kyuft:shades:
 

MissKerrigan

Active Member
Reaction score
23
I still don't get the use of variables... I create a new variable, select type to 'timer' that's it? What's exactly is the use of this?

I also don't find where I can select a random action 1 of my 6 I made to let the units come
 

Kyuft

Member
Reaction score
11
Yes, you are correct about the variables. In this case, we do not need to set a default for the variable. In the trigger, we set the variable as an integer, boolean, etc. The variable starts off meaning nothing. Once we assign something to it using triggers, it saves that integer or boolean etc. Therefore, we can reference it later on. The whole point of a variable is to save a a bit of data.
I do not know how to randomly pick an action though.

-Kyuft:shades:
 

MissKerrigan

Active Member
Reaction score
23
I think I understand a bit of the variables but still don't get the next thing:

I remember I tried to make a trigger where you hero kills 10 units and you earn a mineral bonus (every 10 kills = 10 ore)

So I have to make a variable here type 'unit' but impossible to select 'nova' (hero) anywhere?
I must make a trigger event: 'nova kills 10 units' which I cannot find anywhere?
Action: modify player resourses add 10 minerals
Action: repeat trigger?

Help me with this pls I want the player earns 10 ore every 10 units nova kills
Is this possible without any variable pls?
 

Kyuft

Member
Reaction score
11
Enerything is correct, but why do you need to repeat it? The trigger will happen everytime nova gets 10 kills. The way you have to do the event is, you have to make the event Any unit kills another unit. Then, make a comparison condition that says, unit type of unit: killing unit = nova.

-Kyuft:shades:
 

PrisonLove

Hard Realist
Reaction score
78
To help you better understand variables, you can think of a variable as a reference.

For instance, we have a trigger that creates a unit, but we want to use this exact unit in another trigger. Since we cannot reference (Last Created Unit) in another trigger and expect to get our desired unit, we should store it into a variable.

So in trigger 1:
-Create 1 Zealot for Player 1
-myUnit == Last Created Unit

Now in trigger 2 we can do this:
-Set myUnit health to 10%
-Make myUnit invulnerable
-Kill myUnit

And we will be referencing the zealot we created in Trigger 1. That's all variables are. They're ways to reference items of data, whether they be units, integers, timers, special fx, anything really, and use them in other parts of our code. I know that's a little off topic and doesn't scratch the surface of how valuable and useful variables are, but hopefully it helps you start to understand them!

Edit: This can help you reference your Nova hero.

When Nova is created, or on map initialization, set a Unit variable called 'Nova' to your Nova (Hero)

Now you can use the action (forgive me, I'm not well-versed in the Galaxy Editor):
A Unit Kills a unit

and substitute it as
Nova Kills a unit

You can also now use another integer variable called unitsKilled to keep track of Nova's total kills, and another integer called waveKills to keep track of how many kills until the next wave.

Soooooooo.......

Code:
Event
    -Nova kills a Unit

Condition
    -Unit type of killed unit equal to (Whatever your conditions are)

Actions
    -Set unitsKilled = unitsKilled + 1
    -Set waveKills = waveKills + 1
    -If (waveKills >= 10) then
        -Unleash new wave (this is a placeholder for however you choose to release the next wave)
        -Set waveKills = 0
    -Else

This trigger will unleash a new wave of units everytime Nova gets 10 kills, and keeps track of her overall kills.

You can also use these variables to display the current amount of kills and the number of kills needed to reach the next wave, etc.

Remember, variables are just references, but they're crucial to all map making and computer programming.

I hope that helps!
 

Kyuft

Member
Reaction score
11
PrisonLove, instead of using Code:, you can use [noparse]
Trigger:
  • and
[/noparse] so it can look like this:
[noparse]
Trigger:
  • Trigger
    • Events
    • (SPACE)Unit kills a unit
    • Local Variables
    • Conditions
    • Actions
    • (SPACE)End game

[/noparse]
To look like this:
Trigger:
  • Trigger
    • Events
      • Unit kills a unit
    • Local Variables
    • Conditions
    • Actions
      • End game


-Kyuft:shades:
 
General chit-chat
Help Users
  • No one is chatting at the moment.
  • Monovertex Monovertex:
    How are you all? :D
    +1
  • Ghan Ghan:
    Howdy
  • Ghan Ghan:
    Still lurking
    +3
  • The Helper The Helper:
    I am great and it is fantastic to see you my friend!
    +1
  • The Helper The Helper:
    If you are new to the site please check out the Recipe and Food Forum https://www.thehelper.net/forums/recipes-and-food.220/
  • Monovertex Monovertex:
    How come you're so into recipes lately? Never saw this much interest in this topic in the old days of TH.net
  • Monovertex Monovertex:
    Hmm, how do I change my signature?
  • tom_mai78101 tom_mai78101:
    Signatures can be edit in your account profile. As for the old stuffs, I'm thinking it's because Blizzard is now under Microsoft, and because of Microsoft Xbox going the way it is, it's dreadful.
  • The Helper The Helper:
    I am not big on the recipes I am just promoting them - I use the site as a practice place promoting stuff
    +2
  • Monovertex Monovertex:
    @tom_mai78101 I must be blind. If I go on my profile I don't see any area to edit the signature; If I go to account details (settings) I don't see any signature area either.
  • The Helper The Helper:
    You can get there if you click the bell icon (alerts) and choose preferences from the bottom, signature will be in the menu on the left there https://www.thehelper.net/account/preferences
  • The Helper The Helper:
    I think I need to split the Sci/Tech news forum into 2 one for Science and one for Tech but I am hating all the moving of posts I would have to do
  • The Helper The Helper:
    What is up Old Mountain Shadow?
  • The Helper The Helper:
    Happy Thursday!
    +1
  • Varine Varine:
    Crazy how much 3d printing has come in the last few years. Sad that it's not as easily modifiable though
  • Varine Varine:
    I bought an Ender 3 during the pandemic and tinkered with it all the time. Just bought a Sovol, not as easy. I'm trying to make it use a different nozzle because I have a fuck ton of Volcanos, and they use what is basically a modified volcano that is just a smidge longer, and almost every part on this thing needs to be redone to make it work
  • Varine Varine:
    Luckily I have a 3d printer for that, I guess. But it's ridiculous. The regular volcanos are 21mm, these Sovol versions are about 23.5mm
  • Varine Varine:
    So, 2.5mm longer. But the thing that measures the bed is about 1.5mm above the nozzle, so if I swap it with a volcano then I'm 1mm behind it. So cool, new bracket to swap that, but THEN the fan shroud to direct air at the part is ALSO going to be .5mm to low, and so I need to redo that, but by doing that it is a little bit off where it should be blowing and it's throwing it at the heating block instead of the part, and fuck man
  • Varine Varine:
    I didn't realize they designed this entire thing to NOT be modded. I would have just got a fucking Bambu if I knew that, the whole point was I could fuck with this. And no one else makes shit for Sovol so I have to go through them, and they have... interesting pricing models. So I have a new extruder altogether that I'm taking apart and going to just design a whole new one to use my nozzles. Dumb design.
  • Varine Varine:
    Can't just buy a new heatblock, you need to get a whole hotend - so block, heater cartridge, thermistor, heatbreak, and nozzle. And they put this fucking paste in there so I can't take the thermistor or cartridge out with any ease, that's 30 dollars. Or you can get the whole extrudor with the direct driver AND that heatblock for like 50, but you still can't get any of it to come apart
  • Varine Varine:
    Partsbuilt has individual parts I found but they're expensive. I think I can get bits swapped around and make this work with generic shit though

      The Helper Discord

      Members online

      No members online now.

      Affiliates

      Hive Workshop NUON Dome World Editor Tutorials

      Network Sponsors

      Apex Steel Pipe - Buys and sells Steel Pipe.
      Top