Jump to content

Recommended Posts

Hey guys. I'm hoping you can help me shed some light on the selection parameter in addAction.

This is what I'm trying to achieve:
When approaching the object (Dual Monitor on stand) 2 actions are available. I want the actions to be fixed to each screen so when looking on the left screen only the left screen's action is available and vice versa. The object in question is the "Land_TripodScreen_01_dual_v1_F". I'm been trying to use the addAction selection parameter to do this but the actions does not want to show up.

 

Now my primary guess is that the selection names I'm using aren't correct but I can't for the life of me figure out how to find them. The config shows hiddenSelections to be "Screen_1" and "Screen_2" and selectionNames provide the same but in lower case. I've tried HandleDamage and HitPart to no avail and I've even resorted to guessing a few variations too: screen1, monitor1, monitor_1, etc.


Here's the code I'm currently running:

Spoiler

 


this setObjectTexture [0, "#(rgb,8,8,3)color(1,0,0,1)"];
this setObjectTexture [1, "#(rgb,8,8,3)color(0,1,0,1)"];
this addAction [ 
	"Red",  
	{hint "Red"},  
	[],  
	0,  
    true,  
    false,  
    "",  
    "true",  
    50,  
    false,  
    "Screen_1" 
]; 
this addAction [ 
    "Green",  
    {hint "Green"},  
    [],  
    0,  
    true,  
    false,  
    "",  
    "true",  
    50,  
    false,  
    "Screen_2" 
];

The action works fine when the selection parameter is set to: ""


this addAction [ 
    "Green",  
    {hint "Green"},  
    [],  
    0,  
    true,  
    false,  
    "",  
    "true",  
    50,  
    false,  
    "" 
];

 

 

 

 

So you guys know anything else I can try to get the selection parameter to behave.

If not any ideas for a workaround? I've played with the idea of using the intersect family but, unless I've missed one, none of them return the selection.

Maybe I need to go the whole hog and approximate each screen in model space and then do some fancy math to check it against the camera vector? Could be expensive for an addAction condition though.

 

Thanks.

Share this post


Link to post
Share on other sites

Update: I haven't managed to get the selection parameter to work on addAction. Seems like there's is no valid selection in the geometry. I have got a workaround though! 

So if anyone is trying to achieve separat actions on each monitor of the Dual Monitor you can do this:

1. Place the Dual Monitor Stand.
2. Place two Spheres 100 cm (found under Helpers, make sure it's the ones with geometry).

3. Position each sphere so it covers each monitor and then go in and change the alpha channel on the sphere's texture to 0.

4. Add actions to each sphere.

5. Profit!

 

This should work with any other stationary object too if you want an action that is available only when looking at a certain part of the object.

Share this post


Link to post
Share on other sites

At risk of "necro-ing" the thread, I'd like to point out to future users who find this article that yes, you can add an action to objects that are not stationary. 

Make sure you use the correct sphere (classname "Sign_Sphere100cm_Geometry_F").
Attach the sphere object (here given variable name _sphere) with whatever offset to your object. In this case, the hood of a civilian van:

_sphere attachTo [_van, [0,3.5,-0.5]];

And then execute an addaction unto the sphere from whatever init or script file.
The sphere (and addaction) will move with the vehicle.

Thought I'd save someone a few hours messing with selectionNames and addAction syntax...
 
 

  • Like 1

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

×