• 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.

How to add buff because of an item, without the item in the inventory ?

Status
Not open for further replies.
Level 5
Joined
May 12, 2013
Messages
70
Those who answered my previous post would know, i was working on making item disappear after buying and give permenant stat bonus, like a Belt of Giant strength, would directly give +6 strength, without coming in the inventory.
I did the triggers like, when someone buys an item, remove the item from inventory, and modify hero attribute : Add +6 stregth.
This went pretty well, but the problem is the buffs that were attached to some items wont show because the item is not in the inventory, it only gives the stats bonus. So how do i make the buff appear in the status bar ?
Please reply fast.
 
Level 29
Joined
Sep 26, 2009
Messages
2,595
Well, as Destroyer123 wrote, you need to use custom spell, because spells apply buffs. That way you can get the buff. That spell will be cast by dummy unit.

Dummy unit is a unit which has no model file, has no shadow, has fly movement type to prevent collision, has Art - Cast Point set to 0, has Art - Death Time set to 0/0.1, has Combat - Death Type set to "Can't raise, does not decay", does not display on minimap, costs no food, has no attack and most of all, has locust ability, so it cannot be selected by player.

With the above set, you basically have invisible caster, who cannot be selected by player, but can be selected through triggers.

Now an example:
When I pick "Belt of Bloodlust" item, I want my unit to have "Bloodlust" buff.
As you wrote, you immediately remove the item.
So what you do is create a dummy unit which will cast spell on the unit that picked up that item - this will apply the buff.

Here is the trigger:
  • Stat Bonus
    • Events
      • Unit - A unit Acquires an item
    • Conditions
      • (Item-type of (Item being manipulated)) Equal to Belt of Giant Strength +6
    • Actions
      • Item - Remove (Item being manipulated)
      • Set unit = (Triggering unit)
      • -------- ------------------------------------------------------------------------ --------
      • -------- ------------------------------------------------------------------------ --------
      • -------- here you apply those bonuses you want --------
      • -------- in this trigger, I will simply add 6 strength --------
      • Hero - Modify Strength of unit: Add 6
      • -------- ------------------------------------------------------------------------ --------
      • -------- we set up spawn point for dummy unit --------
      • Set point = (Position of unit)
      • -------- ------------------------------------------------------------------------ --------
      • -------- here we create dummy unit, give it ability, order it to cast that ability --------
      • Unit - Create 1 Dummy for (Owner of unit) at point facing (Facing of unit) degrees
      • Set dummy = (Last created unit)
      • Unit - Add a 2.00 second Generic expiration timer to dummy
      • Unit - Add CustomSpell to dummy
      • Unit - Order dummy to Human Priest - Inner Fire unit
      • -------- ------------------------------------------------------------------------ --------
      • -------- ------------------------------------------------------------------------ --------
      • -------- clear trigger --------
      • Set dummy = No unit
      • Set unit = No unit
      • Custom script: call RemoveLocation(udg_point)
You need to abide a few rules for this to work:
#1
Dummy is a custom unit and has all parameters set just like I wrote at the start of this post about dummy units.

#2
CustomSpell is your custom spell! But it has to be based off a spell that can target your hero any time and applies buff! Do not base that spell off for example Holy Light, because that doesn't work correctly and may not be used on friendly undead player!

#3
In my example trigger, I based CustomSpell off priest's Inner Fire, which is why the next line in the trigger is "Order dummy to Human Priest - Inner Fire unit"... if you base your CustomSpell off for example Bloodlust, you will need to order your dummy to cast Orc Shaman - Bloodlust on the other unit!

#4
CustomSpell that dummy unit uses has to be specifically set! It has to cost no mana, has to have no cast time, in your case it has to have either 0 second duration (0 seconds should leave that buff up infinitely) and it has to be usable right from the start (in other words, it must not require any upgrades/researches done by the player). Also, it has to have cast range big enough to reach the target of the ability.

#5
I add a 2 second generic expiration timer - that basically means that the dummy unit will die after 2 seconds, if you set it's Combat - Death Type correctly, it will leave no (invisible) corpse.

#6
Currently, there are 2 problems:
1st problem is that your hero can repeatedly buy/pick up other belts of strength and he will gain additional 6 strength per Belt he took. Since you remove the item, he will have empty slots, so there is no restriction to the number of belts he can pick up (meaning he can gain infinite strength, as long as he picks belts).
This can be prevented by putting in this condition:
  • ((Triggering unit) has buff YOUR_BUFF_HERE) Equal to True
That buff has to be the same as the one your custom spell applies.

2nd problem:
Buffs disappear when your hero dies. So when your hero is resurrected, he will not have that buff. You will need to keep that hero saved in some variable and when he resurrects, reapply that buff on him (you do that again through dummy unit)
 
Last edited:
Level 3
Joined
Jun 23, 2013
Messages
54
How about add the unit spell book ability that has the same ability as the item inside. And hide the spellbook icon
And how about active skill that provide buff such frenzy, make the duration 0 and add it to the dummy, then order the dummy to cast it to your hero. The buff will stay forover but able to be removed with purge etc.
 
Level 8
Joined
Oct 12, 2011
Messages
483
You could create a spell based on Tornado Slow Aura and create a custom buff to go along with it. Then add the ability when you need the buff and remove it when you no longer need to. Seems much easier than triggering it.
 
Level 20
Joined
Jul 14, 2011
Messages
3,213
I would add the ability to a hidden spellbook, else, any silence or buff removal or something would mess up the thing.
 
Status
Not open for further replies.
Top