HomeUser Control Panel (unavailable in archive)ForumsTutorialsArt GalleryResourcesMaps

Replacing Sleep Spells (Or, Stopping Spells After Cast)

09-20-2002, 02:09 PM#1
Guest
I was able to do the following and stop a sleep spell from firing. I tested it repeatedly in single player and once on battle.net with one other player. Neither of us could sleep the target (same target) even when we were both going at it.

-------

event: unit is given an order targeting a unit
condition: order is "sleep"

actions:

wait 0.001
pause caster
wait 0.001
issue caster immediate order "stop"
wait 0.001
unpause caster

-------

The unit begins like one or two frames of the casting animation and then abrubtly stops, going back to stand, but the sleep spell never goes off and mana is never drained from the caster.

Can somebody else try this out? I made a small test map, 32x32 with one neutral passive villager and my casting unit. Plus the above trigger.

This is cool, because it means I can now effectively replace the sleep spell. I mean, after the unpause above I can do something like:

-------

play animation on caster

if target not within range then skip remaining

subtract mana from caster

change owner of target to neutral passive

put target to sleep

loop 1 to duration

wait 1.0
if target is not sleeping then exit loop

endloop

change owner of target to original owner

-------

Range is whatever I define it as. I can base it on whatever I like. Level of the caster, time of day, etc., etc. Likewise with the mana subtracted from caster, as well as duration.

If this works for sleep, it should work for just about anything.

What do you guys think?

Care.
09-20-2002, 02:47 PM#2
h0pesfall
ive done the same thing with Starfall several weeks ago, replacing it with a Timestop spell :P it works and its pretty cool...
09-21-2002, 12:06 AM#3
ChronOmega
can someone tell me how to find the "unit is issued an order targeting unit" and the "order is "sleep"" things cause i cant find em

ok i found the type of order thing
09-21-2002, 01:49 AM#4
DemonicSoul
its an event
unit- unit player owned unit event (or unit-specific unit event)
unit owned by <player> is issued an order targeting an object
use event response- targeted unit to refer to it
09-21-2002, 03:25 AM#5
dataangel
Me and Technetium did this on a much higher level with our Trigger Spell project...which still needs updating (there's a few glitches that you'd only encounter if you played a game with lots of casters, this map only has a few) I've attached it here so you can take a look.

Generally it's much easier to stop units from casting by replacing them with an identical unit : )

Hopefully I'll get around to perfecting the system and writing a tutorial someday...
09-21-2002, 04:59 AM#6
Guest
Quote:
Originally posted by dataangel
Generally it's much easier to stop units from casting by replacing them with an identical unit : )
I don't think this will work for heroes, however. When I tried replacing the hero, he lost all his allocated skill pts. Heh.

Prolly work ok for non-hero units though.

Care.
09-21-2002, 06:31 AM#7
Guest
does pausing a unit also deselects it?
if so, how would you stop that?
09-23-2002, 09:30 PM#8
Guest
Quote:
Originally posted by ogz
does pausing a unit also deselects it?
No, I don't think it does.

When my vampires infuse a targeted villager (I capture the blood lust spell and customize the effect), I pause the infusing vampire for like 10 seconds and then unpause it. Pausing only seems to remove all command icons on the right. The unit's stats still stay displayed on the left. When the unit is unpaused the command icons come back.

Care.
09-26-2002, 08:34 PM#9
h0pesfall
note: if you replace the unit, the spell's cooldown wont work, and thus you can just cast the spell continually untill you run out of mana... which is a problem :)
09-26-2002, 08:58 PM#10
Guest
On another note, I've had the opportunity to test this stuff now over several larger multiplayer games with like 6 people. Occasionally the original spell will STILL get through, in spite of the almost instant pause and stop commands.

Argh.

I hate things that don't work 100%.

If anybody has any ideas I'd love to hear 'em.

Care.
09-26-2002, 09:13 PM#11
h0pesfall
hmm i don't know... i only used spells that take awhile to start (like starfall) and it worked perfectly, but for instant spells like chain lightning or mana burn... i dont really know what could be done. Of course you can edit a few txt files and slks to remove all of the spell's animations and effects to make it a "null" spell that only gets detected and replaced by other effects using a trigger, but this wouldn't be multiplayer friendly :-/ unless you only want to remove the animation which can be edited in <race>abilityfunc.txt
09-27-2002, 03:49 AM#12
Wakeman
Quote:
Originally posted by Heaven
On another note, I've had the opportunity to test this stuff now over several larger multiplayer games with like 6 people. Occasionally the original spell will STILL get through, in spite of the almost instant pause and stop commands.

Argh.

I hate things that don't work 100%.

If anybody has any ideas I'd love to hear 'em.

Care.


I don't think you need those "pause" and "wait" lines. Delete them all and your triggers should work fine!

You can have a look at my map. Paladin's teleport and Orcish sapper's mine demonstrated 2 methods of making custom abilities.
09-27-2002, 04:11 AM#13
h0pesfall
Quote:
Delete them all and your triggers should work fine!

If you dont order your unit to Stop, the normal spell will go through. If you tell the unit to stop immediatly without waiting, Cooldown won't work.
09-27-2002, 04:44 AM#14
Wakeman
Quote:
Originally posted by ZZzz
If you dont order your unit to Stop, the normal spell will go through. If you tell the unit to stop immediatly without waiting, Cooldown won't work.


Sorry that my words were confusing. Maybe let me explain again. You need to order the unit to stop, and wait 0.02s(this works for me) and then order the unit to do what you want. So the trigger should be:

actions:
issue caster immediate order "stop"
wait 0.02
order caster to do whatever you like


Additionally, I noticed another more important reason why can't your trigger works in multiplayers. It's probably the "wait" bug again. The wait action is ignored in multiplayer game, so your order after the "stop" is not executed. Do some search and you will know what I mean. So in order to make your trigger works in multiplayer, it should be:

actions:
issue caster immediate order "stop"
set NumOfPlayer = 0
Pick all player and do (if picked player is playing then NumOfPlayer = NumOfPlayer + 1)
For integer a = 1 to NumOfPlayer, do wait 0.02
order caster to do whatever you like
09-27-2002, 04:38 PM#15
Guest
Dangit.

Using:

wait 0.001
pause caster
wait 0.001
issue caster immediate order "stop"
wait 0.001
unpause caster

I'm still having some spells get through on some large multiplayer games. Apparently by the time my trigger gets to pause caster it's too late in some cases.

Anybody got any bright ideas on workarounds of ways to completely abort an initiated action, or spell in this case?

And Wakeman, the first wait is so that pause doesn't crash or lock up the game. I don't know why, but it happens if there is no wait. Weird. And if I put just a issue "stop" order it doesn't work. Behind the scenes the original spell is still going, and the next game cycle it resumes. I think. You can see this in action by putting 15-20 stops in a row and watching your guy stutter through the casting animation. I wish we had access to this "behind the scenes" command queue, so we could just kill anything in it when we wanted to. Totally rewire the command system. Anyway, pausing the unit seems to enable the next stop to eliminate the behind the scenes command. If I just paused the unit and unpaused it I think the same thing happens, unless the pause is long enough to outlast the command's duration. Or something. I'm conjecturing on some stuff here, can you tell? Is this a big paragraph or what? Ok I'll stop.

Thanks.