Frictional Games Forum (read-only)
[SCRIPT] Moving Painting - Printable Version

+- Frictional Games Forum (read-only) (https://www.frictionalgames.com/forum)
+-- Forum: Amnesia: The Dark Descent (https://www.frictionalgames.com/forum/forum-6.html)
+--- Forum: Custom Stories, TCs & Mods - Development (https://www.frictionalgames.com/forum/forum-38.html)
+---- Forum: Development Support (https://www.frictionalgames.com/forum/forum-39.html)
+---- Thread: [SCRIPT] Moving Painting (/thread-24741.html)



Moving Painting - MsHannerBananer - 03-02-2014

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.

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

    
}

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

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.


RE: Moving Painting - Daemian - 03-02-2014

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:
AddDebugMessage"Hey, I'm Working"false ); 

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


RE: Moving Painting - Romulator - 03-02-2014

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:
void SetEntityVisible(string &in asNamebool abVisible); 
Shows/Hides the mesh of the specified entity.


RE: Moving Painting - Mudbill - 03-02-2014

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.


RE: Moving Painting - MsHannerBananer - 03-02-2014

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