• Listen to a special audio message from Bill Roper to the Hive Workshop community (Bill is a former Vice President of Blizzard Entertainment, Producer, Designer, Musician, Voice Actor) 🔗Click here to hear his message!
  • Read Evilhog's interview with Gregory Alper, the original composer of the music for WarCraft: Orcs & Humans 🔗Click here to read the full interview.

[Trigger] If player kill x number of creep trigger x will be activated

Status
Not open for further replies.
Level 2
Joined
Apr 26, 2014
Messages
18
Hi Guys

I'm a average Starcraft 1 map maker, who recently has started on making Warcraft 3 maps.

In Starcraft 1 you could make a trigger, which was activated if player x kills x number of units.

My question is: How to make a trigger in Warcraft 3 Worldedit, which are activated if player x kills x number of units?
 
Level 2
Joined
Apr 26, 2014
Messages
18
Create an integer array variable "killCount".

Event:
Unit - A Unit dies
Action:
set tmpInt = PlayerNumberOf(OwnerOf(KillingUnit))
Set killCount[tmpInt] = killCount[tmpInt] + 1
If killCount[tmpInt] == 100 then ....

tmpInt is only an integer variable which should simplify it.
Can you write here a simple step-by-step?
 
Level 13
Joined
Jul 16, 2012
Messages
679
Create an integer array variable "killCount".

Event:
Unit - A Unit dies
Action:
set tmpInt = PlayerNumberOf(OwnerOf(KillingUnit))
Set killCount[tmpInt] = killCount[tmpInt] + 1
If killCount[tmpInt] == 100 then ....

tmpInt is only an integer variable which should simplify it.

  • Untitled Trigger 001
    • Events
      • Unit - A unit Dies
    • Conditions
    • Actions
      • Set TempInt = (Player number of (Owner of (Killing unit)))
      • Set KillCount[TempInt] = (KillCount[TempInt] + 1)
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • KillCount[TempInt] Equal to 100
        • Then - Actions
          • -------- blabla --------
        • Else - Actions
 
Level 2
Joined
Apr 26, 2014
Messages
18
Okay... I havent used variables before, so please explain for me, what is variables good for and how do I make them?
 
You can save data into a variable, and use this data later by using this variable.

You can crate it in the variable editor. It's a green X in trigger edtiro. A variable can be overwritten as often as you want, once it's created.

Use the "Set Veriable" action to set your variables. (store data into it)

And well, integer are not comma numbers like: 0,1,2,3,... so we can use this variable type as a counter.

Each time a unit gets killed you can increase the counter for killing player.

We use integer[array] here, because each player needs his own counter.

We also use the PlayerNumber of the players to get the correct index in the array of the integer. Thats why we increase counter[playerNumber]. (so it get's specific)

Maybe you should read some tutorials, I quickly found this: http://world-editor-tutorials.thehelper.net/variables.php
 
Level 2
Joined
Apr 26, 2014
Messages
18
  • Untitled Trigger 001
    • Events
      • Unit - A unit Dies
    • Conditions
    • Actions
      • Set TempInt = (Player number of (Owner of (Killing unit)))
      • Set KillCount[TempInt] = (KillCount[TempInt] + 1)
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • KillCount[TempInt] Equal to 100
        • Then - Actions
          • -------- blabla --------
        • Else - Actions
"Set TempInt = (Player number of (Owner of (Killing unit)))" <- do you select "Set Variable" in "Configure Action"?
 
Level 2
Joined
Apr 26, 2014
Messages
18
Only if you made the variable an array.
Your tempInt should not be an array. Your other variable needs to be an array and the index is tempInt.
Please look up a tutorial on variables to ether understand them.

Thx for the tutorials and the quick response.

I managed to - almost - now to make a trigger now, after the reading the tutorials.

My last problem/issue is wrong math operator
2hi9esg.png

As shown with a red arrow on the picture, it doesnt get the same math operators like AKA.GywGod133's picture - why?
 
Level 2
Joined
Apr 26, 2014
Messages
18
Click set variable. Then on left click antalkills[]. On right side click arithmetic option.
Then on left side choose the variable on right keep it as one.
It is working - thank for very much :)

I have attached the map if anyone in the future what to make that kind of trigger
 

Attachments

  • thomassn hero defence 021.w3x
    512.6 KB · Views: 67

Dr Super Good

Spell Reviewer
Level 64
Joined
Jan 18, 2005
Messages
27,259
You might want to skip past WC3 straight to SC2. Seeing how WC3 is closer to the age of SC1 than it is to SC2...

Be aware that locations ("Points" in GUI) do leak in WC3. This is because WC3 has no garbage collection. There is also no GUI action to remove the locations and prevent the leak. You will need to use a line of JASS custom script to do so. Other types that leak are groups ("Unit Groups" in GUI), forces ("Player Groups" in GUI) and special effects.
 
Level 2
Joined
Apr 26, 2014
Messages
18
You might want to skip past WC3 straight to SC2. Seeing how WC3 is closer to the age of SC1 than it is to SC2...

Be aware that locations ("Points" in GUI) do leak in WC3. This is because WC3 has no garbage collection. There is also no GUI action to remove the locations and prevent the leak. You will need to use a line of JASS custom script to do so. Other types that leak are groups ("Unit Groups" in GUI), forces ("Player Groups" in GUI) and special effects.

The day I buy a new computer, I will go to SC2 :p my current computer runs SC2 average.

Oh thx for info about lacks. I try to avoid them and look at JASS custom script :p
 
Status
Not open for further replies.
Top