Frictional Games Forum (read-only)

Full Version: SetMoveObjectState
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
hello,

i am trying to understand how this function works. I looked at control_room_piston_piston.ent because it is a MoveObject type, but i am having a hard time to understand how it works exactly. I managed to create an entity of the same type, and i am able to move it, but only 1 time, it seems like SetMoveObjectState doesn't respond to my loop. So i think i am missing some information about all this : how the function works, and the MoveObject object type works? What is the scale of the movement, what is the start point? And of course, why is it not responding to my loop? (i added debug message so i know my loop works).
Thank you.
MoveObjects are mysterious, hardly do we understand them ourselves. They could indeed use some documentation Smile

There movement is basically that they move in the direction specified (in the entity if I recall correctly) and they move the amount of their own length in that direction. So if you set the value 1 then that means a sliding door would move the same length as it's height (like the section doors in some levels). If you set it to 0.5 it moves half the length.

Why it does not work in your loop is difficult to say without seeing the script.
here is my loop
Code:
AddEntityCollideCallback("Player", "AreaTest", "TestMe", false, 1);

Code:
void TestMe(string &in asParent, string &in asChild, int alState)
{
    AddTimer("", 2.0f, "RunMe");
    AddDebugMessage("OBJECT WILL MOVE IN 2 SECONDS ", false);
}

Code:
void RunMe(string &in asTimer)
{
    AddDebugMessage("OBJECT MOVING ", false);
    SetMoveObjectState("box", 0.25f);
    AddTimer("", 5.0f, "RunMe");
}

As i said, the debug message "OBJECT MOVING" is looping, but not the SetMoveObjectState.
But the reason this only works the first time is because you have opened it to 0.25f then you keep repeating that and nothing happens as it already is at that position.

Try SetMoveObjectState("box", RandFloat(0.25f, 0.75f)); and it should move to random positions.
ok, i understand now, afState is a position and not a value we add. Thank you very much!