• Listen to a special audio message from Bill Roper to the Hive Workshop community (Bill is a former Vice President of Blizzard Entertainment, Producer, Designer, Musician, Voice Actor) 🔗Click here to hear his message!
  • Read Evilhog's interview with Gregory Alper, the original composer of the music for WarCraft: Orcs & Humans 🔗Click here to read the full interview.

Order dummy unit to cast ANY spell ?

Status
Not open for further replies.
Level 14
Joined
Apr 20, 2009
Messages
1,543
CoLd Bon3: It's the exact same one as in your previous thread ;)

JASS:
native IssueTargetOrderById takes unit whichUnit, integer order, widget targetWidget returns boolean

The unit is the unit that should be casting it (For example if you've stored your unit in a variable called MyCastingUnit use udg_MyCastingUnit),
The integer is the raw code of the ability that needs to be cast (can be found with control + d inside the object editor),
The widget is the target where the ability should be cast to. (This can be for example a unit stored inside TargetedUnit use udg_TargetedUnit).

To summorize it. Here's an example:

  • Custom script: call IssueTargetOrderById(udg_MyCastingUnit, 'Ahea', udg_TargetedUnit)
Where Ahea is the raw code for the ability Heal.

You have to make sure that MyCastingUnit has the Heal ability though.
You can do so by adding the ability to the unit with:

  • Custom script: call UnitAddAbility(udg_MyCastingUnit, 'Ahea')
Then you set the ability level with:

  • Custom script: call SetUnitAbilityLevel(udg_MyCastingUnit, 'Ahea', 1)
Then cast the spell and after that simply remove the ability from the casting unit:

  • Custom script: call UnitRemoveAbility(udg_MyCastingUnit, 'Ahea')
In the end it'll look something like:

  • Custom script: call UnitAddAbility(udg_MyCastingUnit, 'Ahea')
  • Custom script: call SetUnitAbilityLevel(udg_MyCastingUnit, 'Ahea', 1)
  • Custom script: call IssueTargetOrderById(udg_MyCastingUnit, 'Ahea', udg_TargetedUnit)
  • Custom script: call UnitRemoveAbility(udg_MyCastingUnit, 'Ahea')
 
Level 33
Joined
Mar 27, 2008
Messages
8,035
How to do this? not by doing in-GUI spell order?

Guys, I think he forgot to write this one statement:
How to do this? not by doing in-GUI AND ANY OTHER TRIGGER-BASED ORDER?

So basically, I think that this guy trying to say to order the unit by not touching any scripting language (Trigger Editor) at all

Like Cold Bone said, Warcraft III (OR ANY OTHER GAME EDITOR) cannot read your mind

It however can anticipate you what to do next, but it will never read your mind and determine your decision, it's always we (humans) decide it.

So to answer this thread (if I am correct guessing his statement), it is impossible without the use of Trigger Editor.

You can however make your Dummy Unit to appear in the game and cast it yourself lol (but that won't be called "Dummy Unit" is it ?)

Inference: If he doesn't want it in GUI, why the h3ll does he want it in JASS?
 
Level 14
Joined
Apr 20, 2009
Messages
1,543
Guys, I think he forgot to write this one statement:
How to do this? not by doing in-GUI AND ANY OTHER TRIGGER-BASED ORDER?

So basically, I think that this guy trying to say to order the unit by not touching any scripting language (Trigger Editor) at all

Like Cold Bone said, Warcraft III (OR ANY OTHER GAME EDITOR) cannot read your mind

It however can anticipate you what to do next, but it will never read your mind and determine your decision, it's always we (humans) decide it.

So to answer this thread (if I am correct guessing his statement), it is impossible without the use of Trigger Editor.

You can however make your Dummy Unit to appear in the game and cast it yourself lol (but that won't be called "Dummy Unit" is it ?)

Inference: If he doesn't want it in GUI, why the h3ll does he want it in JASS?

I guess you're right, my bad. I just thought giving a solution on how to do it would be enough.
Why would he not want to touch the trigger editor at all if it is possible :S?

I don't get why people feel the needs of not having to trigger something if it is possible and simple. And the fact that it doesn't take that much time at all...

Anchorist said:
not by doing in-GUI spell order

And with this I anticipated that he doesn't want to use the GUI action for ordering a spell through string orders, that's why I gave the Jass solution with raw codes...
It might be a bit far-fatched though :p

It really all depends on what the creator of this thread meant to say xD
 
Last edited:
Level 14
Joined
Aug 8, 2010
Messages
1,022
@Hashjie - doesn't matter... your examples and your solution are not waste of time. I saw your post, i read it and now i know better that function. :D
JASS:
native IssueTargetOrderById takes unit whichUnit, integer order, widget targetWidget returns boolean
I understand everything from that function except the 'returns boolean'. I don't mess up with any booleans when issuing an unit casting a spell in GUI. :? Can you explain?

About the thread - i think the reason was just for fun... her creator, Anchorist, probably wanted to ask if miracles happen here, in War3.
 
Level 14
Joined
Apr 20, 2009
Messages
1,543
@Maker - Ah-ha! Ok. Thank you! :)

An example on how it can be used in Jass:

JASS:
set udg_didSpellCast = IssueTargetOrderById(udg_yourUnit, 'Ahea', udg_targetedUnit)

Or in GUI:

  • Custom script: set udg_didSpellCast = IssueTargetOrderById(udg_yourUnit, 'Ahea', udg_targetedUnit)
If the ability fails to cast for some reason, didSpellCast (which is a boolean variable) will be false, else it will be true.
It's usefull for whenever you want to create an exception for stuff that went wrong.

Also: when setting a variable to a function you don't use call in front of it.

When something is returned from a function it basically gives something back, so when a variable is set to be a function, the function get's executed and the value that got returned will be put inside the variable.
If that variable is of the same type as the value that is returned from the function of course.

I wanted to use GUI method, because IssueTargetOrderById is not working by me.. though I'm using IssuePointOrderByIdLoc.. :(

What spell are you trying to cast, what are you targeting and who is the unit that is casting the spell? Could you give us an example of what you did?
A trigger, some Jass script perhaps?
 
Level 5
Joined
Oct 10, 2010
Messages
71
I'm creating custom map with custom spells, and I want to enhance them to add attribute based damage, as far as new effects etc. So basically I'm doing 2 spells based on my custom spell, dummy and caster spell.


The spell I'm working currently on is blizzard archmage skill, called "Cursed Earth" So it's basically do:
Hero casts Dummy spell which damage area for 0.01 dmg (just to know that unit is attacked)
With casting GUI trigger creates dummy which casts that spell (A006) on itself, doing normal damage (10xability level of Hero) and attribute damage based on int (intx2)

And that's all..

It's working now BUT:
I don't know why when hero casts dummy spell the area is damaged 5 times for 0.01 (with 0.2 sec interval)
Still I need to order my dummy to cast "Human Archmage - Blizzard" instead of any ability I desire.. <-- that's main problem
 
Level 14
Joined
Apr 20, 2009
Messages
1,543
I'm creating custom map with custom spells, and I want to enhance them to add attribute based damage, as far as new effects etc. So basically I'm doing 2 spells based on my custom spell, dummy and caster spell.


The spell I'm working currently on is blizzard archmage skill, called "Cursed Earth" So it's basically do:
Hero casts Dummy spell which damage area for 0.01 dmg (just to know that unit is attacked)
With casting GUI trigger creates dummy which casts that spell (A006) on itself, doing normal damage (10xability level of Hero) and attribute damage based on int (intx2)

And that's all..

It's working now BUT:
I don't know why when hero casts dummy spell the area is damaged 5 times for 0.01 (with 0.2 sec interval)
Still I need to order my dummy to cast "Human Archmage - Blizzard" instead of any ability I desire.. <-- that's main problem

Well, are you sure that A006 is the ability raw code of your custom spell? Because usually when pressing control + d inside the editor it shows something like:

A006:ACbz or something similar. ACbz would be the raw code that you can use with IssueTargetOrderById. So to fix the problem with using different spells I suggest creating a boolean variable, and then do what I showed in my previous post. This way you can check if the ability is being cast with the raw code of the ability.

  • Custom script: set udg_didSpellCast = IssueTargetOrderById(udg_yourUnit, 'ACbz', udg_yourUnit)
Now you can simply display to all players the variable didSpellCast in order to see if the spell did actually cast or if something went wrong.

You should then be abled to use the raw codes for different abilities too.

Anchorist said:
I don't know why when hero casts dummy spell the area is damaged 5 times for 0.01 (with 0.2 sec interval)
This is probably because of the blizzard spell itself.
See the following fields:

Data - Building Reduction
Data - Damage
Data - Number of Shards
Data - Number of Waves
 
Level 5
Joined
Oct 10, 2010
Messages
71
So what with variable, system is MUI, and spell is Damage Over Time.. ;/, can someone just create dummy map with that spell plz? I'm getting tired of it.

by "In-guit I meant that "Order - Human Archmage - Blizzard" I just want to have a nice clean function to tell my dummy what to cast..
 
Level 17
Joined
Nov 13, 2006
Messages
1,814
Why I should do so? To add channel ability as dummy? I have problem with ORDERING not with detecting

BUT why u got problem with ordering? it is simple gui trigger action

(yes it use orderstring but if u do in gui then u see normal abilities name and just choose what u want)

i dont think u can do ability what not orderable, since example if i do unit target channel ability, change base order id to harvest, then in gui i choose harvest order in actions
 
Level 24
Joined
Aug 1, 2013
Messages
4,658
Sorry for my laziness for not reading all comments but it seems like it is this:

  • Actions
    • Unit - Create 1 DUMMY for <player> at <location> facing Default building facing degrees
    • Set TempUnit = (Last created unit)
    • Unit - Add a 2.00 second Generic expiration timer to TempUnit
    • Unit - Add <ability> to TempUnit
    • Unit - Set level of <ability> for TempUnit to <level>
    • Unit - Order TempUnit to <order>
What you need is
- a unit type called DUMMY.
- a player that should own the dummy. (If you use proper spells for the dummy then it is no problem to use the same player over again.)
- a location. (Can also be the same location every time if you have no range on the dummy spells.)
- an ability that should be cast.
- an order that the dummy should use to cast the spell.
- the level is optional.

If the expiration timer is worse than removing the dummy then you can make your own removal. (Not so hard to do.)

Don't even try to make it "easier" for you because if you use GUI, this is how it is done.

Be carefull using Channel ability that you have to give the ability a proper order that can be used the same way the ability should be used.
An instant cast order cannot be used on a targeting spell for example.
 
Level 3
Joined
May 12, 2012
Messages
41
okay lol i asked ralle to re-open the thread and it took me quite a while to get my stoned brain back into the problem and what solution i wrote to ralle a few weeks ago, but i think i got it again. all of you guys think way too complicated, the problem is very simple to solve:

Anchorist,
if you want your dummy to cast something else then blizzard, you just have to order your dummy to cast the spell that you based your own spell off of. idk if this is correct/understandable english, so...
order dummy to cast blizzard will cast a blizzard-based spell.
order it to cast shadowstrike, will make it cast a spell that has basically been a shadowstrike, before you edited it.
so the basical question here is, which ability did you pick when you clicked at the "create new ability"-button?
 
Level 24
Joined
Aug 1, 2013
Messages
4,658
When you create a new ability, you will find yourself at this screen:
jAZgYqe.png


As you can see, I have filled in a name.
However the "Ok" button is not enabled because I haven't chosen a base ability.
Every ability is made from a template.
Every template has different hardcoded stuff. (Casting-Type, Base-Order-Id, Targeting, Autocast option, active/passive, hardcoded effect, etc.)
According to those things, the fields in the editor are shown/hidden.
Try to find the field "Data - New Unit Type" (Chaos) in any other ability than Chaos.
That is why it is basically impossible to have no base ability.

Now that you ALWAYS have a base ability, you will know what order you need.
 
Status
Not open for further replies.
Top