HomeUser Control Panel (unavailable in archive)ForumsTutorialsArt GalleryResourcesMaps

Number of kills vs rewards

03-11-2006, 05:06 AM#1
malto1
I got a problem with number of kills of a player, and rewards depending on the number of kills he has.
I want the trigger to create for the Player who reaches 10 kills an item (claw of attack +12), then give it to every unit he possesses . Then, if he earns any additionnal units (it will happen every 7 seconds), each will receive that item, after it has been created.

Here's the opening trigger related to leaderboard to introduce the Variable
that I'll be using. Player_kills with an index. 1 Array only.

Trigger:
Lead Kill Track
Collapse Events
Unit - A unit Dies
Collapse Conditions
((Killing unit) belongs to an ally of (Owner of (Killing unit))) Equal to True
Collapse Actions
Set Player_kills[(Player number of (Owner of (Killing unit)))] = (Player_kills[(Player number of (Owner of (Killing unit)))] + 1)
Leaderboard - Change the value for (Owner of (Killing unit)) in (Last created leaderboard) to Player_kills[(Player number of (Owner of (Killing unit)))]
Leaderboard - Sort (Last created leaderboard) by Value in Descending order

Now, that trigger Works so my problem isn't related to Leaderboard, but to the next trigger :

Trigger:
Reward1
Collapse Events
Unit - A unit Dies
Conditions
Collapse Actions
Collapse If (All Conditions are True) then do (Then Actions) else do (Else Actions)
Collapse If - Conditions
Player_kills[(Player number of (Owner of (Killing unit)))] Equal to 10
Collapse Then - Actions
Collapse Unit Group - Pick every unit in (Units owned by (Owner of (Killing unit)) matching (((Matching unit) is A structure) Equal to False)) and do (Actions)
Collapse Loop - Actions
Hero - Create Claws of Attack +12 and give it to (Picked unit)
Collapse Else - Actions
Do nothing
Set RedNeedItems = True

This trigger Doesn't work. I explained what I wanted/Needed, so does anybody know what to do here?

I will repeat what I want : I want the trigger to create for the Player who reaches 10 kills an item (claw of attack +12), then give it to every unit he possesses . Then, if he earns any additionnal units (it will happen every 7 seconds), each will receive that item, after it has been created.

In fact, my goal is to boost the units of that player after he reaches 10 kills, either way I use.

what are my mistakes ? it seems evident to me that the index following my variable is wrong, but I can't find something matching.

I was thinking maybe that I could do this in the actions :
Create an item for every unit owned by player 1(Red) but it doesn't exist as a choice in GUI. Could there be a way with variables and arrays ?

I must precise I'm not too expert with triggers (as you probably figure out while staring at my triggers) so my understanding of variables is ok but arrays = so-so lol, even if I read many, many tutorials.

So, in short, what kind of help I'd like is a solution to that problem, either using JASS script (I understand nothing so you'd have to do it for me , lol), tell me how to use correctly variables and arrays in that kind of situation, simply modify my trigger for it to work or find another solution!

i.e. using upgrades ? I mean, for example the upgrades in warcraft3 normal games. level 1... level 2.... level 3... instead of giving every units items to boost them.

Thank you very much ! :D read carefully as it's looooong lolll

P.S. I gave units the Inventory Ability.
03-11-2006, 07:42 AM#2
Thunder_Eye
Code:
[(Player 1 (Red) Units Killed)]
should be changed to
Code:
[(Player number of (Owner of (Killing unit)))]
You could also do the same for this so the trigger works for any player
Code:
(Units owned by Player 1 (Red)

And btw. your triggers creates an item for player 1's units every time he kills a unit after 10.
03-11-2006, 05:00 PM#3
malto1
Still i've got one more problem : if you reread my trigger now that it works, it still creates only one item when I need one for every unit I possess.

Is there a way to do that ? because as it is at the moment, it's not what happens at all.

EDIT: I edited my original post to better fit the new trigger you've explained to me. I changed the index and the Loop.
03-11-2006, 05:11 PM#4
TaintedReality
Quote:
Player_kills[(Player number of (Owner of (Dying unit)))] Equal to 10

Shouldn't that be Owner of (Killing Unit)? Same with this line too:
Quote:
Unit Group - Pick every unit in (Units owned by (Owner of (Dying unit))) and do (Actions)
03-11-2006, 05:16 PM#5
Thunder_Eye
Change
Code:
(Units owned by (Owner of (Dying unit)))
to
Code:
(Units owned by (Owner of (Killing unit)))

EDIT: To slow :/
03-11-2006, 05:34 PM#6
malto1
oh, made a mistake :P

but it still doesn't fix my problem. (see my post above)

:D
03-11-2006, 05:36 PM#7
Thunder_Eye
Well It works for me

And also in the first trigger you can remove this
Code:
((Killing unit) belongs to an ally of (Owner of (Killing unit))) Equal to True
03-11-2006, 06:10 PM#8
malto1
you mean that it creates 1 item for every unit you possess ???

are you sure ?

That trigger attempts to create ONE item and give it to MANY units so it cannot work !!






no ?? lolllllllll
03-11-2006, 06:12 PM#9
Thunder_Eye
No it creates one item for each unit you own.
So if you have 4 units the loop will run 4 times creating 4 items, one for each unit.

When you test it does it create just one item or none at all?
03-11-2006, 06:27 PM#10
malto1
it works but it creates onw for my builldings too :P

hmmm my building is a defensive tower so maybe I could give it an inventory then give it the =12 attack dmg so the tower would pwn even more too

:P

THANK YOU MAN :)
03-11-2006, 06:54 PM#11
Thunder_Eye
Add a match If the picked unit is an building

EDIT:
Here you go
Trigger:
Unit Group - Pick every unit in (Units owned by (Owner of (Killing unit)) matching (((Matching unit) is A structure) Equal to False)) and do (Actions)
Loop - Actions
03-11-2006, 07:07 PM#12
malto1
I see! right thanks again :P
03-11-2006, 07:35 PM#13
malto1
lol now I got another problem.
My map has untis spawning every 7 seconds, so I want those units too to get the claw of attack +12 if all the other units of that player already have the claws. I tryed doing something like this:

Trigger:
Player1PlusDmg
Collapse Events
Unit - A unit enters Spawn Red <gen>
Collapse Conditions
RedNeedItems Equal to True
Collapse Actions
Hero - Create Claws of Attack +12 and give it to (Entering unit)

RedNeedItems is a boolean variable that is set to true once Red got 10 Unit kills. The other trigger using it works and is shown above.

my problem is that I don't want to do that for every player (for now I must repeat the trigger for every player)

and

I don't want units who already got a claw to receive another one (for now it recieves another one lollllll)

that's it :P
I edited my post above to show the new variable RedNeedItems.
03-11-2006, 07:55 PM#14
Thunder_Eye
Well instead of RedNeedItem, make an array variable like you did with the
PlayerKills[Player Number of (Owner of (Entering Unit))]
03-11-2006, 08:09 PM#15
malto1
But should I use the same type? (here Boolean) or switch it to integer like Player_kills ?

Also look above :

Trigger:
Events
Unit - A unit enters Spawn Red <gen>

it won't do it for every player because it's entering Spawn Red, and I can't find a way to make it when it enter jsut a region.