HomeUser Control Panel (unavailable in archive)ForumsTutorialsArt GalleryResourcesMaps

Order A Unit To Cast The Spell Of "Event Response - Ability Being Cast" of Any Spell?

03-10-2007, 04:55 PM#1
Brash
I am trying to figure out how to trigger this... when a unit casts a spell on me, i want to create a dummy unit and give that unit whatever ability was cast on me... which i am able to do... i give the last created unit the "event response - ability being cast"

my problem is.. knowing how to order that unit to cast that same event response spell correctly??

I use gui and the types of ways they order i dont know how to associate with an event spell.. of ability being cast


i dont know jass but is there another way.. maybe even a quick custom script of a one line order command that the gui doesn't let us do that will let me somehow connect the correct order to the event response spell??

or is there a way in gui, which i'm hoping for?

so far i have this:

Trigger:
Collapse Events
Unit - A unit Starts the effect of an ability
Collapse Conditions
((Casting unit) belongs to an enemy of (Owner of (Target unit of ability being cast))) Equal to True
(Target unit of ability being cast) Not equal to No unit
Collapse Actions
Unit - Create 1 DummyUnit for (Owner of (Target unit of ability being cast)) at (Position of (Target unit of ability being cast)) facing Default building facing degrees
Unit - Add (Ability being cast) to (Last created unit)
Unit - Set level of (Ability being cast) for (Last created unit) to (Level of (Ability being cast) for (Casting unit))
Unit - Order (Last created unit) to (((~THIS IS WHERE I GET STUCK~))) (Casting unit)

that last line needs to be generic to adapt to any spell order..
03-10-2007, 05:46 PM#2
Hydrolisk
Wow, that's pretty tricky. I'd try setting a variable to the ability or a variable for the order/ability ID string, than replacing the "I get stuck" part with the variable. Your best bet is to try and set a variable to the order/ability ID string.

Wow, ok screw me, I don't even know if that's possible.

EDIT: Never use "Casting Unit," always use "Triggering Unit" instead because Casting Unit won't work after "Wait" actions and such from what I've heard. Casting Unit is just too undependable.

EDITEDIT: You have a few leaks. Remember to clean them up (this would destroy the game real quick if spells are used alot)!
03-10-2007, 06:08 PM#3
Brash
Quote:
Originally Posted by Hydrolisk
EDITEDIT: You have a few leaks. Remember to clean them up (this would destroy the game real quick if spells are used alot)!

thx. i know it has leaks. i only threw that together for now as temporary until i work out that order part. i always clean my trigs up at the end.


as for the ability id.. it doesn't let me select such a thing.. or any variable for that matter. probably need to custom script it.. but dont know how to do that.

this is my best guess
03-10-2007, 07:41 PM#4
Ammorth
try call IssueImmediateOrderById(GetLastCreatedUnit(),GetSpellAbilityId())
it should cast the casted ability for the last created unit.
03-10-2007, 07:56 PM#5
Brash
Quote:
Originally Posted by Ammorth
try call IssueImmediateOrderById(GetLastCreatedUnit(),GetSpellAbilityId())
it should cast the casted ability for the last created unit.


does this have a target unit?


i was experimenting on my own with some jass i copied and came up with something that works partially. it looks like it works about half of the time.

Trigger:
Set Shell_Order = (Current order of (Casting unit))
Set Shell_OrderString = (String(Shell_Order))
Custom script: call IssueTargetOrderBJ( GetLastCreatedUnit(), udg_Shell_OrderString, GetSpellAbilityUnit() )

i figured that if i have it set at "starts the effect of ability" then surely it must be on a current order of that same spell..

why it doesn't work all the time is beyond me

i will disable that last string and try yours to see result.
03-10-2007, 08:31 PM#6
Ammorth
woops! try this then: call IssueTargetOrderById(GetLastCreatedUnit(),GetSpellAbilityId(),udg_WhateverTargetYouWant)
03-10-2007, 08:42 PM#7
Dil999
How many abilities will this trigger work for? If it works for only a few you could do an order for every single one of your triggerer abilities. May take awile. but it would work.
03-10-2007, 09:15 PM#8
Brash
Quote:
Originally Posted by Ammorth
woops! try this then: call IssueTargetOrderById(GetLastCreatedUnit(),GetSpellAbilityId(),udg_WhateverTargetYouWant)

no luck. this one didn't even work once.


Quote:
Originally Posted by Dil999
How many abilities will this trigger work for? If it works for only a few you could do an order for every single one of your triggerer abilities. May take awile. but it would work.

there are too many with too many possibilities
03-10-2007, 09:41 PM#9
Dil999
Btw, if you have it cast when a unit is casted upon, you know that since it will be using the same ability, you will make the triggers repeat over and over and over again... for ever.
Unit #1 casts on Unit #2
Dummy #1 casts on Dummy Unit #1
Dumy #2 casts on Dummy #1.. and so on.
03-10-2007, 10:04 PM#10
Brash
Quote:
Originally Posted by Dil999
Btw, if you have it cast when a unit is casted upon, you know that since it will be using the same ability, you will make the triggers repeat over and over and over again... for ever.
Unit #1 casts on Unit #2
Dummy #1 casts on Dummy Unit #1
Dumy #2 casts on Dummy #1.. and so on.


yeah i know. i will guard against that by saying that the unit type of target unit is not equal to that unit type of dummy unit.
03-10-2007, 10:08 PM#11
Dil999
Im gonna g o do a repeating trigger like that right now... i wanna see how long it takes to fill up a map with peasants ^_^
Trigger 1
Elapsed game time is 1 second
Unit - Create 1 footman for player 1

Trigger 2
Unit is created
Create 1 footman for player 1


Edit: Even better:
Elapsed game time is 1 second
For each integer between 1 and 1000 for loop integer a do actions:
For each integer between 1 and 1000 for loop integer b do actions:
create 1 footman
03-10-2007, 10:39 PM#12
Hydrolisk
Boy, I love pointless repeating triggers 'cause they crash the game and make great gigantic battles/wars. Think I'm gonna do that right now.