Add ability

For fulfilled maps that most likely don't work on the latest patch (1.24 or later).

Moderator: Cheaters

Dark_coolness
Junior Member
Posts: 34
Joined: August 12th, 2008, 9:35 pm

Add ability

Post by Dark_coolness »

i want to make a trigger so that when some one buys a item from a shop it will give them the ability
but they can keep the item in case they want to sell the item and don't click me a different item that also uses the same spell adding trigger.
User avatar
Syre
Forum Staff
Posts: 506
Joined: November 17th, 2008, 3:49 pm

Re: Add ability

Post by Syre »

Alright..forgive me if im not understanding fully, but basically you want a trigger, that makes it so when a unit acquires an item, they get a spell. And you want the same trigger to work with multiple items and abilities..If not, then please clarify.

Anyways, what i got, i did on a whim, which took no longer than 5 minutes..Its not the most compact..and i dont know if it even works..dont see why it shouldn't though..

Well, basically your looking at two triggers, the first one to give the spell, the second to take it away. It will all be running on one variable array. So first you should create a variable, name it whatever you want, in my case i chose items. Make the type integer, and the size should be however many items your gonna use.

Now, just make one if/than/else and copy it for the rest of your items, ive shown it done for two. The variable is to determine if you already have the spell or not. Wouldn't want you to get the same spell twice, or remove something that you dont even have.

The integer between brackets should be changed for every item, 0 to start with and to whatever number of items you end with, and the 1 and 0 are for determining if you have it or not. Im probably making this sound much harder than it really is..just follow the examples below.

First trigger.
Spoiler:

Code: Select all

Untitled Trigger 001
    Events
        Unit - A unit Acquires an item
    Conditions
        ((Hero manipulating item) is A Hero) Equal to True
    Actions
        If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            If - Conditions
                (Item-type of (Item being manipulated)) Equal to Claws of Attack +15
                Items[0] Equal to 0
            Then - Actions
                Set Items[0] = 1
                Unit - Add Acid Bomb to (Hero manipulating item)
                Skip remaining actions
            Else - Actions
        If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            If - Conditions
                (Item-type of (Item being manipulated)) Equal to Crown of Kings +5
                Items[1] Equal to 0
            Then - Actions
                Set Items[1] = 1
                Unit - Add Animate Dead to (Hero manipulating item)
                Skip remaining actions
            Else - Actions
Second Trigger.
Spoiler:

Code: Select all

Untitled Trigger 001 Copy
    Events
        Unit - A unit Loses an item
    Conditions
        ((Hero manipulating item) is A Hero) Equal to True
    Actions
        If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            If - Conditions
                (Item-type of (Item being manipulated)) Equal to Claws of Attack +15
                Items[0] Equal to 1
            Then - Actions
                Set Items[0] = 0
                Unit - Remove Acid Bomb from (Hero manipulating item)
                Skip remaining actions
            Else - Actions
        If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            If - Conditions
                (Item-type of (Item being manipulated)) Equal to Crown of Kings +5
                Items[1] Equal to 1
            Then - Actions
                Set Items[1] = 0
                Unit - Remove Animate Dead from (Hero manipulating item)
                Skip remaining actions
            Else - Actions
Like i said, i made it fast and didn't test it..So i'd appreciate feedback to whether it works or not. If it doesn't work ill tweak it or even remake it if it comes to that.
Image
Dark_coolness
Junior Member
Posts: 34
Joined: August 12th, 2008, 9:35 pm

Re: Add ability

Post by Dark_coolness »

Sorry for bad explanation.
k i tried it and it did work
but i made some changes.
(don't click me or pick up)
Spoiler:

Code: Select all

don't click me
    Events
        Unit - A unit Acquires an item
    Conditions
        ((Hero manipulating item) is A Hero) Equal to True
    Actions
        If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            If - Conditions
                (Item-type of (Item being manipulated)) Equal to Claws of Attack +15
            Then - Actions
                Unit - Add Flame Strike  to (Hero manipulating item)
                Skip remaining actions
            Else - Actions
(sell or drop)
Spoiler:

Code: Select all

Sell
    Events
        Unit - A unit Loses an item
    Conditions
        ((Hero manipulating item) is A Hero) Equal to True
    Actions
        If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            If - Conditions
                (Item-type of (Item being manipulated)) Equal to Claws of Attack +15
            Then - Actions
                Unit - Remove Flame Strike  from (Hero manipulating item)
                Skip remaining actions
            Else - Actions
I had changed it a little and it worked but i was wondering if there was a way to stop it from resetting the cool down when a person drops the item and picks it up.
User avatar
Syre
Forum Staff
Posts: 506
Joined: November 17th, 2008, 3:49 pm

Re: Add ability

Post by Syre »

I..hadent thought of that..lol err..wonder if its possible to make the item undroppable for a short time after the spell is used...well unless your using spells with a reallyyy long cooldown...but i dont think most people would use a spell, then immediately drop the item besides getting out of the cooldown...ill see if i can figure something out.

Btw, did the trigger not work with the variable or was it just easier to make this way? Cause without that, if you pick up two items of the same type, dont they give you two spells?

Edit : Just after i posted, i opened WE and took a look..it should be easy to do..but it will mean one more trigger to manage lol ill post it after im done with it.

Edit 2 : So..that was quite easy..sorry as i know really no other way for the cooldown to stick. This..should work..it will just be a little inconvienent if your using buffing spells since you cant switch items quickly.
Spoiler:

Code: Select all

Untitled Trigger 001
    Events
        Unit - A unit Begins casting an ability
    Conditions
        ((Casting unit) is A Hero) Equal to True
    Actions
        If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            If - Conditions
                ((Casting unit) has an item of type Claws of Attack +15) Equal to True
                (Ability being cast) Equal to Acid Bomb
            Then - Actions
                Item - Make (Item carried by (Casting unit) of type Claws of Attack +15) Undroppable
                Wait 10.00 seconds
                Item - Make (Item carried by (Casting unit) of type Claws of Attack +15) Droppable
            Else - Actions
Image
Dark_coolness
Junior Member
Posts: 34
Joined: August 12th, 2008, 9:35 pm

Re: Add ability

Post by Dark_coolness »

i took the variable out because i thought it would be fine with out
yes it worked you just have to set the wait time to spell cooldown
Spoiler:

Code: Select all

If (All Conditions are True) then do (Then Actions) else do (Else Actions)
    If - Conditions
        ((Casting unit) has an item of type Claws of Attack) Equal to True
        (Ability being cast) Equal to Flame Strike 
    Then - Actions
        Item - Make (Item carried by (Casting unit) of type Claws of Attack) Undroppable
        Wait 30.00 seconds
        Item - Make (Item carried by (Casting unit) of type Claws of Attack) Droppable
    Else - Actions
just changed the wait time to the spell cool down
thanks for the help works fine now. :)