HomeUser Control Panel (unavailable in archive)ForumsTutorialsArt GalleryResourcesMaps

help on arrays

02-15-2004, 02:12 PM#1
shadow)ps(
i need help on arrays, i did a search but nothing useful came up, anyone got a link to a thread or help me on arrays?
02-15-2004, 03:39 PM#2
Alakafizz
How odd, i get a bunch of useful stuff when i search for "Array".

For example here
02-15-2004, 04:07 PM#3
shadow)ps(
well, i need some help understanding how to use them.
for example, i have 11 players right now
and i want the computer to give 1 lumber each time they kill a computer unit. how would i make a array for this?
also, when a person reaches a certain number of lumber, they get a hero. how would i do that too? thanks
02-15-2004, 04:19 PM#4
Alakafizz
You dont need arrays for that, since there's already a function that handles resources.

Real quick:

Code:
Trigger 1
    Events
        Unit - A unit Dies
    Conditions
        (Owner of (Dying unit)) Equal to Neutral Hostile (Swap if cpu is player 12 or whatever)
    Actions
        Player - Add 1 to (Owner of (Killing unit)) Current lumber




Trigger 2
    Events
        Player - Player 1 (Red)'s Current lumber becomes Greater than or equal to 100.00
        Player - Player 2 (Blue)'s Current lumber becomes Greater than or equal to 100.00
        Player - Player 3 (Teal)'s Current lumber becomes Greater than or equal to 100.00
        Etc..
    Conditions
    Actions
        Player - Set (Triggering player) Current lumber to 0
        Unit - Create 1 Blood Mage for (Triggering player) at (Center of (Playable map area)) facing Default building facing degrees
02-15-2004, 05:26 PM#5
shadow)ps(
and how would i trigger it if i awnted the lumber to be replaced by a leaderboard integer?
02-15-2004, 07:58 PM#6
Alakafizz
Create an integer-array with the name IntegerArray, size 11, and replace the red values as needed.

Code:
    Events
        Unit - A unit Dies
    Conditions
        (Owner of (Dying unit)) Equal to [color=red]Player 12 (Brown)[/color]
    Actions
        Set IntegerArray[(Player number of (Owner of (Killing unit)))] = (IntegerArray[(Player number of (Owner of (Killing unit)))] + 1)
        If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            If - Conditions
                IntegerArray[(Player number of (Owner of (Killing unit)))] Greater than [color=red]19[/color]
            Then - Actions
                Set IntegerArray[(Player number of (Owner of (Killing unit)))] = (IntegerArray[(Player number of (Owner of (Killing unit)))] - [color=red]20[/color])
                Unit - Create 1 [color=Red]Blood Mage[/color] for (Owner of (Killing unit)) at [color=Red](Center of (Playable map area))[/color] facing Default building facing degrees
            Else - Actions
                Do nothing