HomeUser Control Panel (unavailable in archive)ForumsTutorialsArt GalleryResourcesMaps

Detecting Stampede Collision

02-24-2009, 05:22 AM#1
ShadowWolf
So I've hit a bit of a dilemma. I want to know when a unit is struck by the Stampede abilty. I tried all my usual work arounds such as giving the ability a buff then checking units for the specific buff. So which would be best / most efficient:

a) Use a damage detection system

b) Use a particle system and recreate Stampede by hand

c) Are there any other solutions?
02-24-2009, 06:11 AM#2
xombie
I would say damage detection is the more efficient way, though there is no way of detecting whether or not it was damaged by Stampede or any other spell since it doesn't give a buff.

You wouldn't need to use a particle system to re-create Stampede, its a fairly easy ability to make using triggers.
02-24-2009, 08:12 AM#3
ShadowWolf
I technically don't need to detect the damage, I just need to detect when it collides. I want the function of the spell for a different purpose.
02-24-2009, 08:51 AM#4
DioD
This is easy....

1) Dummy cast stampede from dummy (hero cast null stampede, dummy cast real one)
2) Any damage that comes from dummy is stampede collusion.
Set stampede damage to something LOW ex 1 or 0.01, zero damage will not trigger event.
3) OFC you will need damage detection system.
02-24-2009, 09:00 AM#5
Chocobo
Quote:
Originally Posted by DioD
zero damage will not trigger event.

Zero damage does.. (example: Faerie Fire)

1. create dummy with real stampede
2. dummy cast when hero casts
3. a unit is damaged event fires, check if the unit is equal to the type of (dummy unit) and do actions.
02-24-2009, 07:48 PM#6
ShadowWolf
That actually is quite the simple solution. Here's my next problem that I'm going to need some hand holding for... I don't know JASS. If someone could give me a trigger in JASS with the unit is damaged event, the condition pointing to a unit type, and an action to run a different trigger, that would be amazing. I can understand code enough to alter it to my liking, but I don't know JASS's syntax to create it, so I need something to work off of :(
02-24-2009, 07:58 PM#7
Bobo_The_Kodo
Look at IDDS in the systems section
02-24-2009, 08:07 PM#8
Rising_Dusk
Using the IDDS would make your life easy.
Collapse JASS:
scope StampedeCollision initializer Init
globals
    private constant integer DUMMY_RAW_ID   = 'hfoo'
    private constant integer TRIG_PRIORITY  = 4
endglobals

private function Conditions takes nothing returns boolean
    return GetUnitTypeId(GetTriggerDamageSource()) == DUMMY_RAW_ID
endfunction

private function Actions takes nothing returns nothing
    local unit u = GetTriggerDamageSource()
    local unit t = GetTriggerDamageTarget()
    
    //Do whatever you want to do with the collision thing here.
    
    set t = null
    set u = null
endfunction

private function Init takes nothing returns nothing
    local trigger trg = CreateTrigger()
    call TriggerAddAction(trg, function Actions)
    call TriggerAddCondition(trg, Condition(function Conditions))
    call TriggerRegisterDamageEvent(trg, TRIG_PRIORITY)
    set trg = null
endfunction
endscope
I didn't compile that, so don't flip out if there's a compilation error. It should work fine, though.
02-24-2009, 08:22 PM#9
Bobo_The_Kodo
It would actually probably be easier to only have the stampede ability added to that dummy when you create it, then just check if they have the ability

And are you on Forums at work Dusk? Blasphemy!
02-24-2009, 08:27 PM#10
Rising_Dusk
Quote:
Originally Posted by Bobo_The_Kodo
It would actually probably be easier to only have the stampede ability added to that dummy when you create it, then just check if they have the ability
Truth.
Expand JASS:
Quote:
Originally Posted by Bobo_The_Kodo
And are you on Forums at work Dusk? Blasphemy!
My code is compiling. I swear. >.>
02-24-2009, 09:25 PM#11
ShadowWolf
You guys are awesome, and I am using your IDDS Dusk, so thank you. Credit will be given of course.

So all I have to do is add
Collapse JASS:
call TriggerExecute( gg_trg_InsertTriggerHere )
in place of your comment line and change the ability code appropriately?

What's the easiest method to obtain the id value for an ability?

Good point in detecting the level of the dummy ability rather than the unit type, that makes it a lot more versatile.
02-24-2009, 09:41 PM#12
xombie
Quote:
Originally Posted by DioD
1) Dummy cast stampede from dummy (hero cast null stampede, dummy cast real one)
2) Any damage that comes from dummy is stampede collusion.
Set stampede damage to something LOW ex 1 or 0.01, zero damage will not trigger event.
3) OFC you will need damage detection system.

I don't know what the heck I was thinkin.
02-25-2009, 02:39 AM#13
Rising_Dusk
Quote:
Originally Posted by ShadowWolf
in place of your comment line and change the ability code appropriately?
Yeap. That'll work.
Quote:
Originally Posted by ShadowWolf
What's the easiest method to obtain the id value for an ability?
Go to the object editor, find your ability, hit Control+D, read the first four letters next to its name in the list on the left of the OE, profit.
02-25-2009, 03:26 AM#14
ShadowWolf
Well that's nifty. Learn something every day. Thanks!