How to spawn per 10 kills HELP

Smilis

TH.net Regular
Reaction score
7
I belive it should look like this:

Trigger:
  • Evolution
    • Events
      • Unit - A unit Dies
    • Conditions
    • Actions
      • Set Kills[(Player number of (Owner of (Killing unit)))] = (Kills[(Player number of (Owner of (Killing unit)))] + 1)
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • Kills[(Player number of (Owner of (Killing unit)))] Equal to 10
        • Then - Actions
          • Set Kills[(Player number of (Owner of (Killing unit)))] = 0
          • Unit - Create 1 Footman for Player 1 (Red) at (Center of (Playable map area)) facing Default building facing degrees
        • Else - Actions


Your code has:

Trigger:
  • Set Kills[(Player number of (Owner of (Killing unit)))] = Kills[((Player number of (Owner of (Killing unit))) + 1)]


not
Trigger:
  • Set Kills[(Player number of (Owner of (Killing unit)))] = (Kills[(Player number of (Owner of (Killing unit)))] + 1)



And if you look closly you can see that in the first exemple the +1 is inside the [ and ], but in the second it is outside the [ and the ] ;)
 

ballzdeep85

New Member
Reaction score
0
i updated pink is killing my units im getting the kills and pink is gettting the units to spawn for every 10 kills.

problem is i am getting credit for kills.

i dont know if this changes anything you were saying.

please let me know.

thankyou,
ballzdeep85
 

ballzdeep85

New Member
Reaction score
0
and how do i get it this way
Set Kills[(Player number of (Owner of (Killing unit)))] = (Kills[(Player number of (Owner of (Killing unit)))] + 1)


i dont know how

thankyou,
ballzdeep85
 

Moridin

Snow Leopard
Reaction score
144
Hate to hijack this thread, but I never really understood the point of array size.. what's the use.. if any.. I'm pretty sure an array size of just 1 would still work.

This is for MPI. You have 12 players, so you need 12 different values for the integer hence the array size. It's 13, because the first array index is 0, not 1.

and how do i get it this way
Set Kills[(Player number of (Owner of (Killing unit)))] = (Kills[(Player number of (Owner of (Killing unit)))] + 1)

Steps:

1) Action
2) Set variable

-> Set ______ = _______

3) Click the first ______
4) Select KillCount / any integer array with a size of 13

-> Set KillCount[_______] = __________

5) Click the _____ in the [ ]
6) Select Player - Player number

-> Set KillCount[Player number of (______)] = _________

7) Select the _______ inside the ( )
8) Select "Player - Owner of unit"
9) Click the inner _______
10) Select "Event response - Killing unit"


So now you have:

-> Set KillCount[(Player number of (Owner of (Killing unit)))] = _____________

11) Select the second ________
12) Choose Arithmetic
13) You will get __________ + 1
14) Leave the 1 and the +
15) Select the first blank here
16) Repeat from step 4 to 10.
 

Tyman2007

Ya Rly >.
Reaction score
74
I think you don't quite understand the concept of array size.. Array size isn't the amount of instances that the variable can hold, I know that much for sure, but it's something else that's overcomplicated and doesn't really matter.

As far as I know, a larger array size means less instances of the variable can be running at the same time, which isn't exactly a very sought after thing =\

Also, good eye Smilis :p I didn't catch that at first.

And ballz, thehelper frowns upon those who double post and don't use the "Edit" button.
 

Moridin

Snow Leopard
Reaction score
144
Oookay. I'm pretty sure I'm right, because I've been using this for the past 2 years :p.

An integer variable "Int" for example can hold one integer. When you make it an array of size 13, then you get the following possible storage options:

int[0] = ?
int[1] = ?
int[2] = ?
int[3] = ?
int[4] = ?
int[5] = ?
int[6] = ?
int[7] = ?
int[8] = ?
int[9] = ?
int[10] = ?
int[11] = ?
int[12] = ?

which are 13 possible variables.

Edit: ...and because you need 1 to 12 (For player numbers) you need an array size of 13. Please don't confuse the poor guy with what arrays are. They aren't "something overcomplicated that doesn't really matter". I'm somewhat amazed that you've been able to code without using arrays :S.

Edit 2: Read please
 

ballzdeep85

New Member
Reaction score
0
im so confused.

that tutorial is using code and all im using is all editor.

im still stuck.
im almost done with the map to start beta testing.
myabe this is a lost cause?

anything anyone can do to write this for me/ but not just for me but so i can look at it and just trial and error untill mine looks exactly the same.

thankyou,
ballzdeep85.
 

Moridin

Snow Leopard
Reaction score
144
Again. This will work. You need to ensure that is is EXACTLY the same though, including the brackets for the variable changes.

Trigger:
  • Unit Dies
    • Events
      • Unit - A unit Dies
    • Conditions
    • Actions
      • Set KillCount[Player number of (Owner of (Killing unit))] = Killcount[Player number of (Owner of (Killing unit))] + 1
      • If (All conditions are true) then do (Then actions) else do (Else actions)
        • If - Conditions
          • KillCount[Player number of (Owner of (Killing unit))] = 10
        • Then - Actions
          • Set KillCount[Player number of (Owner of (Killing unit))] = 0
          • Unit - Create 1 <your unit> for (Owner of (Killing unit)) at (point) facing (angle)


Easiest way for the Set action, follow the instructions I posted earlier. The "1" is outside the variable array bracket.
 

ballzdeep85

New Member
Reaction score
0
how do i get the brackets ] +1
mine is on the outside.

i figured this was all i needed to get right.

sweet!!!

so how do i do that:)

thankyou,
ballzdeep85.
 

Moridin

Snow Leopard
Reaction score
144
11) Select the second ________
12) Choose Arithmetic
13) You will get __________ + 1
14) Leave the 1 and the +
15) Select the first blank here
16) Repeat from step 4 to 10.

Bold line
 

tommerbob

Minecraft. :D
Reaction score
110
Follow Moridins instructions in post #24. They are very simple to follow. Read them each carefully, do each step, and then move onto the next step.
 

ballzdeep85

New Member
Reaction score
0
for if coditions i have:
KillCount[Player number of (Owner of (Killing unit))] equal to 10
not
KillCount[Player number of (Owner of (Killing unit))] = 10

is that ok?

thankyou,
ballzdeep85.
 

ballzdeep85

New Member
Reaction score
0
im getting 2 kills on the board for every 1 unit killed what happend?

ez fix or not?

thankyou,
ballzdeep85
 

tommerbob

Minecraft. :D
Reaction score
110
I would suggest uploading a test map. It is much easier to debug and make sure it works.
 

ballzdeep85

New Member
Reaction score
0
iam testing it.

and not to be crappy but its not ready to have distrabution yet.

oh yeah and when i get ten kills even though its say 2 kills for every on unit killed i get a unit spawned but..... the total score dose not stay it resets; whats up with that?

thankyou,
ballzdeep85
 

Tyman2007

Ya Rly >.
Reaction score
74
Oookay. I'm pretty sure I'm right, because I've been using this for the past 2 years :p.

Edit 2: Read please

Experience and knowledge are 2 different things, don't confuse the 2 :p

You're confusing index and size, and that link you showed me you didn't even read on.

Size
Arrays in JASS all have the same max index of 8192. This means that the 'size' field for arrays in the WE is useless (to my knowledge). In this sense arrays are more like hash-tables, as you will not recieve an 'index out of bounds' error. But it also means that every array you make will occupy a certain amount of space no matter how much or little data is put into it.

Size REDUCES the amount of indexes you can use. That topic is 5 years old when nobody really knew.. or even cared about size. Now that we use structs, we have a much larger understanding :p

The world editor can hold a total size of 8190. If you change the size to 10, you can run 819 instances, or 819 indexes. Change it to 100, you can run 81 (It doesn't round, you must truncate). Change it to 1000, you get 8.

See where I'm going with this? I understand what ur going at there :p You just confused index value and size value. An easy mistake to make to the inexperienced programmer.

Anyway, as for this topic, I don't really know what else to say. The above text I have is for future reference for anyone to use :p Learn something new everyday eh?
 

Moridin

Snow Leopard
Reaction score
144
Can you post your triggers?

Also you can use
Trigger:
  • tags to put GUI without using screenshots. Right click the heading of the trigger, select "Copy as text". Then in the forum type:
    • [noparse]
    • <div class="bbCodeBlock bbCodeBlock--screenLimited bbCodeBlock--code"><div class="bbCodeBlock-title">Trigger:</div><div class="wc3trigger"><ul class="wc3" id="wc3_5">
    • <li class="lasttree"><span class="default">&amp;lt;paste the text&amp;gt;</span></li>
    • </ul>
    • </div></div>
    • [/noparse]
 

ballzdeep85

New Member
Reaction score
0
Trigger:
  • Evolution 1 pink1 Copy 2
    • Events
      • Unit - A unit Dies
    • Conditions
    • Actions
      • Set Kills[(Player number of (Owner of (Killing unit)))] = (Kills[(Player number of (Owner of (Killing unit)))] + 1)
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • Kills[(Player number of (Owner of (Killing unit)))] Equal to 10
        • Then - Actions
          • Set Kills[(Player number of (Owner of (Killing unit)))] = 0
          • Unit - Create 1 Golem Population Peice for (Owner of (Killing unit)) at (Random point in Golem Population &lt;gen&gt;) facing Default building facing degrees
        • Else - Actions


thankyou,
ballzdeep85.
 

Tyman2007

Ya Rly >.
Reaction score
74
Ballz, ya should post a demo map. It will help you help us in helping you :p
Simply post it as an attachment.
 
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