Facebook Twitter YouTube Frictional Games | Forum | Newsletter | Dev Blog | Dev Wiki | Support | Shelf | Store

Privacy Policy


Post Reply 
 
Thread Rating:
  • 0 Votes - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
SetMoveObjectState
Author Message
gosseyn Offline
Member

Posts: 63
Joined: Sep 2010
Reputation: 1
Post: #1
SetMoveObjectState
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.
09-23-2010 12:48 PM
Find all posts by this user Quote this message in a reply
jens Offline
Frictional Games

Posts: 3,107
Joined: Apr 2006
Reputation: 103
Post: #2
RE: SetMoveObjectState
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.
09-23-2010 12:58 PM
Visit this user's website Find all posts by this user Quote this message in a reply
gosseyn Offline
Member

Posts: 63
Joined: Sep 2010
Reputation: 1
Post: #3
RE: SetMoveObjectState
here is my loop
AddEntityCollideCallback("Player", "AreaTest", "TestMe", false, 1);

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

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.
09-23-2010 01:28 PM
Find all posts by this user Quote this message in a reply
jens Offline
Frictional Games

Posts: 3,107
Joined: Apr 2006
Reputation: 103
Post: #4
RE: 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.
(This post was last modified: 09-23-2010 01:45 PM by jens.)
09-23-2010 01:45 PM
Visit this user's website Find all posts by this user Quote this message in a reply
gosseyn Offline
Member

Posts: 63
Joined: Sep 2010
Reputation: 1
Post: #5
RE: SetMoveObjectState
ok, i understand now, afState is a position and not a value we add. Thank you very much!
09-23-2010 01:52 PM
Find all posts by this user Quote this message in a reply
Post Reply 




User(s) browsing this thread: 1 Guest(s)