SC2Mapster Forums

Development > Triggers

Prevent a unit from picking up an item?

  • 5 posts
    #1 Feb 19, 2013 at 19:38 UTC - 0 likes

    How do I prevent a unit from picking up an item?

    I tried moving the item to the item location, but that will be the location of the carrying unit.

    NOTE: I need to be able to make a unit not able to pick up an item, but still able to interact with it.

    Last edited Feb 19, 2013 by Demtrod
    #2 Feb 19, 2013 at 22:47 UTC - 0 likes

    @Demtrod: Go

    Upon picking up the item you can issue an order to the unit to immediately drop the item. You could also remove the item and create an identical one at the same position.

    You could also give the item a certain class and have that class not accessible by the unit's inventory.

    My Projects:
    Malum Ruina: SC2Mapster
    Eternal Exile: SC2Mapster
    Spine Crawler Madness: SC2Mapster
    Xeno Crisis: SC2Mapster

    #3 Feb 20, 2013 at 16:34 UTC - 0 likes

    uhm - well the problem is that I cant get the original location of the item, so I cant find a location to drop it.

    The thing is, I got 2 teams, each with an item belonging to the team. Players on team 1, should not be able to pick up the item belonging to the team unless it's being picked up, and dropped by an enemy.

    I tried making the Inventory ability, inventory slot only accept 1 type (the type of the enemy item, and a filler, to change when the item is not in it's place).

    Then I tried to change it with the Catalog Field Value Set command, but it cant change that value (Access denied)

    Last edited Feb 20, 2013 by Demtrod
    #4 Feb 20, 2013 at 17:32 UTC - 0 likes

    Inventories run off of abilities. You could try creating a duplicate inventory with different acceptable classes, then disable one inventory ability for team 1 and the other for team 2 using the enable/disable ability function. If that doesn't work, give each team unique unit types.

    As far as getting the location of the item, you would need to periodically set a point variable using the item's position. Items are units, so the Position of Unit function should work here. To keep the item's position from changing when it's picked up, set a boolean variable to TRUE when a unit takes the item and FALSE when the unit drops the item. You can check the state of this boolean variable before setting the position of the item in the point variable.

    There may be a flag on the item that changes depending on whether it's in an inventory or not... not sure about this one. If so, that would be another condition you could check before setting the position of the item in the point variable instead of setting a boolean switch.

    #5 Feb 20, 2013 at 17:50 UTC - 0 likes

    I found another approach, I created 2 slots for the inventory, then added a requirement for each slot, with a requirement in use and hide that checked if a player had an upgrade, and then I set the upgrade for each player depending on the current events. So it works now.

  • 5 posts

You must login to post a comment. Don't have an account? Register to get one!