HomeUser Control Panel (unavailable in archive)ForumsTutorialsArt GalleryResourcesMaps

Advanced Spell Creating (Trigger Based)

02-10-2003, 02:10 PM#1
Darky28
Advanced Spell Creating (Trigger Based)

Problems:
1: Spells with no target
Can be abused by repeatingly hit the spell button, (or shortcut) so the trigger starts but the spell is not cast.

2: Spells who have a cast range with targets a point
Your hero casts for example blizzard at a point. Blizzard has a cast range of 800 so if your hero is more than 800 away from the targeted point it first runs there and then casts the spell BUT the damn trigger already started right after you gave the command. So its way too early

3: Spells who have a cast range and targets a unit
Same Problem as above... if you wanna stormbolt someone and your hero is out of range the hero first tries to come into cast range and then throws the stormbolt. The damn trigger started right after you gave the command so its too early.



Solutions:
For 1: Just put this into your trigger:
Code:
Cinematic - Disable user control for Player 1
Wait 0.4 seconds
Cinematic - Enable user control for Player 1
With this trick you disallow the player to abort the already clicked spell. The spell runs, and use the mana.

For 2: For this problem there's actually a Work around but its only possible with JASS. The solution lies in 3 parts:

1) as soon as the blizzard command is given you create an invisible flying unit at the targeted point. Set the variable Blizzard (boolean initially false) to true.
Then create a trigger which checks if the hero who cast the spell is in range of the newly created unvisible unit.

2) A second trigger checks if the variable "Blizzard" is true and set it to false if you abort the spell by making an action other than blizzard (this trigger also deletes the temporary trigger and invisible unit)

3) The trigger which checks if the hero is in range, is the actuall Spell Trigger. Here you remove the invisible unit and do your spell stuff. At the end you set the variable "blizzard" to false and delete the trigger completly

For 3:
Same as for 2 exept you dont create a invisible unit. You pass the targeted unit for the temporary trigger.

I have a testmap for this if you're interrested. Please post here if you wanna see the testmap

Greetings Darky26
02-10-2003, 03:10 PM#2
Guest
Yes, please do post it
02-10-2003, 04:00 PM#3
Jitb
Yes :).
02-10-2003, 05:08 PM#4
Darky28
Heres the testmap

http://www.wc3sear.ch/lightning.zip
02-10-2003, 10:17 PM#5
Guest
I'll check out the testmap. I just finished creating my own version of this I was going to post in the trigger forum.


::Edit::

Oh, I love the lightning special effect! Nicely done.
02-11-2003, 02:21 AM#6
dataangel
I haven't looked at your map, but gathering from the outline, I think you're going to have the same problem me and Technetium did initially.

If you target a spell on a unit across the map, then give a separate order to the unit before it gets over there, then move it in range, the spell will cast. That is if you're doing it the same way. Test and lemme know ;)
02-11-2003, 02:24 AM#7
Guest
I fixed that in my Spell Enhancer, dataangel. You just need to check to make sure the order is still current when he gets in range. I tried posting it in the trigger forum, but had trouble uploading it. I'll try again.

::Edit::
Look at this thread here...you'll find the Spell Enhancer at the bottom.

http://www.wc3campaigns.com/forums/s...8273#post98273
02-11-2003, 07:47 PM#8
FM_TertiaryEye
Darky,

==================================
3) The trigger which checks if the hero is in range, is the actuall Spell Trigger. Here you remove the invisible unit and do your spell stuff. At the end you set the variable "blizzard" to false and delete the trigger completly
==================================

This is basically what XP and i were hammering out. (And DataAngel in a much earlier thread). It has one case that causes it to fail, and that is when your caster is stunned and the targeted unit approaches the caster.

In this case the spell fires for free, even though the caster is stunned. If you can find a way around that, then it will work.

RazorclawX from the last forum gave me an idea using sleep, and just checking in a loop to see the target falls asleep until you issue another order. But your spell cant target creeps if you do this (or they just cant sleep). And of course there is the huge problem of having other spells based off of sleep.

Anyway, if you used this, and kept a "unit group" of targets that have spells being cast at them to exclude 2 casters targeting the same creature, then this will work. (assuming that the UnitIsSleeping function responds to the sleep spell :P

Iv'e played around with this probably as much as you have darky, and all i can say is that the best way to do this is just check the range when the order is issued and stop when its invalid. If you bump up the range of your spells to something like 2000, Its really not difficult to chase down fleeing units. And it's a simple approach to say the least.

If you would like to see what has already been tried, here are the links to our thread and data's earlier one.

http://www.wc3campaigns.com/forums/s...threadid=10637
http://www.wc3campaigns.com/forums/s...&threadid=1843

Eye
02-11-2003, 07:49 PM#9
FM_TertiaryEye
Quote:
Originally posted by sid67
I fixed that in my Spell Enhancer, dataangel. You just need to check to make sure the order is still current when he gets in range. I tried posting it in the trigger forum, but had trouble uploading it. I'll try again.[/url]


Wha? Cool! I guess i spoke too soon. Let me scope out what sid's up to here.

Eye
02-11-2003, 08:18 PM#10
Darky28
@JasonMclau

http://www.battle.net/forums/thread....nt=11#post6185

look at this trigger... i found a VERY good solution for the spell detecting. It works for almost every case exept manaburn and immolation.

:-)
02-11-2003, 08:50 PM#11
Guest
Hmm. Manaburn is still a problem with mine, too...

You could fix this in mine by checking to make sure the unit still had enough mana for the spell after it steps in range, but BEFORE the .4 delay for the casting animation. You wouldn't want to check after because the spell should have allready gone off by then. But this should prevent the trigger from activating if the unit was "manaburned"or "immolationed" below the spell's mana cost and THEN it moves into range. I'll go ahead and add that.

Quote:
::EDIT::
Nevermind. I just fixed this in version 0.29. You can D/L it at the same spot as before in Trigger Depository.


If I understood your new one correctly, Darky, yours starts a loop that checks for the correct drop in mana. The only way I can think to fix that would be to create two seperate triggers. One that is checking for when manaburn is cast. If the target of the burn is your casting unit, then the variable ManaBurn is set to "True". The other new trigger is checking to see what "skill level" the Manaburn is... Then just add an if/then statement to your loop that adjusts the amount of mana drop needed by the amount taken the manaburn (gotten from the skill level) if Manaburn = "true". Then have the Manaburn variable reset to false and end the if/then statement.

The tricky part is developing a way to detect the skill level of every units manaburn. You could do this using my GetUnitInteger function here:

http://www.wc3campaigns.com/forums/s...threadid=11158
02-11-2003, 10:39 PM#12
FM_TertiaryEye
Quote:
Originally posted by Darky26
It works for almost every case exept manaburn and immolation.
:-) [/b]


This also fails when the players mana regeneration from the issue time to the casting time exceeds the spell cost. And when the caster levels up, gaining enough mana to exceed the spell cost.

Also I havent tried this yet, but you should make sure that the player cant use a mana potion on the way over. Using items might not fire a an order event.

So anyway, this is a good idea, really portable and simple, but still not correct. There is just too much that can change the mana state, players would have to use this in small maps (less issue time to target time) with assurances that nobody can mana burn, mana regens are low, and spell costs for spells that use this are high.

I posted something in the blizzard suggestions forum about a "spell is cast event", but there are 4.5 million people posting there every day it seems, and threads named "I suggest jesus" get 35 responses and over a thousand views while mine got zero :P.

Still it might be worth another shot. If we all pitched in our posts maybe we can come together in one giagantic sqeualing whine that might catch the ears of someone important. And we could keep bumping it until someone from blizzard said something.

Sid I just tried that out, and although i couldnt cheat a spell, i found it was pretty easy to make one misfire. The delay between the cast and the interception time is a bit too high. Also, you could simply pause the guy for a bit when hes in range so they cant move away once you know the spell will be triggered.

Eye
02-11-2003, 11:45 PM#13
Guest
Hmm. I had looked into that in earlier versions and thought the user disable fixed that... I do think this can be fixed by correcting adjusting the timing and ranges. Right now, I suspect I may have to disable control for longer by increasing the detection range.

Darky said in the b.net board that he would look at this also...so, I'm looking forward to his input. I've seen a number of his custom triggers and have a lot of respect for his ingenuity.

There are two things I really hate about your method (I'll call it my method when it works 100% -- LOL:D!:

1) You have to account for the casting delay during the casting animation. It's roughly about .4, but it varies depending on the spell. For example, Stormbolt is shorter than Holy Light.

2) WC3 uses some Eulogiblahblah method for determining 3D distance. Since I don't know Eulogiblahblah, I'm blaming this for the "casting range" bieng difficult to determine. It is definately possible for a unit with a 600 range to actually cast the spell at 620 or maybe even 640. So anytime you use the DistanceBetweenUnits function, you have to account for this potential error.

Quote:
::EDIT::
Discovered the bulk of the problem. There is a bug with v0.29 and v.028 that causes the disable player control to not work at all. Stupid mistake that I fixed. However, there is still one glitch that I'll admit stumps me.

If you issue the order for a spell and the target moves out of range before the spell is finished, the spell is still cast, but the required event doesn't fire for the new trigger. If the unit moves back into range (and you haven't issued a new order to the casting unit), then the trigger fires. I could increase the detection range to compensate for this problem, but I don't want to because it causes trouble for every other situation.
02-12-2003, 02:29 AM#14
FM_TertiaryEye
======================================
There are two things I really hate about your method (I'll call it my method when it works 100% -- LOL:D!:
======================================

Lets put it this way, I don't even use "my" method :P It just shouldn't be this complicated, really.

===================
1) You have to account for the casting delay during the casting animation. It's roughly about .4, but it varies depending on the spell. For example, Stormbolt is shorter than Holy Light.

2) WC3 uses some Eulogiblahblah method for determining 3D distance. Since I don't know Eulogiblahblah, I'm blaming this for the "casting range" bieng difficult to determine. It is definately possible for a unit with a 600 range to actually cast the spell at 620 or maybe even 640. So anytime you use the DistanceBetweenUnits function, you have to account for this potential error. [/b][/quote]
===================

Yes, those 2 reasons have really caused me to lose faith in the method. It's just an all out annoying situation for everyone involved.

Sid, do you wanna back up that spell is cast event idea? If we get enough people to bump the thread regularly on the suggestions forum, maybe we can overcome the flood of morons still asking for balance changes in diablo 1.

It will be about 1000 times easier for blizzard to fix this problem than to try to rig it up ourselves. If we push for it now, while they are probably still working on the editor, we have a good chance of it actually happening. The event structure is in place, and in fact it might just be an extra function call on their part to fire the new event. But who knows.

Fm_TertiaryEye
02-12-2003, 06:08 AM#15
Guest
Love to...post the link and I'll give it everytime I log on...