I was hoping someone could help me with Item Pickup. I know that you can get your hero to pick up items through right click, but I've disabled that because I don't want him to move via right click. So how could I get him to pick up any item and add it to my inventory?
What I found works is if you issue a command to the unit, and for the command go to "Preset", there's something called (I believe) "smart command". I had the same problem.. couldn't find a "puck up" or "use" or "interact".. but smart command seems to do it.
So you just need to have a trigger that checks for a button or click, then issue the smart command to your unit. It will want to know what item you with to pick up, though. There are several ways of tackling this. The first of which may not work for all game types. You need to have a region on the map.. a circle, fairly small. When the player clicks or presses a button (whatever click or press you want to activate the 'pick up'), have an action that moves the region to the position of your unit. Then, when you issue the smart command, the location will be 'targeting unit (item) closest to the center of region' (you need to go through several menus to get it to look like that).
This will make the unit 'look' around for the item closest to him in a specified radius and then pick it up.
May I ask.. how did you disable right click movement? The only way I could figure out how to do that was by having the unit remain de-selected... which has its disadvantages.
You will probably need a "unit enters region" and create a radius around the item and have it automatically "pick up" the item. You might also be able to get that behavior from a buff "if a unit gets a buff, give the unit the item and remove the buff". Those are the ways I can think of to have a unit "pick up" an item without having the player click on anything.
Sorry it took so long to reply, but I just moved back into college, so things have been slightly hectic. As an answer to how I disabled right-click movement, all I did was disable smart click. And since I'm using WASD movement, this works, but sadly I haven't had time to try to implement your suggestion. I'll probably work on that in the next few days when I have some free time. Also, do you know how to have the unit selected at all times?
I'm not sure if this is the right solution for you because I'm not sure how your map is set up and what the items are considered. I have items dropping in the map I'm working on (right now it's only a grenade) that are considered units. I have a trigger set up for "(Any Unit) enters within 1.0 range of (My hero) and the condition is meant to filter it down to just that single item drop by making sure the "(unit type of triggering unit) = (grenade)" in my case.
I then let the trigger work it's magic with it's actions and have one to remove the unit at the end. I had to do it this way because I couldn't find an easy way to keep track of multiple grenades if there were multiples dropped at the same time.
Also depending upon you situation, if your items are units, make sure that they're invulnerable, unless you want them to be destroyable... like the grenades I'm using.
Here's how I do it:
Create an issue order effect with the ability set to your inventory ability and the ability command to the command index of "take" which is 2 (I think) and then set the target to "caster unit" and the value unit to "target unit".
Then in a trigger use "create effect on unit from unit" and set your issue order effect on "unit" from "item".
It is basically the item telling the unit "pick me up" :).
Dropping items is a different story, it is impossible as far as I can tell.
But if you want to use galaxy you can use: AbilityCommand( *YourInventoryAbility, 2) for a function call to get the ability command to pass to your standard issue order function targeting your item.
if you want to use the GUI and the Data Editor, you can create a new button for the inventory ability.
Set this button to be the default button of the Take action on the Inventory ability (Ability - Commands - Default Button)
the ability will now show up in the trigger editor under the name of the selected button, and your inventory ability name.
for dropping items use the same actions but then for the drop ability.
Unit - Order Zealot [17.77, 10.50] to ( Drop targeting (Item carried by Zealot [17.77, 10.50] in 1)) (Replace Existing Orders)
Order Targeting the item being carried. :)
that's not the reason.
it needs a target location to drop the item.
I can target the item no problem.
you can even issue the use command without a problem.
let's see if I can figure out a way to issue the correct target...
Technically your not selecting the item if it is the target of your order.
That's what I meant. Cant select the item and turn around with the point as the target of the order :(.
If you figure out a solution let us know.
Oh yea, I found another neat way to make items acquirable. You can use a search effect that is really small and just make it use issue order affect to pick up item from caster to target. No triggers for picking up items if you want to just walk over them.
someone found the missing action to allow the dropping of items correctly. This library contains what is needed to issue order drop item, issue order use item targeting unit/point. yay :D
Ahah! I have it. The trigger event for picking up a pickup item is
Unit - Any Unit uses Collect at Generic6 - Complete stage (Include shared abilities)
I kept trying to use the 'kill (target unit of triggerig ability)' function to them make the item disappear but nothing would happen. I could see it was a problem on the action side of the trigger though because the trigger was being called sucessfully.
It turns out that the item is the unit that is using the ability, not the unit that runs into the item. So in other words when
Unit - Any Unit uses Collect at Generic6 - Complete stage (Include shared abilities)
you access the item itself as (triggering unit). thus my trigger looks like:
Unit - Any Unit uses Collect at Generic6 - Complete stage (Include shared abilities)
Unit - Kill (Triggering unit)
General - Switch (Actions) depending on (Unit type of (Triggering unit))
.Cases
..General - If (Pickup - Pistol Ammo - 1 Clip)
...Actions
....Variable - Modify [WEP] Number of Clips[[PISTOL] ID]: + 1
..General - If (Pickup - Rocket Ammo - 1 Clip)
...Actions
....Variable - Modify [WEP] Number of Clips[[ROCKET] ID]: + 1
..Default
Obviously you'd replace the case variables with the unit type of whatever item you're using.
Yea baby that's the mothereffin workaround. Mmhmm, I think so.
I guess that could work for instant pick up items.
The ability could have been any dummy ability and you just give the item a buff with a search effect that makes it use it's ability on a unit entering it's radius.
I'm a little confused. I tried the smart command but there doesn't seem to be any way to designate a target (or a source, for that matter.) Does this have to be done with scripting?
Specifically, my problem is the "move inventory item" action doesn't seem to work. At all. In my map, I have a trigger that replaces a unit with an inventory with another unit that also has an inventory, and I want the items to carry over to the replacing unit. I tried using "move inventory item" but they just drop to the floor. I achieved some measure of success by simply creating a new item of the same type in the inventory of the replacing unit - however, all of the charges and cooldowns get reset. So that won't work. (Yes, I tried adding X charges to the item but it only causes the item to bug out.)
I'm pretty close to just saying "screw it" and letting the items drop on the ground.
Looks like a nice workaround: But wouldn't it be safer to set your local variable "item" to the target of the Ability directly? In some weird situations you might pick the wrong item...
Rollback Post to RevisionRollBack
To post a comment, please login or register a new account.
I was hoping someone could help me with Item Pickup. I know that you can get your hero to pick up items through right click, but I've disabled that because I don't want him to move via right click. So how could I get him to pick up any item and add it to my inventory?
@Majician21: Go
What I found works is if you issue a command to the unit, and for the command go to "Preset", there's something called (I believe) "smart command". I had the same problem.. couldn't find a "puck up" or "use" or "interact".. but smart command seems to do it.
So you just need to have a trigger that checks for a button or click, then issue the smart command to your unit. It will want to know what item you with to pick up, though. There are several ways of tackling this. The first of which may not work for all game types. You need to have a region on the map.. a circle, fairly small. When the player clicks or presses a button (whatever click or press you want to activate the 'pick up'), have an action that moves the region to the position of your unit. Then, when you issue the smart command, the location will be 'targeting unit (item) closest to the center of region' (you need to go through several menus to get it to look like that).
This will make the unit 'look' around for the item closest to him in a specified radius and then pick it up.
May I ask.. how did you disable right click movement? The only way I could figure out how to do that was by having the unit remain de-selected... which has its disadvantages.
You will probably need a "unit enters region" and create a radius around the item and have it automatically "pick up" the item. You might also be able to get that behavior from a buff "if a unit gets a buff, give the unit the item and remove the buff". Those are the ways I can think of to have a unit "pick up" an item without having the player click on anything.
@JTG2003: Go
Sorry it took so long to reply, but I just moved back into college, so things have been slightly hectic. As an answer to how I disabled right-click movement, all I did was disable smart click. And since I'm using WASD movement, this works, but sadly I haven't had time to try to implement your suggestion. I'll probably work on that in the next few days when I have some free time. Also, do you know how to have the unit selected at all times?
I'm not sure if this is the right solution for you because I'm not sure how your map is set up and what the items are considered. I have items dropping in the map I'm working on (right now it's only a grenade) that are considered units. I have a trigger set up for "(Any Unit) enters within 1.0 range of (My hero) and the condition is meant to filter it down to just that single item drop by making sure the "(unit type of triggering unit) = (grenade)" in my case.
I then let the trigger work it's magic with it's actions and have one to remove the unit at the end. I had to do it this way because I couldn't find an easy way to keep track of multiple grenades if there were multiples dropped at the same time.
Also depending upon you situation, if your items are units, make sure that they're invulnerable, unless you want them to be destroyable... like the grenades I'm using.
Here's how I do it: Create an issue order effect with the ability set to your inventory ability and the ability command to the command index of "take" which is 2 (I think) and then set the target to "caster unit" and the value unit to "target unit".
Then in a trigger use "create effect on unit from unit" and set your issue order effect on "unit" from "item".
It is basically the item telling the unit "pick me up" :).
Dropping items is a different story, it is impossible as far as I can tell.
But if you want to use galaxy you can use: AbilityCommand( *YourInventoryAbility, 2) for a function call to get the ability command to pass to your standard issue order function targeting your item.
if you want to use the GUI and the Data Editor, you can create a new button for the inventory ability.
Set this button to be the default button of the Take action on the Inventory ability (Ability - Commands - Default Button)
the ability will now show up in the trigger editor under the name of the selected button, and your inventory ability name.
for dropping items use the same actions but then for the drop ability.
"For dropping items use the same actions but then for the drop ability."
Show it in a map?
Won't work for drop because the issue order for drop requires that you select an item to drop.
@adovid: Go
Unit - Order Zealot [17.77, 10.50] to ( Drop targeting (Item carried by Zealot [17.77, 10.50] in 1)) (Replace Existing Orders)
Order Targeting the item being carried. :)
that's not the reason.
it needs a target location to drop the item.
I can target the item no problem.
you can even issue the use command without a problem.
let's see if I can figure out a way to issue the correct target...
Technically your not selecting the item if it is the target of your order.
That's what I meant. Cant select the item and turn around with the point as the target of the order :(.
If you figure out a solution let us know.
Oh yea, I found another neat way to make items acquirable. You can use a search effect that is really small and just make it use issue order affect to pick up item from caster to target. No triggers for picking up items if you want to just walk over them.
@adovid: Go
http://forums.sc2mapster.com/resources/trigger-libraries/5636-library-galaxy-item-utility-library/#p9
someone found the missing action to allow the dropping of items correctly. This library contains what is needed to issue order drop item, issue order use item targeting unit/point. yay :D
Awesome :O.
native void OrderSetTargetItem(order p1, unit p2);
So it can be done using galaxy :). Sweet.
Ahah! I have it. The trigger event for picking up a pickup item is
Unit - Any Unit uses Collect at Generic6 - Complete stage (Include shared abilities)
I kept trying to use the 'kill (target unit of triggerig ability)' function to them make the item disappear but nothing would happen. I could see it was a problem on the action side of the trigger though because the trigger was being called sucessfully.
It turns out that the item is the unit that is using the ability, not the unit that runs into the item. So in other words when
Unit - Any Unit uses Collect at Generic6 - Complete stage (Include shared abilities)
you access the item itself as (triggering unit). thus my trigger looks like:
Unit - Any Unit uses Collect at Generic6 - Complete stage (Include shared abilities)
Unit - Kill (Triggering unit)
General - Switch (Actions) depending on (Unit type of (Triggering unit))
.Cases
..General - If (Pickup - Pistol Ammo - 1 Clip)
...Actions
....Variable - Modify [WEP] Number of Clips[[PISTOL] ID]: + 1
..General - If (Pickup - Rocket Ammo - 1 Clip)
...Actions
....Variable - Modify [WEP] Number of Clips[[ROCKET] ID]: + 1
..Default
Obviously you'd replace the case variables with the unit type of whatever item you're using.
Yea baby that's the mothereffin workaround. Mmhmm, I think so.
@BacklitAvenger: Go
I guess that could work for instant pick up items.
The ability could have been any dummy ability and you just give the item a buff with a search effect that makes it use it's ability on a unit entering it's radius.
Then use the ability for a trigger event.
I'm a little confused. I tried the smart command but there doesn't seem to be any way to designate a target (or a source, for that matter.) Does this have to be done with scripting?
Specifically, my problem is the "move inventory item" action doesn't seem to work. At all. In my map, I have a trigger that replaces a unit with an inventory with another unit that also has an inventory, and I want the items to carry over to the replacing unit. I tried using "move inventory item" but they just drop to the floor. I achieved some measure of success by simply creating a new item of the same type in the inventory of the replacing unit - however, all of the charges and cooldowns get reset. So that won't work. (Yes, I tried adding X charges to the item but it only causes the item to bug out.)
I'm pretty close to just saying "screw it" and letting the items drop on the ground.
Yay, I got it! Finally.
I downloaded that trigger library linked to earlier and now issuing the "Take" order targeting the item as a unit works. Hooray!
Here's another way to do it. Create a button/ability for "Pick Up" and add it to the command card of your hero.
Create a trigger called "Item Pick Up"
item is a unit variable and ItemType is a unit type variable
@jmac321wky: Go
Looks like a nice workaround: But wouldn't it be safer to set your local variable "item" to the target of the Ability directly? In some weird situations you might pick the wrong item...