I made a system last night, spent hours on it in fact, and I thought I had come up with something good. When I tested it today nothing worked (of course). NWN2 is so weird sometimes.
I wanted to do an illusion of you as a player moving crates. I have a conversation with a placeable (the crate) where I try to move it. To achieve this illusion I first run ga_destroy at the end node of the conversation and then right after my own script that looks like this:
The placeable is destroyed but the same placeable isn’t spawned again at a different waypoint. At first I thought it had to do with the destroying and spawning being so close to each other, that’s why I made a delay in my script. Maybe that delay isn’t enough? I tried with 4.0 and 5.0 but still nothing happens. Maybe it’s because it’s at the end of a conversation…In that case all my hours making this will have been for nothing…ugh, I’m asking here if anyone maybe understands, knows, what’s going on, and why it doesn’t work. Thanks. (It’s really frustrating to always be stopped dead in developing a module, when the toolset won’t do what I want it to do, and there’s always a million tests to be made before anything works…Ok, sorry, but I’ve had quite a bad day at work today, and when coming home and wanting to test something that should work then…it sucks the energy out of you).
After thinking a bit further when taking a break from this, I thought “Ok, maybe you can’t destroy the same object and spawn it right after” so I made a copy of the blueprint of the placeable and gave it a new tag, resource name and template resref, but the problem still persists. Really weird. Now, I have really no clue what’s going on. There must be something wrong with my script…
Well, what do you know…Since I didn’t trust myself anymore, I did a new script with the Lilac Soul Script Generator and even without a delay that seemed to solve it for some reason. Here’s the new script:
Precisely. After further testing I noticed that was the problem all along. As much as I’d like to use your script it will be easier for me to do it as I’ve done it, since the work is already done. If I were to put your script in my “system” it would require more work than what I need to do now. I got it working with a delay when using CreateIPSpeaker instead on the placeable’s OnUsed, instead of gp_talk_object. And I now use one of the companions as the conversation owner, and thus the destroying and spawning problems went away, even with a delay.
Yes, beware of trying to execute stuff from something you are destroying. If you destroy the object doing the functions prior the function running, nothing will happen.
Here is a great tip for you … Use the SetScale on the object you want to destroy with 0.001 in every parameter, and delay it’s destruction until all function calls from it are done.
It gives an excellent illusion of immediate destruction, but allows you to still work with it until you are done. I use that trick in many situations to great effect.