Page 1 of 1

Simple Upgrade/Ability System

Posted: August 16th, 2013, 6:34 pm
by lilk3nny
Hi, I would like to request a simple upgrade/ability system.
I am not to good at triggering, so hopefully you guys could help me on this.

In an abstract, my map contains a spawning system where units will spawn every few seconds to
attack a point.

I want to create a system where you can research an upgrade and it will simply add the ability to your
spawned units and current spawning units. I would like it to also be MPI, considering, there will be other
players who would also use this function.

Could anyone help me on this?

Re: Simple Upgrade/Ability System

Posted: August 19th, 2013, 1:38 am
by Syre
Alright, it should be pretty simple to add, you will need a bit of variables though but its nothing too complicated.

Here's the trigger's that you will need. You only need two triggers to work this, one that adds the check for the upgrade to work and one to add the ability to the units.

Code: Select all

Untitled Trigger 001 Copy
    Events
        Unit - A unit Finishes research
    Conditions
    Actions
        If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            If - Conditions
                (Researched tech-type) Equal to Iron Forged Swords
            Then - Actions
                Set IronSwords[(Player number of (Owner of (Researching unit)))] = True
            Else - Actions
This first one should be easy to understand, basically it triggers when a building finishes the upgrade, determines what upgrade was done, and then checks the player so the next trigger can add the skill for just that players units.

In the line "Set IronSwords" IronSwords is a Boolean variable, with an array size set as 1-12. You will have to create variables for each of your upgrades.

After "Else - Actions" Repeat the If/Then/Else action just as shown but do it for a different upgrade.

Code: Select all

Untitled Trigger 002
    Events
        Time - Every 2.00 seconds of game time
    Conditions
    Actions
        For each (Integer A) from 1 to 10, do (Actions)
            Loop - Actions
                If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    If - Conditions
                        IronSwords[(Integer A)] Equal to True
                    Then - Actions
                        Unit Group - Pick every unit in (Units owned by (Player((Integer A))) of type Footman) and do (Unit - Add Aerial Shackles to (Picked unit))
                    Else - Actions
                        Do Nothing
This trigger checks every 2 seconds to see if the player has finished the upgrade from the previous trigger, and adds an ability that you want to any unit type owned only by that player.

It should be very easy to make, the only thing really confusing could be the line (Units owned by (Player((Integer A))). To get that you need to select "Units owned by player of type" under the unit group option. Then for where you choose the player, the option is called "Conversion - Convert player index to player"

Unlike the previous trigger, for this one you can't put everything under "Else - Actions". Simply copy and paste the actions and change the rest of the parts for the other abilities.
...
I tested this small system out with two players and it did not conflict, so you shouldn't have many problems with it. If i made something confusing or you cant figure a line out feel free to ask.