HomeUser Control Panel (unavailable in archive)ForumsTutorialsArt GalleryResourcesMaps

Picking powerups from air?

01-21-2010, 12:19 PM#1
Neversleeping
A hero has got an owl-form spell and can fly about. The problem is, he can fly around and pick up gold-powerups while being airborne. This is unintentional, so is there a way to restrict this?
01-21-2010, 12:24 PM#2
Themerion
Simple way:

Make sure the owl ain't a hero (for instance you could use Pandaren Brewmaster's ultimate).

Tricky way:

Detect the "smart" order (all right-clicks are "smart"-orders) for the owl unit-type, and interrupt it if it targets a coin.
01-21-2010, 12:41 PM#3
Neversleeping
Thanks!

The simple solution sounds elegant, but how do I make sure the owl isn't a hero? The owl unit does not have attributes-per-level and such in the field values, so must therefore be a normal unit already as far as I can see.

Must I base the owl form on a particular ability as you said, for example Pandaren ultimate?
01-21-2010, 12:52 PM#4
Anitarf
The owl form must not have an inventory (or at least a hero inventory) if you don't want it to pick up items. Best way to preserve the original hero's invenotry is to use StormEarthAndFire to summon the inventory-less owl.
01-21-2010, 01:07 PM#5
Neversleeping
I see. But the Storm, Earth and Fire does not have morphing flags and Altitude Adjustment Duration and things like that that I think is handy when dealing with flying morphs. Besides I went through a lot of hassle making it work properly, so I'm tempted trying Themerion 2nd proposal and trigger it, but I can't seem to find a reference to these smart actions using the GUI...
01-21-2010, 05:05 PM#6
Fluff
You could, I suppose, just have a trigger that fires when a hero picks up an item, and then if the hero = the flying owl you can just have an Action to drop the picked up item. That way if you right click an item it will go to that spot and just not be able to put it in its inventory.

You might have a problem if another hero drops an item into your inventory.... not sure.
01-22-2010, 08:50 AM#7
Neversleeping
but, the gold-powerup is instant effect, it doesn't actually go into his inventory...
01-22-2010, 09:20 AM#8
Anitarf
Quote:
Originally Posted by Neversleeping
I see. But the Storm, Earth and Fire does not have morphing flags and Altitude Adjustment Duration and things like that that I think is handy when dealing with flying morphs.
Use the same model for the spell projectile as you use for the summoned unit and you should get a similar effect.
01-22-2010, 10:10 AM#9
Neversleeping
Thanks a lot, perhaps for a later patch.

I went for this solution for now:

Trigger:
owlformgoldrestrict
Collapse Events
Unit - A unit Acquires an item
Collapse Conditions
(Item-type of (Item being manipulated)) Equal to Gold Coins
((Triggering unit) is A flying unit) Equal to True
Collapse Actions
Player - Add -250 to (Owner of (Triggering unit)) Current gold
Item - Create Gold Coins at (Position of (Triggering unit))

The gold coin will then be placed back, and no net change will occur with the players gold value.
01-22-2010, 10:19 AM#10
Anachron
Thats kinda bad.

I would rather check its order target as to replace the item everytime.

Collapse JASS:
local unit u = GetTriggerUnit()

if GetOrderTargetItem() != null and IsUnitType(u, UNIT_TYPE_FLYING) then
    call IssueImmediateOrder(u, "stop")
endif
01-22-2010, 03:24 PM#11
Neversleeping
That would be much better. I use the GUI though, so I'll see if I can get a similar thing working!
01-22-2010, 06:08 PM#12
Themerion
In case you need a middle ground :P

Trigger:
Collapse Events
A unit is issued an order targeting an object
Collapse Actions
Custom Script: local unit u = GetTriggerUnit()
Custom Script: if GetOrderTargetItem() != null and IsUnitType(u, UNIT_TYPE_FLYING) then
Custom Script: call IssueImmediateOrder(u, "stop")
Custom Script: endif
Custom Script: set u = null
01-25-2010, 05:47 AM#13
Neversleeping
Thanks, that's wonderful.