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.
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)
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.
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.
Rollback Post to RevisionRollBack
To post a comment, please login or register a new account.
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.
@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.
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)
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.
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.