HomeUser Control Panel (unavailable in archive)ForumsTutorialsArt GalleryResourcesMaps

Making a physical melee spell

10-23-2008, 09:01 AM#1
StockBreak
Hi guys,
I am trying to make a "melee" active spell which triggers only if the target is hit by a melee attack, but still consumes mana if missed.
I was going to use Poison Arrows as basic ability (since it needs a physical attack and it leaves a buff to detect damage).

The problem with Poison Arrows is the autocast
Are there other similar abilities without autocast?

Thanks
10-23-2008, 10:38 AM#2
fX_
If you want a simple solution, stick to Poison Arrows and create a trigger:

A unit is issued an order
order is "poisonarrows"
Issue order "unpoisonarrows"

That'll turn of the autocast whenever its turned on.

Any maybe you can give the ability an icon w/o autocast border so that players don't assume that it can be autocasted.
10-23-2008, 12:16 PM#3
StockBreak
Quote:
Originally Posted by fX_
If you want a simple solution, stick to Poison Arrows and create a trigger:

A unit is issued an order
order is "poisonarrows"
Issue order "unpoisonarrows"

That'll turn of the autocast whenever its turned on.

Any maybe you can give the ability an icon w/o autocast border so that players don't assume that it can be autocasted.
This could be a very smart solution!
Unfortunately I can't test it right away (I'm not at my computer).
The only problem should be the following: will the order interrupt the unit's current orders?

Thanks!
10-23-2008, 01:46 PM#4
Kino
Whats hes refering to is the autocast order as to whether to autocast it or not, I dont think it interrupts attacks in anyway.
10-23-2008, 02:03 PM#5
StockBreak
Quote:
Originally Posted by Kinorhynkar
Whats hes refering to is the autocast order as to whether to autocast it or not, I dont think it interrupts attacks in anyway.
I will try it this evening and if it works I will give you rep
The other problem is: does Poison Arrows works on melee units???

Thanks!
10-23-2008, 03:19 PM#6
fX_
Autocast orbs don't work on melee units. You can make your unit have a ranged attack with a very low range to imitate melee attacks. However, they'll be treated as ranged - and not as melee - units; i.e., Vampiric Aura, Spiked Carapace, etc., won't work the same on them as they do on melee units.
10-23-2008, 04:38 PM#7
StockBreak
Unfortunately I have very bad news
1) Poison Arrows doesn't work with melee units
2) The issued unpoisonarrows order interrupts unit's current orders
3) The unpoisonarrows order can't be issued when the units activate autocast (it simply does nothing)

Other solutions?
Thanks!
10-23-2008, 08:19 PM#8
moyack
Have you tested with a dummy passive ability and trigger it with the EVENT_PLAYER_UNIT_ATTACKED event.

Collapse JASS:
scope MeleeDamage initializer init

globals
    private constant integer SpellID = 'A000' // The dummy passive ability rawcode
endglobals

private function Conditions takes nothing returns boolean
    return GetUnitAbilityLevel(GetAttacker(), SpellID) > 0
endfunction

private function Actions takes nothing returns nothing
    local unit u = GetAttacker() // the unit with the ability
    // here you reduce the mana and all the stuff you need
endfunction

private function init takes nothing returns nothing
    local triger t = CreateTrigger()
    call TriggerRegisterAnyUnitEventBJ(t, EVENT_PLAYER_UNIT_ATTACKED)
    call TriggerAddCondition(t, Condition(function Conditions))
    call TriggerAddAction(t, function Actions)
    set t = null
endfunction

endscope
10-23-2008, 09:26 PM#9
StockBreak
Hi moyack,
I already have many passive spells which detect damage (like custom critical strikes and so on) but I wanted an active melee spell (I like the idea that it can miss target).
Basically it must be a physical attack (it can miss, it deals physical damage, it can activate criticals etc...) but it must be activated manually, is it possible?
I could make an active spell which gives a buff on the caster for a little time but...

Thanks anyway!
10-23-2008, 11:14 PM#10
moyack
So... the unit that has the ability can't attack normally? if so, you can use abilities that morph the unit to one that attack or change its attack type like orbs, war club, etc.
10-23-2008, 11:31 PM#11
StockBreak
Quote:
Originally Posted by moyack
So... the unit that has the ability can't attack normally? if so, you can use abilities that morph the unit to one that attack or change its attack type like orbs, war club, etc.
No, it is still something different.
Imagine the ability as an attack which must be activated manually and consumes mana (just like an arrows ability) and has NO autocast. Is it possible?

Thanks!
10-24-2008, 12:03 AM#12
moyack
I see, then you can use one ability based on Berserk with the code I posted, just change the 'A000' with the rawcode of the buff, and set the mana consumption in the actions function...

The code will check when the unit starts an attack, if it has the buff then it does the required effects.
10-24-2008, 12:33 PM#13
StockBreak
Quote:
Originally Posted by moyack
I see, then you can use one ability based on Berserk with the code I posted, just change the 'A000' with the rawcode of the buff, and set the mana consumption in the actions function...

The code will check when the unit starts an attack, if it has the buff then it does the required effects.
I have already one hero with an ability like this (you activate the Berserk-based ability, his sword become red and when it strikes the trigger activates).
Probably it is simply not possible making an ability like the one I'm seeking (it is basically a "manual" attack)

Thanks anyway!
10-24-2008, 02:27 PM#14
Gorman
just use different order IDs and it should work. Such as searing arrows or frost arrows.
10-24-2008, 07:28 PM#15
StockBreak
Quote:
Originally Posted by Gorman
just use different order IDs and it should work. Such as searing arrows or frost arrows.
What do you mean?
Poison Arrows doesn't work on melee units