HomeUser Control Panel (unavailable in archive)ForumsTutorialsArt GalleryResourcesMaps

making unit cast a spell w/ trigger

06-21-2006, 11:40 AM#1
darkwulfv
This seems like a very noobish question, but here goes.
I can't find any action that makes a unit cast a spell. Anyone know where it is? If you must, put the trigger in JASS, but the rest of it would end up in GUI and then I'd have to convert and reshape and bring up 100 more problems, so try to keep it to GUI please, for me and everyone else's sake (nobody wants to hear me complain). That aside, this is all I have so far:
Trigger:
Untitled Trigger 001
Collapse Events
Unit - A unit Begins casting an ability
Collapse Conditions
(Ability being cast) Equal to Commander Rage
Collapse Actions
Unit - Create 1 Wisp for Neutral Hostile at (Position of (Triggering unit)) facing (Position of (Triggering unit))
Collapse If (All Conditions are True) then do (Then Actions) else do (Else Actions)
Collapse If - Conditions
(Level of Commander Rage for (Triggering unit)) Equal to 1
Then - Actions
Else - Actions

I'm going to put another If/then/else multi-function in the else of each for 6 loops. I need a Then action for the dummy unit to cast an ability on triggering unit, but I'm not seeing it anywhere.
06-21-2006, 11:48 AM#2
Rising_Dusk
Order <Caster> to <Your spell ID here> <Target>

That says use the order ID associated with your dummy spell.
06-21-2006, 04:40 PM#3
darkwulfv
is order ID the raw code you get when you press ctrl + D in ability editor? ( the name, like A002)
06-21-2006, 04:43 PM#4
Jacek
Nope... these 'A000' things are rawcodes... used in JASS... orderstrings are things like "chainlightning or something"... to cast some ability you make like:

Unit - Order Triggering Unit to Farseer - Chain Lightning Target of ability being cast

(if your spell is based off chain lightning)
06-21-2006, 04:46 PM#5
darkwulfv
Ok but won't it then cast chain lightning instead of your spell? and what I've got is a bloodlust spell, not a hero spell.
06-21-2006, 04:58 PM#6
StealthFox
Yes....that is a good question. The answer is:

Use custom script and use a JASS function to cast the newly created spell. (IssueTargetOrderById) Unfortunately, I don't have the syntax memorized, or any of the syntax memorized, so open up the common.j file using WinMPQ and search for the function. The syntax will be there. Follow it closely. You will also need to use the raw code from the ability.

IssueTargetOrderById

takes unit whichUnit, integer order, widget targetWidget returns boolean
06-21-2006, 05:04 PM#7
darkwulfv
I never did understand natives with the widgets and the which and the whatevers. So what do I do?

IssueTargetOrderByID takes unit whichunit, integer order, widget targetWidget returns boolean.

Then what? Like I said, natives never made the slightest bit of sense with me. Also, still the question is being posed! The orderID of my spell is 'bloodlust' so then won't the trigger cast the actual bloodlust and not my spell???
06-21-2006, 06:07 PM#8
The)TideHunter(
Firstly, no it wont cast the spell, it will cast the ability that has the order id "bloodlust"
Secondly, the unit must have a different ability but with the same order id that was added/given to the unit before the 1 you have now with "bloodlust".

Order IDs are very different to abilities.
The order ID is just like a checker.
Think of it this way:
Say you have a war stomp ability, but the order ID is "starfall"
If you order a unit to "warstomp", it will do nothing, because the order ID is "starfall", but if you order it to do "starfall", it will do warstomp because thats the ID.
That will sound quite confusing.

EDIT: A Widget is a unit/item/destructable.
Not all targets are units, so the function dosent take a unit, it takes a widget. So the function can target items, destructables(gates/tress/crates etc) AND units. This allows more freedom, and makes it so you dont have to have 2 functions called: IssueUnitTargetOrderByID, IssueDestructableOrderByID and IssueItemTargetOrderByID
06-21-2006, 06:17 PM#9
Alexander244
In the Ability editor for your spell find the field "Text - Order String - Use/Turn On", this will probably say "bloodlust" in your case.

local unit u1 = the unit you want to cast "bloodlust"
local unit u2 = the unit you want it to cast it on
u2 could also be an item/destructible.

Collapse JASS:
call IssueTargetOrder(u1, "bloodlust", u2)

Note that if you have 2 abi's with the same order string, it will attempt to cast them both, which you don't want. So make sure all abi's on the unit use different order strings. It will obviously do nothing if "u1" does not have the abi.

Edit: You could also use
Collapse JASS:
loop
    exitwhen IssueTargetOrder(u1, "bloodlust", u2)
    exitwhen IssueTargetOrder(u1, "something else", u2)
    // then it will run through till one of them casts, meaning you only have the unit cast one abi, even though it may have 2+.
    exitwhen true
endloop
06-21-2006, 06:23 PM#10
iNfraNe
Quote:
Originally Posted by The)TideHunter(
Order IDs are very different to abilities.
The order ID is just like a checker.
Think of it this way:
Say you have a war stomp ability, but the order ID is "starfall"
If you order a unit to "warstomp", it will do nothing, because the order ID is "starfall", but if you order it to do "starfall", it will do warstomp because thats the ID.
That will sound quite confusing.
You cant edit order strings on most abilities. Order ID's are only used by things like channel. Dont confuse by saying warstomp has a changable order id.
06-21-2006, 06:41 PM#11
Anitarf
Why are you all complicating so much, and confusing the heck out of everybody, including me?

This can be easily done with GUI. Simply issue an order to the unit you want to cast the spell. The GUI only allows you to pick the orders for existing abilities, not custom ones, but that's because custom abilities use the same orderstring as the ability they are based on, so if your custom spell is based on bloodlust, order your unit to "orc shaman - bloodlust".
06-21-2006, 07:44 PM#12
The)TideHunter(
Quote:
Originally Posted by iNfraNe
You cant edit order strings on most abilities. Order ID's are only used by things like channel. Dont confuse by saying warstomp has a changable order id.

Oops, my mistake. I got mixed up with Order strings and order ID's, thats why i put them in quotation marks =/
06-21-2006, 08:02 PM#13
Blade.dk
It is the same with order ids, they are basically the same thing.
06-21-2006, 09:15 PM#14
Rising_Dusk
Quote:
This can be easily done with GUI. Simply issue an order to the unit you want to cast the spell.

Isn't that what I said in my first post? :3
Maybe I should have been more clear, but I thought I was straight forward enough.
06-21-2006, 09:25 PM#15
darkwulfv
Ok ok ok... I was really confused with the orderID and stuff but now I get it. I was being too stupid and wasn't thinking. If the unit has a spell that has an orderID of bloodlust, then it will cast that spell. I forgot that this is a specefic unit casting a specific spell, not any unit (which means it may not have that exact spell) casting the spell. Thx Anitarf for saving me from Jassing my whole spell before it was close to done. Thx everyone else for trying, maybe your input will come in handy. I wouldn't know, as triggered spells are somewhat new to me. It's a whole new aspect I've been working on.
@Rising_Dusk: I see what you said in your first post. I just mis-interpreted it becuase I didn't fully comprehend the concept of orderID.

EDIT: Here's the trigger (GUI) I'm sure it could be optimized with JASS but it'd be too hard for me at this moment in time.
Trigger:
Untitled Trigger 001
Collapse Events
Unit - A unit Begins casting an ability
Collapse Conditions
(Ability being cast) Equal to Commander Rage
Collapse Actions
Unit - Create 1 Dummy Unit for Neutral Hostile at (Position of (Triggering unit)) facing (Position of (Triggering unit))
Set DummyUnit = (Last created unit)
Collapse If (All Conditions are True) then do (Then Actions) else do (Else Actions)
Collapse If - Conditions
(Level of Commander Rage for (Triggering unit)) Equal to 1
Collapse Then - Actions
Unit - Order DummyUnit to Orc Shaman - Bloodlust (Triggering unit)
Unit - Remove DummyUnit from the game
Collapse Else - Actions
Unit - Set level of Commander Rage BL 1 for DummyUnit to 2
Collapse If (All Conditions are True) then do (Then Actions) else do (Else Actions)
Collapse If - Conditions
(Level of Commander Rage for (Triggering unit)) Equal to 2
Collapse Then - Actions
Unit - Order DummyUnit to Orc Shaman - Bloodlust (Triggering unit)
Unit - Remove DummyUnit from the game
Collapse Else - Actions
Unit - Set level of Commander Rage BL 1 for DummyUnit to 3
Collapse If (All Conditions are True) then do (Then Actions) else do (Else Actions)
Collapse If - Conditions
(Level of Commander Rage for (Triggering unit)) Equal to 3
Collapse Then - Actions
Unit - Order DummyUnit to Orc Shaman - Bloodlust (Triggering unit)
Unit - Remove DummyUnit from the game
Collapse Else - Actions
Unit - Set level of Commander Rage BL 1 for DummyUnit to 4
Collapse If (All Conditions are True) then do (Then Actions) else do (Else Actions)
Collapse If - Conditions
(Level of Commander Rage for (Triggering unit)) Equal to 4
Collapse Then - Actions
Unit - Order DummyUnit to Orc Shaman - Bloodlust (Triggering unit)
Unit - Remove DummyUnit from the game
Collapse Else - Actions
Unit - Set level of Commander Rage BL 1 for DummyUnit to 5
Collapse If (All Conditions are True) then do (Then Actions) else do (Else Actions)
Collapse If - Conditions
(Level of Commander Rage for (Triggering unit)) Equal to 5
Collapse Then - Actions
Unit - Order DummyUnit to Orc Shaman - Bloodlust (Triggering unit)
Unit - Remove DummyUnit from the game
Collapse Else - Actions
Unit - Set level of Commander Rage BL 1 for DummyUnit to 6
Collapse If (All Conditions are True) then do (Then Actions) else do (Else Actions)
Collapse If - Conditions
(Level of Commander Rage for (Triggering unit)) Equal to 6
Collapse Then - Actions
Unit - Order DummyUnit to Orc Shaman - Bloodlust (Triggering unit)
Unit - Remove DummyUnit from the game
Collapse Else - Actions
Do nothing
Custom script: set udg_DummyUnit = null