• 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] Loading a Game Cache..

Status
Not open for further replies.
Level 2
Joined
Jun 3, 2006
Messages
7
I made a spell which is based off Shadow Strike. It's called Holy Defender

I want it to work that when the Hero has used the spell on an enemy, he gets a buff (the buff part works, the unit gets the buff) but I want it to work that when the enemy tries to cast a spell while the buff is active, he takes damage.
Tried (first time) working with Game Cache, but I couldn't figure it out.. Any tips?

Here's my 2 triggers:
Holy Prevention
Events
Unit - A unit Starts the effect of an ability
Conditions
(Ability being cast) Equal to Holy Prevention
Actions
Game Cache - Store (Casting unit) as HolyDef of StoredHeroes in HolyDefender
Trigger - Turn on Holy Prevention 2 <gen>

Holy Prevention 2
Events
Unit - A unit Starts the effect of an ability
Conditions
((Casting unit) has buff Holy Prevention ) Equal to True
Actions
Set HolyDefender = (Last created game cache)
Unit Group - Pick every unit in (Units of type (Unit-type((Load HolyDef of StoredHeroes from (Last created game cache))))) and do (Actions)
Loop - Actions
Unit - Cause (Picked unit) to damage (Casting unit), dealing 500.00 damage of attack type Spells and damage type Normal


I've searched the forum but no results...
 
Last edited:
Level 5
Joined
Sep 13, 2007
Messages
33
Please next time wrap your trigger in trigger tag.

Do something like this:

  • Untitled Trigger 001
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
      • ((Triggering unit) has buff <Buff>) Equal to True
    • Actions
      • Unit - Set life of (Triggering unit) to ((Life of (Triggering unit)) - <Real>)
 
Level 2
Joined
Jun 3, 2006
Messages
7
Right, sorry. Will do that in the future.

But that trigger doesn't work, since I want the hero that put the buff on him to get the credits for eventual kills. In other words, my Hero won't damage the unit.
 
Last edited:
Level 5
Joined
Aug 16, 2007
Messages
149
  • Holy Prevention
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
      • (Ability being cast) Equal to Holy Prevention
    • Actions
      • Game Cache - Store (Casting unit) as HolyDef of StoredHeroes in HolyDefender
      • Trigger - Turn on Holy Prevention 2 <gen>
  • Holy Prevention 2
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
      • ((Casting unit) has buff Holy Prevention ) Equal to True
    • Actions
      • Set HolyDefender = (Last created game cache)
  • Unit Group - Pick every unit in (Units of type (Unit-type((Load HolyDef of StoredHeroes from (Last created game cache))))) and do (Actions)
    • Loop - Actions
  • Unit - Cause (Picked unit) to damage (Casting unit), dealing 500.00 damage of attack type Spells and damage type Normal
a few problems with those triggers:
#1: why did you set HolyDefender in Holy Prevention 2? It's already set or you wouldn't have been able store a unit in it before.
#2: you forget to create the game cache in the first place! Do it like this:
  • Game Cache - Create a game cache from HolyDefender.w3v
  • Set HolyDefender = (Last created game cache)
#3: What's the point using a game cache anyway? It just slows down the triggers and doesn't make them MUI!
 
Level 2
Joined
Jun 3, 2006
Messages
7
Okay, but if I don't use a game cache, my Hero won't be the damaging source. Like for example if a unit with the buff casts a spell and gets 500 damage, my Hero wouldn't be awarded with the gold.
Unless there's another way..?
 
Level 5
Joined
Aug 16, 2007
Messages
149
store it in a global... then do the same except use the global from the "pick every unit matching" function
 
Last edited:
Status
Not open for further replies.
Top