Adding Items To Units Based On Players Playing.

General talk about editing, cheating, and deprotecting maps.

Moderator: Cheaters

knightcyan
Newcomer
Posts: 9
Joined: May 19th, 2009, 8:29 pm

Adding Items To Units Based On Players Playing.

Post by knightcyan »

I want to make it so a Unit such as "Kel'Thuzad" will get items such as "Ring of Protection +2" when there are more than 1 player currently playing on the start of the game.
User avatar
Syre
Forum Staff
Posts: 506
Joined: November 17th, 2008, 3:49 pm

Re: Adding Items To Units Based On Players Playing.

Post by Syre »

Code: Select all

Untitled Trigger 001
    Events
    Conditions
    Actions
        If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            If - Conditions
                (Number of players in (All players matching ((((Matching player) controller) Equal to User) and (((Matching player) slot status) Equal to Is playing)))) Greater than 1
            Then - Actions
                Unit Group - Pick every unit in (Units owned by (Picked player) matching ((((Matching unit) is A Hero) Equal to True) and (((Matching player) controller) Equal to User))) and do (Hero - Create Ring of Protection +2 and give it to (Picked unit))
            Else - Actions
This..though its a bit confusing..should work..It will check if the number of players are above 1, and not counting computers, it will give hero units that are owned by a user, a ring. Just place this under any map initialization trigger.

Edit : To make this easier, i uploaded the map with the trigger in it, just copy the if/than/else into your map.
You do not have the required permissions to view the files attached to this post.
Image
Sevion
Junior Member
Posts: 44
Joined: April 12th, 2007, 2:43 am
Location: STALKER!!!

Re: Adding Items To Units Based On Players Playing.

Post by Sevion »

Syre, there is no Picked Player in your trigger currently ;)

It won't work.

Here:

Code: Select all

Untitled Trigger 001
    Events
    Conditions
    Actions
        For each (Integer A) from 1 to 12, do (Actions)
            Loop - Actions
                If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    If - Conditions
                        ((Player((Integer A))) controller) Equal to User
                        ((Player((Integer A))) slot status) Equal to Is playing
                    Then - Actions
                        Custom script:   set bj_wantDestroyGroup = true
                        Unit Group - Pick every unit in (Units owned by (Player((Integer A))) matching (((Matching unit) is A Hero) Equal to True)) and do (Actions)
                            Loop - Actions
                                Hero - Create Ring of Protection +2 and give it to (Picked unit)
                    Else - Actions
If you have something like brown as a computer, just change the loop to go from 1 to 11 or something ;)
"Sticks and stones may break my bones, but words will never hurt me!" Ouch! MY ARM!! YOU BROKE MY ARM!!