Facebook Twitter YouTube Frictional Games | Forum | Privacy Policy | Dev Blog | Dev Wiki | Support | Gametee

Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Script Help Moving Painting
MsHannerBananer Offline

Posts: 218
Threads: 34
Joined: Sep 2013
Reputation: 10
Moving Painting

Trying to move a painting from closed to open for a hole in the wall. The process is unseen by the player, so I'm not concerned about animation. My script is as follows.

void OnStart()
{        SetEntityPlayerInteractCallback("secretButton", "OpenPainting", true);


void OpenPainting(string &in asEntity)
    SetEntityActive("openP", true);
    SetEntityActive("closeP", false);

But when testing the map, despite having entity "openP" set as inactive, to be activated in script, it's active in the map, and the script doesn't seem to work.

I know this will probably make a lot of you laugh, but scripting isn't my strong point, so while this might be an easy fix for you, it really isn't for me. I've done one other interact callback before this, so I figured it wouldn't be too difficult. I was wrong, so it seems, ahaha.

03-02-2014, 02:10 AM
Find Reply
Daemian Offline
Posting Freak

Posts: 1,129
Threads: 42
Joined: Dec 2012
Reputation: 49
RE: Moving Painting

Nobody is laughing, why you say that?
You're probably dealing with a static object, which can't be disabled/enabled.

If it's a regular entity, add a debug message to make sure that your function is running.
PHP Code: (Select All)
AddDebugMessage"Hey, I'm Working"false ); 

In-game, enable debug messages on the debug menu. F1 key.

03-02-2014, 02:38 AM
Find Reply
Romulator Offline
Not Tech Support ;-)

Posts: 3,626
Threads: 62
Joined: Jan 2013
Reputation: 195
RE: Moving Painting

Actually some entities cannot be inactive. I think doors are one of those as well. You can set the meshes to be invisible now I think with the AAMFP patch.

PHP Code: (Select All)
void SetEntityVisible(string &in asNamebool abVisible); 
Shows/Hides the mesh of the specified entity.

Discord: Romulator#0001
[Image: 3f6f01a904.png]
03-02-2014, 02:41 AM
Find Reply
Mudbill Offline

Posts: 3,878
Threads: 59
Joined: Apr 2013
Reputation: 178
RE: Moving Painting

You can try SetPropActiveAndFade, which might affect static entities too. Otherwise you can open the entity and set the type to Object > Static instead of StaticProp, then save it as another entity.

03-02-2014, 03:40 AM
Find Reply
MsHannerBananer Offline

Posts: 218
Threads: 34
Joined: Sep 2013
Reputation: 10
RE: Moving Painting

Thanks for you help guys. I took a stab at the model editor and turned the painting into a slide-able entity, so all my script problems sort of... flew out the window. I was reluctant about using it because I figured I'd mess everything up, but after some trial and error and a lot of problems, I got it to work, thanks to brainstorming and you guys poking me about the editor. Besides, your insights on how I could get it to work could help for other script!

Thanks! Big Grin

03-02-2014, 12:45 PM
Find Reply

Users browsing this thread: 1 Guest(s)