• Listen to a special audio message from Bill Roper to the Hive Workshop community (Bill is a former Vice President of Blizzard Entertainment, Producer, Designer, Musician, Voice Actor) 🔗Click here to hear his message!
  • Read Evilhog's interview with Gregory Alper, the original composer of the music for WarCraft: Orcs & Humans 🔗Click here to read the full interview.

[Trigger] Giving buffs to units

Status
Not open for further replies.
Level 6
Joined
Aug 13, 2008
Messages
197
Hi, i am at a lost on how to add buff to units using triggers...I know this may sound lame but there is a catch. The buffs i wish to apply on the units only when they are on a specific terrain type. For example snow = slow by 3%.
Another problem is creating random weathers like a certain part would rain where rain = dispels all buff but such weather would happen only random areas in the maps...I hope someone could help me create the triggers preferably in GUI format or if possible upload the file here:thumbs_up: thx in advance.
 
Level 3
Joined
Aug 5, 2008
Messages
43
adding buff by triggers is impossible but if u wanna make a buff make dummy unit with the ability "slow' from Human and u'll make a region.....

Event: A Unit enters region "Region Snow"

Action: Create 1 Dummy unit at Center of "region" facing Default building Degreeses
Order Last created unit to Human - Slow Entering unit


And u'll make a region that always is raining in that region and this will be same just...

Event: A Unit Enters "region Rain"

Action: Remove all buffs from Entering Unit

I THINK IT SHOULD WORK
. GL
 
Level 6
Joined
Aug 13, 2008
Messages
197
adding buff by triggers is impossible but if u wanna make a buff make dummy unit with the ability "slow' from Human and u'll make a region.....

Event: A Unit enters region "Region Snow"

Action: Create 1 Dummy unit at Center of "region" facing Default building Degreeses
Order Last created unit to Human - Slow Entering unit


And u'll make a region that always is raining in that region and this will be same just...

Event: A Unit Enters "region Rain"

Action: Remove all buffs from Entering Unit

I THINK IT SHOULD WORK
. GL

Ok but what if the terrain are in a mess, wont i need many small 1x1 regions to cover it. (i was hoping that the trigger would recognize what ground they are on)
Also the rain region would have to move, is there any way to move it while keeping the effect? thx for the quick respond btw.
 
Level 21
Joined
Aug 21, 2005
Messages
3,699
What you could do is make dummy units with negative auras. For instance a "snow" dummy would have a negative endurance aura, and is placed on the snow. A problem would be that it's possible a unit will still have the buff when he's on a non-snow tile very close to one of the snow dummies you placed on the map. But if you place the dummies good enough, this won't be a real problem.

The rain dummies could simply be moved whenever the rain moves.
 
Level 5
Joined
Dec 18, 2007
Messages
205
Well, you could check whether the unit is on snow and then cast a slow on it, but it's difficult to do in GUI, so I did in JASS.

Put this script into the map header:

JASS:
function IsUnitOnTerrain takes integer TType returns nothing
    local group g=CreateGroup()
    local rect r=GetPlayableMapRect()
    local unit x
    local unit dummy
    local integer xTType
    set g=GetUnitsInRectMatching(r,null)
    loop
        set x=FirstOfGroup(g)
        exitwhen x==null
        set xTType = GetTerrainType(GetUnitX(x), GetUnitY(x))
        if xTType == TType then
            set dummy=CreateUnit(Player(12),'xxxx',GetUnitX(x),GetUnitY(x),270.)
            call UnitApplyTimedLife(dummy,'BTLF',3.)
            call IssueTargetOrder(dummy,"slow",x)
            set dummy=null
        endif                   
        call GroupRemoveUnit(g,x)
    endloop
    call DestroyGroup(g)
    call RemoveRect(r)
    set g=null
    set r=null
endfunction
Now change this line:
JASS:
            set dummy=CreateUnit(Player(12),'xxxx',GetUnitX(x),GetUnitY(x),270.)
The 'xxxx' must be the intergerid of your dummy unit which you get by pressing CTRL+D in the object editor and the dummy unit must have the ability slow (based of the human sorceress).
Set the mana cost of the slowspell to 1 mana and add a high cooldown/range. set the mana of the dummy to 1, his turn-rate to 3, his model to "none.mdl" and give him no attack and the locust-ability.

Now call the function like this:

  • Check
    • Events
      • Time - Every 3.00 seconds of game time
    • Conditions
    • Actions
      • Custom script: call IsUnitOnTerrain('Idki')
You may recognize the 'Idki'. That's a special ice-type. If you want an other ice/snow type just set a variable to that snow type and convert it to custom text, then you see the terrain's raw data.


And please tell me, if the function does not work, i did not test it.

greetz


EDIT: and to your rain thing: Can you tell me, how you trigger it? Because I don't know, how i should do this, if you dont give me a trigger where you trigger the rain effect.
 
Level 5
Joined
Dec 18, 2007
Messages
205
well, then you must find the size of the rain i think. create a global variable and set its point to the random point created. if a unit enters the region centered at that point with size X and X (you must check the size of the rain cloud), remove all buffs from entering unit.
another trigger would be: unit casts a spell, unit is in region centered at that point with size X and X, wait 1 second remove all buffs from all units in that region. or just make an action like every 3 seconds remove buffs of all unit in that region.

greetz
 
Status
Not open for further replies.
Top