Jump to content

Recommended Posts

Good morning!

 

I was just wondering if there's a script to hide objects and make them reappear, using another object as an interactable?

In this image, I'd like the green console on the right to have an interactable menu that will be able to "deactivate-" aka hide- the red bridge. How would I go about doing this?

 

Any and all help will be appreciated,

Thanks!

Share this post


Link to post
Share on other sites

Welcome on forum.

 

You can write an addAction on init field of an object, then the code will hide/reveal the other object.

say you are naming a bridge (or any object you want to hide/reveal):  yourBridge

in init field of yourBridge :

this hideObject TRUE;

(to start hidden)

 

in init field of any object you want to be a switch, write something like:

this addAction ["<t color='#33ff33'>Reveal bridge</t>",{
  params ["_tgt","_plyr","_id","_obj"];
  if (isObjectHidden _obj) then {
    _tgt setUserActionText [_id,"<t color='#ff3333'>Hide bridge</t>"];
 
   _obj hideObject FALSE
  } else {
    _tgt setUserActionText [_id,"<t color='#33ff33'>Reveal bridge</t>"];
    _obj hideObject TRUE
  }
  },
  yourBridge,
  -6,
  false,
  true,
  "",
  ""
];

(work in SP. In MP you must use global command:  hideObjectGlobal and the init field of yourBridge must be a little bit different.)

 

 

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

×