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

Custom ability creation

Status
Not open for further replies.
Level 7
Joined
Feb 9, 2010
Messages
298
Hello guys I am trying to do an ability based on Curse spell.

What I need to achieve:

Every unit on map no matter Neutral, Enemy or Ally should have a version of Curse cast upon (with removed buff and effect) so when ever unit misses to have the '' miss '' over it's head.

What I have so far:

I have 3 neutral units casting Curse every 1 sec on random 3 units in playable map area.
(I can not post the trigger itself right now as I am not in front of my PC at the moment, will do so later)
Although this does the trick it is still not flawless. I wonder how this will affect the game after playing the map for 3-4 hours for example.
It is a bit slow it casts on all units on the map but quite slow I might say.
It also happens to cast on the same unite more than once before casting on a unit which does not have the spell cast on yet.

So if anyone has some better idea please do share with me.
 
I'm not sure what you are trying to achieve... You only want to cast curse on a unit that isn't already affected by the buff? In that case...

maxLoop = 0
custom script: loop
temp_Unit = pick random unit
maxLoop = maxLoop + 1
custom script: exit when (check if the unit has specific buff == false) or maxLoop == 10 <-- I cant remember how to check if unit has buff in jass. Just use the gui version and convert to custom script

custom script: endloop

if unit has buff == false
cast spell on unit


maxLoop is used to prevent an infinite loop if all units in the map already has a buff. you can change the maxLoop limit if you want.

sorry for bad trigger - I'm also not at my pc lol
 
Level 12
Joined
Jan 2, 2016
Messages
973
Why don't you just give units evasion instead?
You can disable it to hide its icon.
If it doesn't work - put in in a spellbook, and disable the spellbook.

Either give the spellbook to all the units you have on your map trough the object editor, either have a trigger, that gives it to units that enter playable map area.
Think you should also manually give it to all the units you already have on the map (if you chose the 2-nd way), in the 0.00 second of the game. (Pick all units in playable map area, and give it to them)
 
Level 26
Joined
Aug 18, 2009
Messages
4,097
Is the Curse miss different from the normal miss? Explain more about what you want to achieve.

Your approach is of course very inefficient. Why is it 3 dummy units? If you change the target flags or the owner each time, one is at least theoretically enough. But simply randoming which target to cast on, some may never be bestowed and/or it takes a significant duration. Rather than scheduling it periodically, it would be better to only do it when a unit does not have the buff -> right after creation. However, Curse is an applied, active buff, which can be lost through a lot of means like death, dispel, magic immunity. So you would have to track all of them if you wanted to apply it just in time but even then, magic immunity e.g. is a state, how do you want it to coexist?

If you are using GUI, you will probably leak, too, as the unit group pick there is flawed/you cannot pick without creating a new unit group object/you have no access to appropriate destroy actions.
 
Level 7
Joined
Feb 9, 2010
Messages
298
Ok guys I see I have not been very clear with what I want to achieve, sorry for that.

I will go more into details.
I want to have every unit in the game (no matter whether player, neutral, present at the start of the map or trained later) to has a chance to miss but curse spell type not evasion type.
Clearer to say like the miss chance that the units have from game default but with the miss sign on top of them every time they miss.
That's all. That's why I decided to use Curse as the base for that.

There are not going to be any dispel or magic immunity in the game.

I know it is best to be done with jass but I can't work with jass...

Hope it is clearer now.
 
Level 7
Joined
Feb 9, 2010
Messages
298
Yes but in the case of evasion the 'miss' comes on top of the attacked unit or am I wrong?
 
Level 7
Joined
Feb 9, 2010
Messages
298
If that is so, then I would like to be excused for creating such a silly Thread. Thanks everyone and especially to you WereElf.

Moderator, please mark thread as Solved. :)
 
Level 11
Joined
Aug 24, 2012
Messages
429
Keep in mind that there is an innate miss chance in WC3, I think it works for units that are either fleeing or on higher ground than the attacker.

I'm not sure how it exactly works, but from my understanding it is a 50% chance to reduce an attack by 50%. This can be altered in the gameplay constants.
 
Status
Not open for further replies.
Top