| 09-14-2004, 11:44 PM | #1 |
I was wondering if it is possible to make a unit able to backstab,(Do more damage/critical when attacking behind another unit)and if so how?Im pretty sure it has something to do with triggers,but im not sure :\ Any help asap would be great,ty in advance. ^_^ Lost_ally |
| 09-15-2004, 06:05 AM | #2 |
Everytime a unit attacks, compare its facing with the attack unit's facing. This shouldnt be too hard to figure out (cant explain now, in a hurry!). And if the facing values say he is behind, you can calculate his average damage by checking his base damage + primary attribute value. To make a 2 times normal damage, do this: note: its written freehand, so you cant copy directly what it says. Code:
Set hp of (attack unit) to hp of (attacked unit) - (4 + amount of agility) x 2. Display a fake critical strike message showing damage dealt (put it in a variable and use the WEU function that displays a fake critical) That is if the attacking hero has a average normal attack (not adding agility) of 4, i took 4 because i think the normal heroes have 1-8 basic damage. Good luck |
| 09-15-2004, 06:19 AM | #3 |
The way to do backstab is easy, too easy infact. Its all in the conditions. Use whatever actions you want, I used 100% critical strike(dont use critical strike for it if the unit already has critical strike). This will work as long as the unit has to face the unit while attacking, so for some reason if the unit dosent face the unit its attacking it wont work (which wont happen, unless its a slow missile). Code:
BackStab
Events
Unit - A unit Is attacked
Conditions
(Unit-type of (Attacking unit)) Equal to Footman
(Facing of (Attacking unit)) Greater than or equal to ((Facing of (Attacked unit)) - 60.00)
(Facing of (Attacking unit)) Less than or equal to ((Facing of (Attacked unit)) + 60.00)
Actions
Unit - Add Critical Strike (Neutral Hostile) to (Attacking unit)
Wait 0.50 seconds
Unit - Remove Critical Strike (Neutral Hostile) from (Attacking unit)
Another note, this will backstab if withing 120 degrees of the back, to change this change the 60's i have in there. EDIT: seems i was beaten to it while I was writing the post, oh well. |
| 09-15-2004, 12:44 PM | #4 |
Awesome,thanks alot guys cant wait to try this out later ^_^ lol i guessed it would be something easy but im not skilled in the trigger area :\ Thanx again |
| 09-15-2004, 03:52 PM | #5 |
That trigger looks... extreamely buggy + laggy. How can you say it's easy, when you can't do it properly? |
| 09-15-2004, 04:43 PM | #6 | ||
Quote:
Maybe because.....to someone who has experience in the trigger area,they would find this easy.... Quote:
And instead of coming here saying that the help given would be "extreamely buggy + laggy",and criticising my post,why dont you tell me a better way that wouldnt be "extreamely buggy + laggy" |
| 09-15-2004, 05:21 PM | #7 |
Mainly because I don't know how to do it, and 'cuz I despise people who are sooooo shure they know what they're talkin' about, when they're really horribly, horribly wrong. Add/Remove to unspecified variables is not clever (though they tend to work, some don't), and (obviously) the "Unit is attacked" Is a horribly, horribly evil event that will create mad lag if you've got enough units attacking at the same time (I know, seen the effects). Also I'm pretty shure that thsi ability will not really do anything in the ways of a 'backstab' effect, if the unit takes longer than 0.50 seconds to actually attack the attacked unit (for an example, it has a slow attack, or it's a short distance away from the unit). The conditions were obviously not meant to be serious, but he could atleast have added a buff checking example, instead of a Footman... He made a rash comment, then whipped-up a lazy trigger made i na few seconds, after boasting about his skills. Depressing. (Note that I've never said to be any better anywhere, do you can't use that as an argument.) |
| 09-15-2004, 09:43 PM | #8 |
Ok i just tried what you said to do Obsidian and he crits..but for 0! lol and i tried to find out how to do what you said GaDDeN but i cant find where the (4+amount of agility)x2 is....i know you said it was in free hand,but if you(or anyone)could tell me exactly how to do that it would be sweet. |
| 09-15-2004, 11:49 PM | #9 | |
If he crits for 0 its a problem with the ability not the trigger, the trigger has nothing that could affect that. Critical strike was just a sugestion, you can try to do the backstab anotherway. A possible bug could occure with this, but a simple change will fix that, change the conditions to this... Code:
Conditions
Or - Any (Conditions) are true
Conditions
And - All (Conditions) are true
Conditions
(Facing of (Attacking unit)) Greater than or equal to ((Facing of (Attacked unit)) - 60.00)
(Facing of (Attacking unit)) Less than or equal to ((Facing of (Attacked unit)) + 60.00)
And - All (Conditions) are true
Conditions
(Facing of (Attacking unit)) Greater than or equal to (((Facing of (Attacked unit)) + 360.00) - 60.00)
(Facing of (Attacking unit)) Less than or equal to (((Facing of (Attacked unit)) + 360.00) + 60.00)
And - All (Conditions) are true
Conditions
(Facing of (Attacking unit)) Greater than or equal to (((Facing of (Attacked unit)) - 360.00) - 60.00)
(Facing of (Attacking unit)) Less than or equal to (((Facing of (Attacked unit)) - 360.00) + 60.00)
Quote:
I am serrious with the conditions, the footman was just a quick unit for an example, obviously im not going to create a custom unit just to have it say "assassin" in the trigger, that would be tedious. All he asked was how it could be done, not to check if the unit can backstab, if he wants me to do that he can try to ask me to. Now lets talk no more of this because it is off topic and a waste of space. |
| 09-16-2004, 01:00 PM | #10 |
Ah, yes. My bad, I was thinking of a more practical use of the skill, not an ability that activates every time the backstabber attacks from behind any unit. I was thinking more, like, an ability that turns the 'Asassin' invisible, and allows it's next attack to deal x damage if attacking the targeted unit from the back. That'd require buff checking. But, alas, I was wrong, and shall now go and burn myself in an ancient shamanistic retual involving various every-day items! |
| 09-17-2004, 01:54 AM | #11 |
as far as I can see the biggest bug that I can see is the fact that it tells it to wait 0.5 seconds... which for maps where you attack faster then that (EX. agi setup in Dark Lineage) could attack more then once. Also if you are using 7 spell slots you would have the problem that when you add the crit strike ability, so you MUST set up a dummy passive slot for the backstab ability, then remove it, THEN add the crit strike, then backtrack to remedy that. As for the actual attack, you could do something like this... And yes I know this takes two different triggers but this will fix the problem so who cares? I copied the original code, because its good, but im doing the rest from memory of what is a GUI trigger, so if they aren't exact don't give me the 3rd degree Code:
\\Btw backstab2 should initially be off
BackStab
Events
Unit - A unit Is attacked
Conditions
(Unit-type of (Attacking unit)) Equal to Assassin //or whatever it will be
(Facing of (Attacking unit)) Greater than or equal to ((Facing of (Attacked unit)) - 60.00)
(Facing of (Attacking unit)) Less than or equal to ((Facing of (Attacked unit)) + 60.00)
\\Since this event goes every single time, this next part is to make sure that it only goes off a certain % of the time (in this case 20%)
(Random integer number between 1 and 10) greater then or equal to 8
Actions
\\The variable is important, so make sure you make one for it
Set BackStabbed Unit - (Attacked Unit)
\\The integer is found in reals, just convert it to an integer
Set BackStab - (Integer((Life of(BackStabbed Unit))))
Trigger - Enable BackStab2
\\This is just so the actual damge dealt doesn't restart the trigger and you have an unending loop
Trigger - Disable BackStab
BackStab2
Events
Time - Every .01 seconds of game time
Conditions
Integer((Life of(BackStabbed Unit))) Less than BackStab
Actions
\\Whatever you want to do at that point doesn't matter, since you ahve already done initial damage I suggest you do the following
Set hp of (attack unit) to hp of (attacked unit) - (4 + amount of agility) x 2.
Display a fake critical strike message showing damage dealt (put it in a variable and use the WEU function that displays a fake critical)
Trigger - Disable BackStab2
Trigger - Enable BackStabNow I know that is a LOT more complicated, but this makes sure that it does the backstab only once, and also you don't have to bother with replacing the actual ability |
| 09-17-2004, 04:02 AM | #12 |
I know that critical strike isnt the best skill to use for this, it was just the first thing I could think of to put down. Another possibility would be to use a hidden caster to buff the unit for a very short time, you could just use a blood sfx on the attacked unit to display the backstab happened as well. |
| 09-17-2004, 05:48 AM | #13 |
This Backstab spell has been created before. Its in a map called Terrors Threshold. As far as i know that trigger is correct only they didnt use the number 60 they used 100. They also made it a crit strike. |
| 09-17-2004, 03:20 PM | #14 |
I've done backstab triggers for my legionaires map before. Adding a crit strike ability doesn't work until the 2nd time the unit attacks with the ability. While some may not mind that, I found that too glitchy. The workaround I used involves using dummy units to cast a damage boosting buff (like inner fire) on the backstabbing unit. This has 2 advantages over adding crit strike. First of all, it works instantly, the first attack will factor in the bonus damage. Secondly, you don't have to use wait actions in your triggers because the buff will expire by itself (naturally, you set it to about 1 second). The downside of using a spell-based system is that it doesn't produce the crit-strike floating text and anti-magic shell/dispells may interfere. |
| 09-17-2004, 10:07 PM | #15 |
You can make your own floating text. You need a custom floating text variably called var_CritText Code:
Actions
-Custom Script 'local texttag udg_var_CritText'
Do whatever...
-Floating Text - Create Floating Text With the Text ("|cffff0000" + (Damage[your on your own]) + "!|r")
-Set Variable var_CritText = last create floating text
-Floating Text - Set Velocity of (var_CritText) to 64 going towards 90°
-Wait 1.00 seconds
-Floating Text - Change the color of var_CritText to (100.00%, 100.00%, 100.00%) with 25.00% transparency
-Wait 0.25 seconds
-Floating Text - Change the color of var_CritText to (100.00%, 100.00%, 100.00%) with 50.00% transparency
-Wait 0.25 seconds
-Floating Text - Change the color of var_CritText to (100.00%, 100.00%, 100.00%) with 75.00% transparency
-Wait 0.25 seconds
-Floating Text - Destroy var_CritText |
