pro5 Posted December 25, 2013 Share Posted December 25, 2013 I've tried numerous ways, but nothing seems to work: 1) Applying effect opcodes 112 / 123 IF Die() THEN RESPONSE #100 ApplySpellRES("P5DRIW1",Myself) // P5DRIW1 applies opcodes 112 + 123 with resource field = wanted item resref (F_DRIWP1) AddexperienceParty(6) // This is just to make sure the script block actually gets executed (it does) END Doesn't work, the item is not removed. Works fine if used without Die() - for example, with a HotKey() trigger. 2) DestroyItem IF Die() THEN RESPONSE #100 DestroyItem("F_DRIWP1") AddexperienceParty(6) // This is just to make sure the script block actually gets executed (it does) END Doesn't work, the item is not removed. Works fine if used without Die() - for example, with a HotKey() trigger. 3) TakeItemReplace IF Die() THEN RESPONSE #100 TakeItemReplace("MISC75","F_DRIWP1",Myself) AddexperienceParty(6) // This is just to make sure the script block actually gets executed (it does) END Doesn't work, the item is not removed. Works fine if used without Die() - for example, with a HotKey() trigger. Out of desperation, I even tried DestroyAllEquipment() and DropItem() - those don't work with Die() either! CreateItem() + DropInventory() on the other hand do work, so it's not like inventory is untouchable at this point as the creature is about to die. Adding Wait() or SmallWait() after any of the actions does not seem to help. Link to comment
pro5 Posted December 25, 2013 Author Share Posted December 25, 2013 Can't edit the post now - nevermind the different prefix in resrefs above (P5 vs F_) - that's not the problem (I just forgot to change that when copy-pasting). Link to comment
Wisp Posted December 25, 2013 Share Posted December 25, 2013 Many actions cannot be executed by dead actors. Most of the spell actions have a *Dead() version that is identical to the normal version, except it can be executed by dead actors, e.g., ReallyForceSpellDeadRES(). Link to comment
pro5 Posted December 25, 2013 Author Share Posted December 25, 2013 Many actions cannot be executed by dead actors. Most of the spell actions have a *Dead() version that is identical to the normal version, except it can be executed by dead actors, e.g., ReallyForceSpellDeadRES(). I missed ReallyForceSpellDeadRES when searching IESDP, thanks. But unfortunately it doesn't seem to work either... Link to comment
lynx Posted December 25, 2013 Share Posted December 25, 2013 it does work, even vanilla bg2 uses it around 100 times (ok, mostly the id variant). Link to comment
pro5 Posted December 25, 2013 Author Share Posted December 25, 2013 it does work, even vanilla bg2 uses it around 100 times (ok, mostly the id variant). It doesn't specifically for my needs - to remove items. This doesn't work, unless I'm missing something: IF Die() THEN RESPONSE #100 ReallyForceSpellDeadRES("P5DRIW1",Myself) // P5DRIW1 applies opcodes 112 + 123 with resource field = wanted item resref (F_DRIWP1) AddexperienceParty(6) // This is just to make sure the script block actually gets executed (it does) END The item is not removed. Again, this works fine if used without Die() - for example, with a HotKey() trigger. Link to comment
Jarno Mikkola Posted December 25, 2013 Share Posted December 25, 2013 Why the item needs to be removed when the creature is dead ? Just asking, cause there could be other better ways to go about this. Link to comment
Ardanis Posted December 25, 2013 Share Posted December 25, 2013 IIRC it doesn't work because items drop from the inventory upon death, i.e. no longer count as equipped, unless they're flagged as non-movable. Link to comment
pro5 Posted December 26, 2013 Author Share Posted December 26, 2013 Why the item needs to be removed when the creature is dead ? Just asking, cause there could be other better ways to go about this. IIRC it doesn't work because items drop from the inventory upon death, i.e. no longer count as equipped, unless they're flagged as non-movable. I'm trying to prevent a certain item from dropping, replacing it with another item. I'd rather not make it undroppable because the NPC is joinable and the item is his in-party weapon. However, this item is also restricted to be usable only by the NPC (or, rather, it has some limitations which make it less useful for a PC) and if the player chooses to attack and kill the NPC instead of recruiting him, they won't be able to use it. I want the NPC to drop a different version of that item without some usability restrictions in that scenario. Link to comment
Ardanis Posted December 26, 2013 Share Posted December 26, 2013 I'm trying to prevent a certain item from dropping, replacing it with another item. I'd rather not make it undroppable because the NPC is joinable and the item is his in-party weapon. However, this item is also restricted to be usable only by the NPCCheck ToBEx, it allows such item restriction on engine level, and iirc BGEE has this feature built in as well. Link to comment
lynx Posted December 26, 2013 Share Posted December 26, 2013 Why not mark it as undroppable / swap it upon Enemy()? Link to comment
Avenger Posted December 26, 2013 Share Posted December 26, 2013 I can only repeat what Ardanis said: 1. Die() happens after dropping the inventory, no trickery can fix that. 2. BGEE has the feature to make an item usable only by a certain character (opcode 319). Link to comment
argent77 Posted December 26, 2013 Share Posted December 26, 2013 I'd rather not make it undroppable because the NPC is joinable and the item is his in-party weapon. However, this item is also restricted to be usable only by the NPC (or, rather, it has some limitations which make it less useful for a PC) and if the player chooses to attack and kill the NPC instead of recruiting him, they won't be able to use it. I want the NPC to drop a different version of that item without some usability restrictions in that scenario. Why not equip that different version by default and replace it by the restricted version if the character actually joins the party? Link to comment
pro5 Posted December 26, 2013 Author Share Posted December 26, 2013 Thanks all for responses, the answer to original question is clearly yes, it's impossible. I just wanted to make sure I'm not messing up somewhere. I'll figure out something to do what I need, although it won't be as pretty and easy as it could be with Die(). Why not equip that different version by default and replace it by the restricted version if the character actually joins the party? I'll probably end up doing something similar to this suggestion, it'll just be a bit more workaround work than I hoped for. BG engine offers very limited possibilities for scripting equippable items management, and whichever way you try to do it, something seems to be off or outright doesn't work. :sigh: Link to comment
Ardanis Posted December 26, 2013 Share Posted December 26, 2013 Just a thought, but I'm of a very firm opinion that trying to pull off a smart trick within an NPC mod is generally a bad idea and a waste of modder's time. As mentioned above, use ToBEx or BGEE to restrict an item to a particular character, there's even a setting to allow free moving of an item in their inventory, but never taking outside of it. Also you might be able to drop a new item upon death via ~GiveItemCreate() DropInventory()~, I think I've tested it once. Link to comment
Recommended Posts
Archived
This topic is now archived and is closed to further replies.