Preventing an unit from attacking for X seconds?

Carl-Fredrik

New Member
Reaction score
51
Hi everyone! :)

I'm trying to simply make an unit unable to attack while using the Divine Shield (Called Spiritual State in my map), I tried to make a Silence ability and then let a dummy unit use it on the hero when it becomes invulnerable but it doesn't work for some reason :/ Any suggestions?


Ability Name: Silence (Dummy)
Attacks Prevented: Melee, Ranged
Targets allowed: Air, Ground, Invulnerable, Organic, Player Units

Code:
Spiritual State
    Events
        Unit - A unit Starts the effect of an ability
    Conditions
        (Ability being cast) Equal to Spiritual State 
    Actions
        Set SS_CasterPoint = (Position of (Triggering unit))
        Unit - Create 1 Dummy [No Model] for (Owner of (Triggering unit)) at SS_CasterPoint facing Default building facing degrees
        Set SS_Unit = (Last created unit)
        Unit - Add Silence (Dummy) to SS_Unit
        Unit - Set level of Silence (Dummy) for SS_Unit to (Level of Spiritual State  for (Triggering unit))
        Unit - Order SS_Unit to Neutral Dark Ranger - Silence SS_CasterPoint

Thanks in advance!
// Carl-Fredrik

Edit: I saw a script earlier that removed the "Move" ability, maybe there's a script for removing Attack too? :) (Then I'd add it again after X seconds)
 

Samael88

Evil always finds a way
Reaction score
181
Disable the units attack then wait a while and add it enable it again:thup:
Edit: I don't remember the exact way of doing it tho, but I know that it can be done thru triggers:)
 

Carl-Fredrik

New Member
Reaction score
51
Disable the units attack then wait a while and add it enable it again:thup:
Edit: I don't remember the exact way of doing it tho, but I know that it can be done thru triggers:)

What action for preventing the attack?

Edit: I saw your edit now.. I'm quite sure there's no such action :/
 

nomadian

Member
Reaction score
9
hmm you could add ability cargo hold orc barrow, and then take it away after. That stops attack. Alternatively, you can pause the unit. Or you could suck all it's mana so it can't cast anything for a few minutes.
 

Carl-Fredrik

New Member
Reaction score
51
Give it 100% miss?

Well, it would work, but long time ago I downloaded a spell... which did just like this, when I got better at mapping I realised that it had some few... issues, though ^^

*Leaks
*Not MUI
*Fade Filters all players
*Not MPI

So I erased it, and I can't find it to check how he did it :/ But there must be some way.. I think he was using the silence spell :/

I saw a script once that removed the "Move" ability, maybe there's a script for removing Attack too? (Then I'd add it again after X seconds)
 

Exide

I am amazingly focused right now!
Reaction score
448
Give the unit an ability: 'Cargo (Orc Burrow)'
-Then it won't be able to attack.

Remove that ability, and it will be able to attack again.
 

Carl-Fredrik

New Member
Reaction score
51
Give the unit an ability: 'Cargo (Orc Burrow)'
-Then it won't be able to attack.

Remove that ability, and it will be able to attack again.
Code:
Spiritual State Copy
    Events
        Unit - A unit Starts the effect of an ability
    Conditions
        (Ability being cast) Equal to Spiritual State 
    Actions
        Set SS_Caster = (Triggering unit)
        Set SS_CasterPoint = (Position of (Triggering unit))
        Unit - Add Cargo Hold (Orc Burrow) to SS_Caster
        Wait (7.00 + (4.00 x (Real((Level of Spiritual State  for SS_Caster))))) game-time seconds
        Unit - Remove Cargo Hold (Orc Burrow) from (Triggering unit)

Like that? That doesn't work at least... is that what you meant? (If it would matter, it's a Hero that uses the ability)
 

Nexor

...
Reaction score
74
if it affects only Heroes, then set it to Hero
if it affects allied units, add Allied,Friend
 

Exide

I am amazingly focused right now!
Reaction score
448
Code:
Spiritual State Copy
    Events
        Unit - A unit Starts the effect of an ability
    Conditions
        (Ability being cast) Equal to Spiritual State 
    Actions
        Set SS_Caster = (Triggering unit)
        Set SS_CasterPoint = (Position of (Triggering unit))
        Unit - Add Cargo Hold (Orc Burrow) to SS_Caster
        Wait (7.00 + (4.00 x (Real((Level of Spiritual State  for SS_Caster))))) game-time seconds
        Unit - Remove Cargo Hold (Orc Burrow) from (Triggering unit)

Like that? That doesn't work at least... is that what you meant? (If it would matter, it's a Hero that uses the ability)


Yes, like that.
It should work.
It doesn't matter if it's a Hero or not.

Change this:
Code:
Unit - Add Cargo Hold (Orc Burrow) to SS_Caster

into this:
Code:
Unit - Add Cargo Hold (Orc Burrow) to (Triggering Unit)
 

Carl-Fredrik

New Member
Reaction score
51
Yes, like that.
It should work.
It doesn't matter if it's a Hero or not.

Change this:
Code:
Unit - Add Cargo Hold (Orc Burrow) to SS_Caster

into this:
Code:
Unit - Add Cargo Hold (Orc Burrow) to (Triggering Unit)



Doesn't work....

Code:
Spiritual State SFX
    Events
        Unit - A unit Starts the effect of an ability
    Conditions
        (Ability being cast) Equal to Spiritual State 
    Actions
        Animation - Change (Triggering unit)'s vertex coloring to (100.00%, 100.00%, 100.00%) with 30.00% transparency
        Wait (4.00 x (Real((Level of (Ability being cast) for (Triggering unit))))) game-time seconds
        Animation - Change (Triggering unit)'s vertex coloring to (100.00%, 100.00%, 100.00%) with 0.00% transparency
        Unit - Add Cargo Hold (Orc Burrow) to (Triggering unit)

And the (Triggering Unit) still works, I know since the transparency is changed back :/
 

Exide

I am amazingly focused right now!
Reaction score
448
>Doesn't work....
-Very weird..
Check out this test map that I attached below.
 
General chit-chat
Help Users
  • No one is chatting at the moment.

      The Helper Discord

      Staff online

      Members online

      Affiliates

      Hive Workshop NUON Dome World Editor Tutorials

      Network Sponsors

      Apex Steel Pipe - Buys and sells Steel Pipe.
      Top