nicked on 30/8/2019 at 18:51
I thought this would be simple, but apparently not...
I have an ingame store set up using tnhscript PurchaseItem and ShoppingCart. It all works great - when I have enough loot, I can buy the item, it appears in my inventory, job's a goodun.
However, I need to be able to trigger certain events only when the item is purchased.
I can't use the checkout button, that triggers things even if I don't have enough money to make the purchase.
TrigContained doesn't seem to work - if it's on a concrete object, the store creates a copy of the item, so the concrete object never actually gets picked up. I also tried adding TrigContained to the archetype and linking that to what I want to trigger, but that does nothing.
Is there actually a way to trigger off of the actual object I have purchased, or am I going to have to throw out the tnhscript store and set the whole thing up differently?
R Soul on 30/8/2019 at 19:26
TrigContained will look for CD links from the concrete (world) object, so linking from the abstract (archetype) object will not work.
The best thing to do is install NVScript and, on the archetype use NVTrigContained. You can use design note parameters to specify a target object. E.g. NVTrigContainedTDest="ObjectName".
All you then need is a concrete object called ObjectName to be triggered. If you have any instances of the item that are lying around (e.g. the store has flashbombs and there are a couple in the mission that can be stolen), you'll need a separate child archetype just for the contained triggering.
nicked on 30/8/2019 at 19:31
Ah that's nice and elegant!
I actually kept on fiddling and solved it (in a much more needlessly-complex way) by triggering a conversation to add a link from the checkout button to the thing I'm triggering when an invisible loot goal of the item's value is completed. It's hacky, but since it's not a real item store, just a proxy for a complicated objective, it'll do for now. When I'm less drunk, I may swap it for your solution as it's a lot neater and frees up the hidden objective.
Edit: Actually (and I haven't tried it so could be wrong) wouldn't the NVTrigContained solution run into the same problem with the item being granted not being the concrete object specified (as the store technically creates a copy)?
R Soul on 30/8/2019 at 20:32
No, because instead of looking for a link, it uses the value of the 'design note' property, which is inherited from the hierarchy, to find out what to trigger.
nicked on 31/8/2019 at 10:31
Ah, marvelous, thanks!