Hello -
I'm trying to use a health potion in and out of battle from script. Here is what I've tried:
ORK.Game.ActiveGroup.Leader.Inventory.Items.Get(ORK.Items.Get(orkItemID)).Use(ORK.Game.ActiveGroup.Leader, new List<Combatant> { ORK.Game.ActiveGroup.Leader }, true);
This works out of battle just fine. In battle, it does not use the item, but instead waits and uses the item after the Battle is over. Looking at the source code for the ItemShortcut Use() function, I tested to make sure that CanUse() returns true and targets.count is > 0. So with these test passed, it should move on use the action, but it does not. Man I would kill to be able to step through the code - it would make it so much easier to diagnose what's going on :) I don't know much about DLLs, but if there was a way to put them into debug mode and then step through the code, that would be amazing.
I should also mention that I have it setup so that using an item costs 1 action point and out of a pool of 1 action points per turn. So there should be available AP to use the item.
I also tried this:
ORK.Access.Action.UseItem(ORK.Game.ActiveGroup.Leader.Inventory.Items.Get(ORK.Items.Get(orkItemID)), ORK.Game.ActiveGroup.Leader, new List<Combatant> { ORK.Game.ActiveGroup.Leader }, null, true, true, true, 1, 1, null, null, null, new ItemAction(ORK.Game.ActiveGroup.Leader, ORK.Game.ActiveGroup.Leader.Inventory.Items.Get(ORK.Items.Get(orkItemID))));
This uses the item in Battle (yay) but it does not consume Action point when that happens and I need it to.
THanks,
-Mike