• 🏆 Texturing Contest #33 is OPEN! Contestants must re-texture a SD unit model found in-game (Warcraft 3 Classic), recreating the unit into a peaceful NPC version. 🔗Click here to enter!
  • It's time for the first HD Modeling Contest of 2024. Join the theme discussion for Hive's HD Modeling Contest #6! Click here to post your idea!

[Spell] Armor for a few seconds

Status
Not open for further replies.
Level 6
Joined
Sep 19, 2006
Messages
179
  • Poison Protection
    • Events
      • Time - Every 10.00 seconds of game time
    • Conditions
      • (Level of Poison Protection for (Summoning unit)) Greater than 0
      • (Unit-type of (Summoning unit)) Equal to Poison Elemental
    • Actions
      • Unit - Add Armor Increase to (Summoning unit)
      • Wait 5.00 seconds
      • Unit - Remove Armor Increase from (Summoning unit)
I'm sure: (Level of Poison Protection for (Summoning unit)) Greater than 0 is pointless.
The idea is I want to give 5 armor for my poison elemental for 5 seconds every time 10 seconds have passed. Any help here?
 
Level 20
Joined
Aug 29, 2012
Messages
825
You have to store your elemental in a variable, right now (summoning unit) equals to 0 because your event doesn't refer to any unit (and I think you meant summoned unit anyway).

Can you have multiple elementals at once? If so, that will be a bit more tricky.
 
Level 9
Joined
Apr 23, 2011
Messages
527
When the Poison Elemental is spawned, store it in a variable as Chaosium says.

  • spawn
    • Events
      • A unit Starts the effect of an ability
    • Conditions
      • (Ability being cast) Equal to <your ability>
    • Actions
      • Set poisonelemental = (Summoned unit)
If there are multiple Poison Elementals, use a repeating timer that expires every 5 seconds and an integer for your armor trigger.

  • armor
    • Events
      • Time - poisontimer expires
    • Conditions
    • Actions
      • Set poisoncount = (poisoncount + 1)
      • Set poisongroup = (Units of type Poison Elemental)
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • ---------- after 5 seconds have passed ----------
          • poisoncount Equal to 1
        • Then - Actions
          • Unit Group - Pick every unit in poisongroup and do (Actions)
            • Actions
              • Unit - Add Armor Increase to (Picked unit)
        • Else - Actions
          • ---------- after 10 seconds have passed ----------
          • Set poisoncount = 0
          • Unit Group - Pick every unit in poisongroup and do (Actions)
            • Actions
              • Unit - Remove Armor Increase from (Picked unit)
 
Level 6
Joined
Sep 19, 2006
Messages
179
That's really good, but that ability is passive. Can that code above work even for a passive ability?
 
Level 6
Joined
Sep 19, 2006
Messages
179
I'll have to figure a way to use this code, since the tower summons it via an edited version of Parasite.
 
Level 12
Joined
Nov 3, 2013
Messages
989
I'll have to figure a way to use this code, since the tower summons it via an edited version of Parasite.
Afaik units summoned by parasite still fire the "a unit is summoned" event, the summoned & summoning unit event responses also work as they should.
Well you could use sth like this:
  • Events
    • Unit - Unit enters (Playable Map Area)
  • Conditions
    • (Unit-type of (Entering unit)) Equal to Poison Elemental
  • Actions
    • Set poisonelemental = (Entering unit)
Dunno if that work though. :p (Unit Event is recommended here 'coz it also detect thingies like this)
It's better to use the "a unit is summoned" "a unit spawns a summoned unit" event since this will also allow you to see which unit was the source/cast parasite in this case.

  • Untitled Trigger 001
    • Events
      • Unit - A unit Spawns a summoned unit
    • Conditions
      • (Unit-type of (Summoned unit)) Equal to Poison Elemental
    • Actions
      • Set summonerVar = (Summoning unit)
      • Set summonedVar = (Summoned unit)
 
Last edited:
Level 9
Joined
Apr 23, 2011
Messages
527
If the elementals are spawned through Parasite, the second trigger I provided should work if that is what you want, since it does not need any ability to trigger and works on a time basis.
 
Status
Not open for further replies.
Top