Destroying Object_Self from conversation
![vonstorm](https://forums.beamdog.com/uploads/userpics/3PV6RRB4NQFR/nWQQR18XZDCL6.jpg)
Trying to destroy a placable object from a conversation (with object).
The object fades out then comes back. The curious thing is that it works on my henchmen. The plot flag is not set (although the lexicon says this doesn't matter). Any tips as to what could be causing this to happen?
void main() { object oSelf = OBJECT_SELF; // Get the PC who is in this conversation. object oPC = GetPCSpeaker(); // Give "fieldsmelter" to the PC. CreateItemOnObject("fieldfletching", oPC); AssignCommand(oSelf, ActionDoCommand(SetIsDestroyable(TRUE, FALSE, FALSE))); // Destroy an object (not fully effective until this script ends). DestroyObject(oSelf,1.0); }
The object fades out then comes back. The curious thing is that it works on my henchmen. The plot flag is not set (although the lexicon says this doesn't matter). Any tips as to what could be causing this to happen?
1
Comments
I've taken the delay out because it's redundant (DestroyObject will not happen until the script has finished). Sometimes the module seems to have permission to do stuff that placeables don't.
...all the same, given the behaviour, I can't help wondering whether some other script is respawning the placeable?
create code:
Am I going insane?
SetModuleSwitch (MODULE_SWITCH_ENABLE_TAGBASED_SCRIPTS, TRUE);
I think it's internal game stuff, never looked into it
This is the simplest way I've seen to do tag based item activation.
OnActivateItem: The script with the same name as the tag of the activated item:
The pre-implemented system uses those variables to track how much interaction is going on between an NPC and a player. AI_LEVEL_VERY_HIGH actually just means that they are in combat. AI_LEVEL_VERY_LOW means there's no players in the same area.
Maybe something similar is going on with MODULE_SWITCH_ENABLE_TAGBASED_SCRIPTS.
This has nothing to do with AI_LEVEL.
Tag based scripting is very simple, it's added right into the various x2_mod_def* module scripts and does pretty much exactly what your wrapper does. It sets the userdefineditemeventnumber and then executes the script. But it does it for acquire, activate, equip, unequip, unacquire etc. So the tag based script itself should check and do the right thing for the right event number.