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.

      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