• 🏆 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!

[Trigger] Trying to make a summonable skill - help plz - read first.

Status
Not open for further replies.
Level 5
Joined
Aug 8, 2008
Messages
113
Ok this is the skill im trying to create..... it works like mana shield but for summonables.

What this means is the summons do not take damage but the main hero loses mana whenever the summonable takes damage. If mana falls below a certain point the summonable dies.


What I have so far (and not working or i wouldnt be here)

Also The skill is having some issues with eh casting...It doesn't work unless I cast another skill I have already finished first
  • Unit 2
    • Events
      • Unit - Priestess of the Moon 0000 <gen>'s mana becomes Greater than or equal to 50.00
    • Conditions
      • (Attacked unit) Equal to varg
    • Actions
      • Set sloop = (Damage taken)
      • Unit - Set life of varg to (sloop + (Life of varg))
      • Unit - Set mana of Priestess of the Moon 0000 <gen> to ((Mana of Priestess of the Moon 0000 <gen>) - sloop)
  • unit 1
    • Events
      • Unit - Priestess of the Moon 0000 <gen>'s mana becomes Greater than or equal to 50.00
    • Conditions
      • (Attacked unit) Equal to Worv
    • Actions
      • Set loop = (Damage taken)
      • Unit - Set life of Worv to (loop + (Life of Worv))
      • Unit - Set mana of Priestess of the Moon 0000 <gen> to ((Mana of Priestess of the Moon 0000 <gen>) - loop)
  • wolves create
    • Events
      • Unit - A unit owned by Player 1 (Red) Begins casting an ability
    • Conditions
      • (Ability being cast) Equal to Wolves
    • Actions
      • Unit - Kill varg
      • Unit - Kill Worv
      • Set timer_2 = 0
      • Wait until (timer_2 Equal to 2), checking every 0.10 seconds
      • Unit - Create 1 Varg (Level 3) for Player 1 (Red) at (Position of Priestess of the Moon 0000 <gen>) facing (Position of Priestess of the Moon 0000 <gen>)
      • Set varg = (Last created unit)
      • Unit - Create 1 Worven (Level 3) for Player 1 (Red) at (Position of Priestess of the Moon 0000 <gen>) facing (Position of Priestess of the Moon 0000 <gen>)
      • Set Worv = (Last created unit)
 
Level 7
Joined
Jun 28, 2013
Messages
395
Cast another skill finish first to cast this skill? Do this spell and "another spell" have the same Spell ID?
 
Level 25
Joined
Sep 26, 2009
Messages
2,381
There's no (damage taken), hence that will return 0.
Where do you increase timer_2? You set its value to 0 and then you wait until its value is 2... where do you increase its value?

Unless you used it for some specific reason, the event "Begins casting an ability" should be changed for "Starts the effect of an ability".

Also, due to how you set up the trigger "Unit 2", I have high doubts it will ever run.
 
Level 7
Joined
Jun 28, 2013
Messages
395
I thought the Unit 2 and Unit 1 trigger's event should be a unit is attacked. Only then the trigger will start cuz the condition is based on unit getting attacked or something..
 
Level 5
Joined
Aug 8, 2008
Messages
113
I thought the Unit 2 and Unit 1 trigger's event should be a unit is attacked. Only then the trigger will start cuz the condition is based on unit getting attacked or something..
I tried "unit is attacked" it still doesn't work.


There's no (damage taken), hence that will return 0.
Where do you increase timer_2? You set its value to 0 and then you wait until its value is 2... where do you increase its value?

Unless you used it for some specific reason, the event "Begins casting an ability" should be changed for "Starts the effect of an ability".

Also, due to how you set up the trigger "Unit 2", I have high doubts it will ever run.

I tried all of that it doesn't run with those either.

There's no (damage taken), hence that will return 0.
Where do you increase timer_2? You set its value to 0 and then you wait until its value is 2... where do you increase its value?
Here is the timer trigger. This works I didn't have a problem with it so i didnt include it.
  • timer
    • Events
      • Time - Every 1.00 seconds of game time
    • Conditions
    • Actions
      • Set timer = (timer + 1)
      • Set timer_2 = (timer + 1)
      • Player - Add 1 to Player 1 (Red) Current lumber
 
Level 25
Joined
Sep 26, 2009
Messages
2,381
Is the timer variable used for the spell the other unit uses? If so, it would explain why your problematic spell works only after the other unit casts the other spell, because in this trigger:
  • timer
    • Events
      • Time - Every 1.00 seconds of game time
    • Conditions
    • Actions
      • Set timer = (timer + 1)
      • Set timer_2 = (timer + 1)
      • Player - Add 1 to Player 1 (Red) Current lumber
You increase value of timer_2 by (timer + 1) <- you use different variable for incrementing.
This is just my assumption, but I think that when the other unit casts the other spell, the variable timer is set to 0, which explains why your problematic spell works only after that, because the calculation after 1 second is:
timer = timer + 1 (so it has value 1 right now)
timer_2 = timer + 1 (so it takes timer, which has value 1 and increments it by 1) -> timer_2 now has value 2, which is needed for the wait in "wolves create" trigger and so the spell fires.

The (damage taken) returns damage unit took, however it requires the "Unit - <specific unit> takes damage" event - it doesn't work with any different event.


Unit1 and Unit2 triggers will never fire, because the condition checks if (Attacked unit) = worv/varg, however the event "Unit - Unit's mana becomes ..." has no (Attacked unit), so the condition will always be false
(there is no attacked unit and "No unit" is not equal to worv/varg, so it returns false).


Actually, to make this spell work and be bug-proof, you will need Damage Detection System (DDS) <- it's system made by people for other people, you can download it in the spell section here on hive (e.g. http://www.hiveworkshop.com/forums/...earch=damage%20detection%20system&d=list&r=20) <- you import the system in your own map (how to do that is written in the map's triggers) and you use the system instead.

then it is just a matter of capturing when Worv/Varg takes damage and reduce the mana of their owner.
 
Why not just:

Events - Priest's mana becomes less than or equal to 50.00
Conditions -
Actions -
Kill Varg_Var
Kill Worv_Var

Have Varg and Worv have the Hardened Skin ability with a damage reduction of 999999 and a minimum damage taken 0.

Event - A unit starts the effect of an ability
Conditions - Ability being cast Equal to Wolves
Actions -
If -
Mana of triggering unit Less than or equal to 50.00
Then -
Else -
Set Temp_Point position of triggering unit
Kill Varg_Var
Kill Worv_Var
Create 1 Varg_Var at Temp_Point bla bla bla
Set Varg_Vat = Last Created Unit
Create 1 Worv_Var at Temp_Point bla bla bla
Set Worv_Vat = Last Created Unit
Create 1 Varg_Var at Temp_Point bla bla bla
Custom script: call RemoveLocation (udg_pTemp_Point)
 
Level 5
Joined
Aug 8, 2008
Messages
113
but the point of the skill is to drain mana from the hero when the summonable is attacked. so you would still need to detect the damage the summonables take.

I think none of the variables are working but im not sure..... when I run
  • Damage Taken
    • Events
      • Time - Every 0.80 seconds of game time
    • Conditions
    • Actions
      • Game - Display to (All players) the text: (Varg takes + ((String(dtw)) + damage))
      • Game - Display to (All players) the text: (Worven takes + ((String(dtw_Copy)) + damage))
this trigger runs but it shows that the damage taken is 0........


------------------------------------- what I have so far ----------------------------------
  • Melee Initialization
    • Events
      • Time - Elapsed game time is 0.01 seconds
    • Conditions
    • Actions
      • Trigger - Add to Take Damage Varg <gen> the event (Unit - Wolves Takes damage)
      • Trigger - Add to Take Damage Worgen <gen> the event (Unit - Wolves_Copy Takes damage)
      • Trigger - Add to Destroy Summons <gen> the event (Unit - Wolves_Copy Takes damage)
      • Trigger - Add to Destroy Summons <gen> the event (Unit - Wolves Takes damage)
  • Ability Cast
    • Events
      • Unit - Priestess of the Moon 0000 <gen> Starts the effect of an ability
    • Conditions
      • (Ability being cast) Equal to Worgen and Varg
    • Actions
      • Unit - Kill Wolves
      • Unit - Kill Wolves_Copy
      • Unit - Create 1 Varg (Level 3) for Player 1 (Red) at (Center of (Playable map area)) facing Default building facing degrees
      • Set Wolves = (Last created unit)
      • Unit - Create 1 Worgen (Level 3) for Player 1 (Red) at (Center of (Playable map area)) facing Default building facing degrees
      • Set Wolves_Copy = (Last created unit)
  • Destroy Summons
    • Events
      • Unit - Priestess of the Moon 0000 <gen>'s mana becomes Less than 10.00
    • Conditions
    • Actions
      • Unit - Kill Wolves
      • Unit - Kill Wolves_Copy
  • Take Damage Varg
    • Events
      • Unit - Priestess of the Moon 0000 <gen>'s mana becomes Greater than or equal to 10.00
    • Conditions
    • Actions
      • Set dtw = (Damage taken)
      • Unit - Set life of Wolves to (dtw + (Life of Wolves))%
      • Unit - Set mana of Priestess of the Moon 0000 <gen> to ((Mana of Priestess of the Moon 0000 <gen>) - dtw)
  • Damage Taken
    • Events
      • Time - Every 0.80 seconds of game time
    • Conditions
    • Actions
      • Game - Display to (All players) the text: (Varg takes + ((String(dtw)) + damage))
      • Game - Display to (All players) the text: (Worven takes + ((String(dtw_Copy)) + damage))
  • Take Damage Worgen
    • Events
      • Unit - Priestess of the Moon 0000 <gen>'s mana becomes Greater than or equal to 10.00
    • Conditions
    • Actions
      • Set dtw_Copy = (Damage taken)
      • Unit - Set life of Wolves_Copy to (dtw_Copy + (Life of Wolves_Copy))%
      • Unit - Set mana of Priestess of the Moon 0000 <gen> to ((Mana of Priestess of the Moon 0000 <gen>) - dtw_Copy)
-------------------since applying nich's suggestion about the damage detection-------------------------
  • Set Damage Copy
    • Events
      • Game - DamageModifierEvent becomes Equal to 1.00
    • Conditions
      • DamageEventOverride Equal to False
    • Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • ((Unit-type of DamageEventTarget) Equal to Varg (Level 3)) or ((Unit-type of DamageEventTarget) Equal to Worven (Level 3))
        • Then - Actions
          • Custom script: call SetUnitManaBJ( gg_unit_E000_0001, ( GetUnitStateSwap(UNIT_STATE_MANA, gg_unit_E000_0001) - udg_DamageEventAmount ) )
          • Set DamageEventOverride = True
          • Set DamageEventAmount = ((DamageEventAmount - DamageEventAmount) + 0.00)
        • Else - Actions
it works but i was wondering how to make it mui for the priestess.
 
Last edited:
Status
Not open for further replies.
Top