Jump to content
hcpookie

addaction missing for loaded inventory item

Recommended Posts

Question on addaction. 

 

I am attempting to addaction to the Inventory Laptop... the "Laptop (Open)" item that can be loaded in inventory.  I can add it no problem.  The PROBLEM is that, if I load it into my backpack, then unload it, the action item is no longer present.

 

Specifics For Example:

- I addaction my known good ARTY mod "artymission" action in the editor to the "Laptop (Open)" object.

- Then enter the mission.  The action is present when I walk up to the laptop.

- I put the laptop in my backpack

- I remove the laptop from my backpack

- The added action is no longer present!

 

I can repeat this missing action item even if I add a custom config to it with a "class useractions" action item, so this is not just an editor issue.  It makes no difference HOW I add the action... the custom laptop with the config-based action works as expected when entering the mission and walking up to the laptop.  Once again, I put the (now custom) laptop into my backpack, then put it back on the ground, and PRESTO the action is missing!

 

 

No mater what, the action is removed/hidden/missing/whatever when I remove the item from inventory back into the mission.

 

So my question is, whether there is a way to preserve or otherwise reset the action to be present after the inventory item is removed from inventory?  Or perhaps is there a special class of object that retains actions?

 

 

Share this post


Link to post
Share on other sites
56 minutes ago, hcpookie said:

- I put the laptop in my backpack

- I remove the laptop from my backpack

- The added action is no longer present!

 

I think that makes sense because first the laptop is world object and then it's merely a inventory entry

 

You probably need to reset the action every time the laptop is taken out of the inventory. (Maybe event handler or loop)

 

Edit: Or put the action to player then it remains. Just require the laptop type in the condition 

Share this post


Link to post
Share on other sites

I'm open to suggestions on that - I've tried INIT EH as well as the ContainerOpened and ContainerClosed event handlers.  Nothing persists once the inventory item is removed.  I am *assuming* the item's INIT EH will be launched when the item is removed from inventory, but that does not appear to be the case.

 

And the containerOpen and Closed EH's follow the same behaviors - they only work before the item is put into inventory.

Share this post


Link to post
Share on other sites

I would create my own laptop "addon" through config.cpp (the same config, same model, different class name) and add the addaction in the config.

Share this post


Link to post
Share on other sites

Not sure how you want to go about this but this script sets the action for the laptop:

 

player addAction
[
    "<t color='#00FF00'>Use laptop</t>",
    {
        params ["_target", "_caller", "_actionId", "_arguments"];
        hint 'Opening laptop...';
    },
    nil,
    1.5,
    true,
    true,
    "",
    "typeof cursorObject == 'Land_Laptop_device_F'", // _target, _this, _originalTarget
    50,
    false,
    "",
    ""
];

 

Assuming Land_Laptop_device_F is the laptop type, you might want to change that

 

the action is on player so it wont disappear

 

 

 

 

Share this post


Link to post
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now

×