Spell Fortitude

Darthfett

Aerospace/Cybersecurity Software Engineer
Reaction score
615
This is the first spell I have made in vjass after reading romek's tutorial and darth's and some other, so, I should use a timer for the polled wait?

Either a timer with a callback function, a TriggerSleepAction, or a custom polled wait function which does not leak.
 

wraithseeker

Tired.
Reaction score
122
Sorry for the dumb question, I know how to do triggersleepaction but how do you do a timer with a callback function, requires a attachment system right? I want to make things simple:p.

EDIT: New verison now 1.1.
 

Darthfett

Aerospace/Cybersecurity Software Engineer
Reaction score
615
Sorry for the dumb question, I know how to do triggersleepaction but how do you do a timer with a callback function, requires a attachment system right? I want to make things simple:p.

EDIT: New verison now 1.1.

Yes it does, if you want to pass local variables over to the callback function.

If you're just curious on how to start another function with a timer, take a look at the TimerStart function:

JASS:
function TimerStart(timer Timer, real Time, boolean isPeriodic, code FunctionToRun)

//and you call it like this:

function myfunction takes nothing returns nothing
    local timer t = GetExpiredTimer()
endfunction

call TimerStart(t,0.5,true,function myfunction)


Usually, you only need a timer for really accurate, and/or short intervals. If you're not concerned about accuracy, and don't need to wait a short interval (anything less than 0.1 should use a timer), then just use TriggerSleepAction.
 

wraithseeker

Tired.
Reaction score
122
No I mean I'll need a attachment system to pass over attacking unit and TriggerUnit don't I? I remembered me asking some time ago..

When will this be approved? Anymore things to fix?
 

Viikuna

No Marlo no game.
Reaction score
265
Using one dummy was actually my idea. :)

And yes, there is no point of adding/removing spell, unless you need your dummy to be able to cast more than 7 different spells.

And you should use SetUnitAbilityLevel native,. instead of SetUnitAbilityLevelSwapped.
 

wraithseeker

Tired.
Reaction score
122
well I am lazy, brb, Isn't using one dummy making it not Mui, like 10 units cast it at once what will happen. I'm currently doing a request for someone.
 

Viikuna

No Marlo no game.
Reaction score
265
Nope, its MUI. Try to make a warstomp using one Dummy, its completely possible.

Im actually going to try if I can make my map use only one dummy for all spells.
 

Viikuna

No Marlo no game.
Reaction score
265
Do as you wish. Using one dummy just feels the simplest and most functional way to do spells, at least for me.

Ahm... why isn't ownership of the dummy changed? If the Stormbolt does any damage, you do have an issue with kill credit coming into play

I would just use UnitDamageTarget. This way hero gets the credit from kill, not dummy.
 

Azlier

Old World Ghost
Reaction score
461
Using one dummy can indeed affect MUI. Let's say that you were casting one ability, and the dummy appears to cast, but he is called by another before he can. Boom, MUI shredded to bits.
 

Flare

Stops copies me!
Reaction score
662
If the dummy's Animation - Backswing Time and Animation - Cast Point are set to 0.000, and the casting time of the dummy spell is 0, it'll be difficult to break the MUI capabilities of the spell (there would still be a slight delay in casting, but it would only be a fairly small fraction of a second) since you'd need 2+ instances within 0.2 seconds of each other (0.2 is just a rough guess, it may be a bit lower), although it's still not guaranteed.

If you want a sure-fire test,
  • Set Animation - Backswing Time and Animaton - Cast Point of your testing hero to 0.000, and the main spell's casting time/cooldown to 0
  • Make a simple trigger that displays a message when the dummy casts the spell (see below)
  • Move your hero away from the target (400-500 distance away outside of cast range should be fine)
  • Give a number of shift-click orders with the spell (i.e. click spell, hold Shift, repeatedly click same target), 3 or 4 should do, just make sure you know how many orders are issued
  • If the messages are displayed the same number of times as the amount of orders given, you should be fine - otherwise, you'd be better off going the safe route and making a dummy per instance
If a unit is unable to break MUI through spam-casting with a very fast cast rate, it's unlikely that multiple players will be able to achieve the same effect (since the spell will probably have a cooldown in a normal map, and I doubt players would be that lucky :p)

And the simple test trigger :p
Code:
Unit starts the effect of an ability

Ability being Cast == Dummy Spell

Display the text: "Dummy cast spell" to (All players)
Code:
 

wraithseeker

Tired.
Reaction score
122
I'll give it a try..

WAIT

First of all, you forgot that this was a passive ability..
So you can't shift click.
and they get stunned so you can't spam it like mad.

Verison 1.2 is out and will most probaby be the last verison.
 

Viikuna

No Marlo no game.
Reaction score
265
When this dummy casts a spell, it doesnt take any time, so it should be MUI. If it would take any time to cast a spell, this could not work at all, because that RemoveAbility -call.

Wait, you removed that UnitRemoveAbility, but left UnitAddAbility there.
If you dont wanna remove ability after spell cast, you should move that UnitAddAbility to your Init function.
 

Flare

Stops copies me!
Reaction score
662
First of all, you forgot that this was a passive ability..
Indeed I did :eek: Give the unit an insanely high attack speed (in the region of <0.05s, just make sure that the Combat - Backswing and Damage Point are at 0.000), set the CHANCE factor to 100, and increment a variable for each attack (using Unit is Attacked) performed, and each message displayed, and check if the numbers are in line with each other?
 

Viikuna

No Marlo no game.
Reaction score
265
Flare you can test it by yourself too. Just pick 10 units to group, loop trought that group and order that one dummy to stun them all. It doesnt take any time to cast, so they all get stunned exactly same time.
 

Flare

Stops copies me!
Reaction score
662
Bleh, got mixed up in the usage of the spell - thought it was a chance for your attacks to stun, not for attacks against you to stun the attacker :p Still, doesn't mean 10 different units can't attack at once ^_^

Again, going by latest code, dummy ownership isn't being changed - Player 1 (Red) will always get credit for any kills resulting from this ability (if the Stormbolt does damage, or if people decide to add damage to the Stormbolt via Object Editor). Also, if the attacker is an ally of Player 1 (Red), will the dummy be able to issue the order (since the unit is allied to it)
 
General chit-chat
Help Users
  • No one is chatting at the moment.

      The Helper Discord

      Members online

      Affiliates

      Hive Workshop NUON Dome World Editor Tutorials

      Network Sponsors

      Apex Steel Pipe - Buys and sells Steel Pipe.
      Top