HomeUser Control Panel (unavailable in archive)ForumsTutorialsArt GalleryResourcesMaps

Can I issue an order with triggers to cast a spell based on an item spell?

06-14-2004, 04:19 PM#1
Anitarf
Can I issue an order with triggers to cast a spell based on an item spell? When I check the possible orders I can give with the issue-order-trigger, I can use only preset orders, so can an ability based on an item ability be cast with triggers in any way?
06-14-2004, 05:29 PM#2
johnfn
I just looked around and as far as I can see, no. I've looked around for this before and now and I can never seem to find anything. So, no. There is no way (feel free to prove me wrong, if any of you can find something)
06-14-2004, 09:24 PM#3
th15
I worked around this problem by triggering giving a modified Rune to the unit casting the ability. Guess that would only work with units th inventories though.
06-14-2004, 09:27 PM#4
Vexorian
nah, you just have to find its orderid, and then use the JASS byId natives
06-15-2004, 05:56 AM#5
Anitarf
And how would one go about doing that? Or is it too complicated for a JASS-non-certified mapmaker?
06-15-2004, 06:16 AM#6
JJ912
Start off by making the trigger you want everything to happen in, then make a new empty trigger. Now look at the spell in the Object Editor and find its order string. In the empty trigger, make an action ordering a unit to cast a spell of the same target type as the one you want- targeting a unit, targeting a point, no target, whichever. Convert that 1 action trigger to custom text and replace the order string part with the orderstring of the spell you want. If you used Storm Bolt in the action it would look like 'thunderbolt' in JASS. Then copy the action, and go to the real trigger. Paste the function into a custom script in the real trigger and voila. It sounds like a lot of work but it takes just a few seconds.
06-15-2004, 05:10 PM#7
Anitarf
I thought there should be a way to manualy input orderstrings, just didn't think of costumtexting it... But the problem with my ability is, it has no orderstring (at least not in the object editor, I mean, all the orderstrings there are set to none).

Well, to get directly to my example: I am trying to make a spell-shield ability; you cast it on a unit and the unit get's the spell shield for a while. I tried giving the ability directly to the hero, but it turned out to be an AoE spell (dooh, since it is originaly used by a rune).

I then thought, no problem, use a fake spell that targets a unit and cast the real spell with a dummy caster, the dummy is triggered so it is accurate enough to hit a single unit with an AoE spell that has low area (because I don't want it to hit other units). Of course, the question was, how to order the unit, if the spell doesn't display any orderstring.

I tried with the give-rune-to-caster thingy, but there were multiple problems: when used on a rune, the spell wouldn't accept custom buffs and would revert to the original, it would also ignore the duration and last infinitely. Furthermore, removing the buffs from everyone in the area except the target and those units that had the buff before would be annoying to do (but I've done worse). So, I am now still hoping there is a way to cast this ability directly on my target, without area items and such...
06-16-2004, 10:08 PM#8
Vexorian
no, you are really confused this time.

OrderId s are integers, most of the usual abilities have an orderstring, but some don't , but every ability has an orderid.

To get the orderid of an ability that doesn't have a string

Events
A unit is issued an order targeting a point
A unit is issued an order targeting an object
A unit is issued an order with no target
Conditions
Actions:
Custom SCript: call BJDebugMsg(I2S(GetIssuedOrderId()))

now have that trigger in a test map, enter to the map (in war3) pick a unit and order it to use the spell you want to find the order id.

It should show a silly number like 856703, take a paper and write it down, that is the order id for that ability and every ability based on it.

Now to use that ability you need to use the byId Natives:

Code:
native IssueImmediateOrderById      takes unit whichUnit, integer order returns boolean
native IssuePointOrderByIdLoc       takes unit whichUnit, integer order, location whichLocation returns boolean
native IssueTargetOrderById         takes unit whichUnit, integer order, widget targetWidget returns boolean

Those functions take an integer instead of a string to issue the order, use that order id you wrote.
06-17-2004, 10:07 AM#9
GaDDeN
I just got the same problem but, vexorian.... how do u suppose i order a unit to cast "the spell", when the PROBLEM is that i cant order it to cast the spell? "if u order it to cast spell, then u CAN order it to cast spell".... weird? :D

Anyways im going to make the hidden unit a hero and then use a wand of illusions (thats the skill i want). But that will show up in the hero menu.... oh fuck i hate impossible problems
06-17-2004, 04:19 PM#10
Anitarf
Thanks, Lord Vexorian, for the explanation. Orderstring, orderID, without ever having used jass, I really was confused. :)

Edit: I have just tested the principle in practice and it works with no problems. Thanks again for your help. Maybe, this way, I will slowly learn JASS without even trying hard. :)
06-18-2004, 01:10 PM#11
Vexorian
Quote:
Originally Posted by GaDDeN
I just got the same problem but, vexorian.... how do u suppose i order a unit to cast "the spell", when the PROBLEM is that i cant order it to cast the spell? "if u order it to cast spell, then u CAN order it to cast spell".... weird? :D

Anyways im going to make the hidden unit a hero and then use a wand of illusions (thats the skill i want). But that will show up in the hero menu.... oh fuck i hate impossible problems
you have to manually make it use the spell when taking note of the orderid
09-24-2004, 09:48 AM#12
Guest
Quote:
Originally Posted by Lord Vexorian
no, you are really confused this time.

OrderId s are integers, most of the usual abilities have an orderstring, but some don't , but every ability has an orderid.

To get the orderid of an ability that doesn't have a string

Events
A unit is issued an order targeting a point
A unit is issued an order targeting an object
A unit is issued an order with no target
Conditions
Actions:
Custom SCript: call BJDebugMsg(I2S(GetIssuedOrderId()))

now have that trigger in a test map, enter to the map (in war3) pick a unit and order it to use the spell you want to find the order id.

It should show a silly number like 856703, take a paper and write it down, that is the order id for that ability and every ability based on it.

Now to use that ability you need to use the byId Natives:

Code:
native IssueImmediateOrderById      takes unit whichUnit, integer order returns boolean
native IssuePointOrderByIdLoc       takes unit whichUnit, integer order, location whichLocation returns boolean
native IssueTargetOrderById         takes unit whichUnit, integer order, widget targetWidget returns boolean

Those functions take an integer instead of a string to issue the order, use that order id you wrote.

Query:
If an OrderID is an integer, could I use a "Custom Script: call BJDebugMsg(I2S(GetIssuedOrderId()))" to get then ID of a spell being cast, set it to a variable, and then have a dummy Unit cast the spell by OrderID using the integer variable?
From your post I think this could work but what exactly do I need to do to cast a spell via OrderID? (I have no experience with JASS /Custom Script...)

Any help would be much appreciated! thnx in adv
09-24-2004, 02:04 PM#13
Anitarf
If you are confused, here's another topic about this with a more practical example.
09-24-2004, 03:03 PM#14
Phyvo
Quote:
Originally Posted by GaDDeN
Anyways im going to make the hidden unit a hero and then use a wand of illusions (thats the skill i want). But that will show up in the hero menu.... oh fuck i hate impossible problems

Give the unit to the neutral passive player, and make sure your skill can be cast on friends/neutral/enemies. You can still order it to do stuff, and you won't get any messy hero icons for the player.

I just realized, you don't even have to do that (though I would recommend it... that way, the players are less likely to notice). Go to to the hero in the object editor, and somewhere in the stats part I think, you can fiddle with hero displays. You can make it not show as a hero, make it not show as a hero on the minimap, and even not make it show up on the minimap at all.

That help?
09-25-2004, 03:13 AM#15
Guest
I need to know how to set 'call BJDebugMsg(I2S(GetIssuedOrderId()))' to a variable.

Set SpellIDs = call GetIssuedOrderId() ??
does GetOrderID() automaticaly get the ID of the spell that set off the trigger?

I also need to know how to Cast a spell using that Variable.

Unit - Oder 'Mimic' to 'SpellIDs' Enemy ??

I think I understand this but is except it only has one unit entery?
How do you get a particular unit to target another?
Custom Script: IssueImmediateOrderById ( GetCastingUnit() ?? , SpellIDs ??) ??