The following warnings occurred:
Warning [2] count(): Parameter must be an array or an object that implements Countable - Line: 906 - File: showthread.php PHP 7.2.24-0ubuntu0.18.04.17 (Linux)
File Line Function
/showthread.php 906 errorHandler->error



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
PropAnimation won't stop playing
Streetboat Offline
Posting Freak

Posts: 1,099
Threads: 40
Joined: Mar 2011
Reputation: 56
#1
PropAnimation won't stop playing

Hi everyone. I've created a spraylock door using the AMFP assets, but I had to sort of brute force my way into making it work well considering not all of the AMFP scripts work with amnesia (notably, the SetSwingDoorOpenAmount one, that makes ATDD crash). What I had to do was use two separate spraylock door entities and call each other into existence as the script goes through its motions. It's nowhere near as elegant as AMFP, but I made it work. ALMOST. I have one problem that's bothering the crap out of me: the SwingDoor entity that actually works has an endlessly looping 'opening' animation hard-wired into it or something. As it's swinging open, even after the first animation of opening the gear locks has played, it endlessly loops until I close it again and replace it with the other entity.

Here's a screenshot of how it looks in the editor, so I can more easily explain:
[Image: 58tk6sG.jpg]

The first door, hidden within the BlockBox and set to inactive, is the door that gets activated AFTER the animation. It is the one that actually swings open. For whatever reason, the AMFP assets have multiple versions of the same door in their assets: one that has no collision, but has the working animations that have their proper names all set up. That's the one that's floating off in space (I had to do that to get it to show up in the proper place in-game, I have no idea why they made the asset with the point of origin so far off from the middle, but it crashes when I try to move it and re-save it). So, that floating door plays the animation and is set to inactive, then the other door (which has collision and a proper hinge) is set to active and opens. This works perfectly, except for one thing: the second door, the one with collision, has the most irritating thing going on with it. It has a looping animation of the 'door opening' going on, and it has no name in the entity file for me to change it via scripting. I've tried using "PlayPropAnimation" with blank fields and with "none" being called, and nothing works. Here's what the animations box looks like in the modeleditor:
[Image: jqhnaBD.jpg]
Notice how the animation isn't a normal named one, it's a directory path to my amnesia folder. Something here is weird!

And for further help illustrating the issue, here's the (ugly, inelegant, but effective) script that I used.
void main_door(string &in asEntity, int alState)
{
if(alState == 1)
    {
    AddTimer("", 2, "main_door_open");
    PlaySoundAtEntity("", "13_press_done.snt", "valve_hiss", 0, false);
    for(int i=5;i<=6;i++)SetWheelInteractionDisablesStuck("valve_single_"+i, false);
    for(int i=5;i<=6;i++)SetWheelStuckState("valve_single_"+i, 1, false);
    }
if(alState == -1)
    {
    AddTimer("", 2, "main_door_close");
    PlaySoundAtEntity("", "13_press_fail.snt", "valve_hiss", 0, false);
    for(int i=5;i<=6;i++)SetWheelInteractionDisablesStuck("valve_single_"+i, false);
    for(int i=5;i<=6;i++)SetWheelStuckState("valve_single_"+i, -1, false);
    }
}
void main_door2(string &in asEntity, int alState)
{
if(alState == 1)
    {
    AddTimer("", 2, "main_door_open2");
    PlaySoundAtEntity("", "13_press_done.snt", "valve_hiss2", 0, false);
    for(int i=5;i<=6;i++)SetWheelInteractionDisablesStuck("valve_single_"+i, false);
    for(int i=5;i<=6;i++)SetWheelStuckState("valve_single_"+i, 1, false);
    }
if(alState == -1)
    {
    AddTimer("", 2, "main_door_close");
    PlaySoundAtEntity("", "13_press_fail.snt", "valve_hiss2", 0, false);
    for(int i=5;i<=6;i++)SetWheelInteractionDisablesStuck("valve_single_"+i, false);
    for(int i=5;i<=6;i++)SetWheelStuckState("valve_single_"+i, -1, false);
    }
}
void main_door_open(string &in asTimer)
{
    PlaySoundAtEntity("", "door_mech_unlock_INSIDE.snt", "door_swing", 0, false);
    PlayPropAnimation("door01_closed_1", "opening", 0, false, "");
    AddTimer("", 2.2, "main_door_openB");
}
void main_door_open2(string &in asTimer)
{
    PlaySoundAtEntity("", "door_mech_unlock_OUTSIDE.snt", "door_swing", 0, false);
    PlayPropAnimation("door01_closed_1", "opening", 0, false, "");
    AddTimer("", 2.2, "main_door_openB");
}
void main_door_openB(string &in asTimer)
{
    PlayPropAnimation("door01_closed_1", "open", 0, false, "");
    SetEntityActive("door01_closed_1", false);
    SetEntityActive("door_1", true);
    PlayPropAnimation("door_1", "none", 0, true, "");
    StopPropMovement("door_1");
    SetEntityActive("block_box_all_6", false);
    PlaySoundAtEntity("", "door_hinge_open.snt", "door_swing", 0, false);
    AddTimer("door_open", 0.1, "door_open");    
    AddTimer("", 3, "main_door_openC");
}
void door_open(string &in asTimer)
{
    AddPropForce("door_1", 150, 0, 0, "world");
    AddTimer("door_open", 0.1, "door_open");
}
void main_door_openC(string &in asTimer)
{
    RemoveTimer("door_open");
    for(int i=5;i<=6;i++)SetWheelInteractionDisablesStuck("valve_single_"+i, true);
}
void main_door_close(string &in asTimer)
{
    PlaySoundAtEntity("", "door_hinge_close_INSIDE.snt", "door_swing", 0, false);
    AddTimer("door_close", 0.1, "door_close");    
    AddTimer("", 3, "main_door_closeB");
}
void door_close(string &in asTimer)
{
    AddPropForce("door_1", -300, 0, -300, "world");
    AddTimer("door_close", 0.1, "door_close");
}
void main_door_closeB(string &in asTimer)
{
    SetEntityActive("door01_closed_1", true);
    SetEntityActive("door_1", false);
    SetEntityActive("block_box_all_6", true);
    RemoveTimer("door_close");
    PlayPropAnimation("door01_closed_1", "closing", 0, false, "");
    PlaySoundAtEntity("", "door_mech_unlock_INSIDE.snt", "door_swing", 0, false);
    AddTimer("", 2.2, "main_door_closeC");
}
void main_door_closeC(string &in asTimer)
{
    PlayPropAnimation("door01_closed_1", "closed", 0, false, "");
    for(int i=5;i<=6;i++)SetWheelInteractionDisablesStuck("valve_single_"+i, true);
}

And last but not least, a video of the whole process. This shows you how after all my awkward attempts at recreating a simple AMFP script, it comes SO CLOSE to working perfectly. I just need to find a way to remove that animation from the second door that gets called into existence. As it is, it always loops the animation, no matter what I do. I can't remove it from the animations in the modeleditor, as it doesn't even show up as one in there. It's just a blank field. I can't tell the door to play 'none' animations, and I don't know why. It just really wants to move, it's like it drank too much damn coffee.

[Image: signature-2.png]
(This post was last modified: 08-02-2015, 04:22 PM by Streetboat.)
08-02-2015, 04:15 PM
Find


Messages In This Thread
PropAnimation won't stop playing - by Streetboat - 08-02-2015, 04:15 PM
RE: PropAnimation won't stop playing - by Daemian - 08-07-2015, 03:25 PM
RE: PropAnimation won't stop playing - by Traggey - 08-08-2015, 10:44 AM
RE: PropAnimation won't stop playing - by Mudbill - 08-08-2015, 12:42 PM
RE: PropAnimation won't stop playing - by Traggey - 08-08-2015, 04:43 PM
RE: PropAnimation won't stop playing - by Mudbill - 08-08-2015, 04:43 PM
RE: PropAnimation won't stop playing - by Traggey - 08-09-2015, 10:11 AM



Users browsing this thread: 1 Guest(s)