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
How To Make An Object Fly Once I Trigger It?
MulleDK19 Offline
Senior Member

Posts: 545
Threads: 21
Joined: Jun 2009
Reputation: 10
#11
RE: How To Make An Object Fly Once I Trigger It?

Make it fly straight up:
AddPropImpulse("name_of_vase", 0.0f, 3.0f, 0.0f, "world");

[Image: 16455.png]
09-17-2010, 02:23 AM
Find
gosseyn Offline
Member

Posts: 63
Threads: 7
Joined: Sep 2010
Reputation: 1
#12
RE: How To Make An Object Fly Once I Trigger It?

i have problems making this to run well, this is what i do(i try to make a chair fly a bit in the air when player collide with a script area) :

i create the function that will make the chair fly :
void ChairFly()
{
AddPropImpulse("MyChair", 0.0f, 15.0f, 0.0f, "world");
}

and then inside OnStart i add this :
AddEntityCollideCallback("player", "AreaChairFly", "ChairFly", true, 1);

What is wrong? Thanks!
09-17-2010, 11:44 PM
Find
Alroc Offline
Junior Member

Posts: 24
Threads: 4
Joined: Sep 2010
Reputation: 0
#13
RE: How To Make An Object Fly Once I Trigger It?

Same issue the vase don't want to fly Sad
09-18-2010, 12:08 AM
Find
theDARKW0LF Offline
Member

Posts: 150
Threads: 17
Joined: Sep 2010
Reputation: 0
#14
RE: How To Make An Object Fly Once I Trigger It?

(09-17-2010, 11:44 PM)gosseyn Wrote: i have problems making this to run well, this is what i do(i try to make a chair fly a bit in the air when player collide with a script area) :

i create the function that will make the chair fly :
void ChairFly()
{
AddPropImpulse("MyChair", 0.0f, 15.0f, 0.0f, "world");
}

and then inside OnStart i add this :
AddEntityCollideCallback("player", "AreaChairFly", "ChairFly", true, 1);

What is wrong? Thanks!

Are you trying to give the item coordinates on where in the map to fly to? The easiest way I found it to work is to simply move the object in question to the area you want it to fly to and then write down how much force you need to get the object from its starting position to the position you want to get to by flying, then put those values into the script line to make it go there...

Here's what I have for a cross that falls off my shelf and scares my guy, decreasing his sanity:
void CollideCrossTrigger1(string &in asParent, string &in asChild, int alState)
{
    
    AddPropImpulse("crossboo_1", 0, 0, -2, "");
    
    GiveSanityDamage(5, true);
    
}
And of course, my AddEntityCollideCallBack is further up the page and is as follows:
AddEntityCollideCallback("Player", "CrossTrigger1", "CollideCrossTrigger1", true, 0);

I don't think you need to put in the "f"s after the numerical values you desire, I didn't and it works fine.

Check out my custom stories(1)(2)!
09-18-2010, 12:13 AM
Find
Alroc Offline
Junior Member

Posts: 24
Threads: 4
Joined: Sep 2010
Reputation: 0
#15
RE: How To Make An Object Fly Once I Trigger It?

For me it does not work at all. The debugMessage dont show up and the vase is not flying Sad

here is my script:

My prop is named "Vase_01" and my area is "AreaFly01"

OnStart{
AddEntityCollideCallback("Player", "AreaFly01", "CollideAreaFly01", true, 1);
}

void CollideAreaFly01(string &in asParent, string &in asChild, int alState)
{
AddDebugMessage("Test 1-2 1-2 Flying object and ... action", false);
AddPropImpulse("Vase_01", 100.0f, 3.0f, 100.0f, "world");
}

i put strong value in case de weight of the prop has an influence

Sorry for my english (i'm french Smile )
09-18-2010, 12:40 AM
Find
theDARKW0LF Offline
Member

Posts: 150
Threads: 17
Joined: Sep 2010
Reputation: 0
#16
RE: How To Make An Object Fly Once I Trigger It?

(09-18-2010, 12:40 AM)Alroc Wrote: For me it does not work at all. The debugMessage dont show up and the vase is not flying Sad

here is my script:

My prop is named "Vase_01" and my area is "AreaFly01"

OnStart{
AddEntityCollideCallback("Player", "AreaFly01", "CollideAreaFly01", true, 1);
}

void CollideAreaFly01(string &in asParent, string &in asChild, int alState)
{
AddDebugMessage("Test 1-2 1-2 Flying object and ... action", false);
AddPropImpulse("Vase_01", 100.0f, 3.0f, 100.0f, "world");
}

As far as I can see, your OnStart is not correctly labeled, it should look like:
void OnStart()
{
not
OnStart{

Also, this part below needs to be under void OnEnter() as shown in the second box below
void CollideAreaFly01(string &in asParent, string &in asChild, int alState)
{
AddDebugMessage("Test 1-2 1-2 Flying object and ... action", false);
AddPropImpulse("Vase_01", 100.0f, 3.0f, 100.0f, "world");
}
to
void OnEnter()
{
}

void CollideAreaFly01(string &in asParent, string &in asChild, int alState)
{
AddDebugMessage("Test 1-2 1-2 Flying object and ... action", false);
AddPropImpulse("Vase_01", 100.0f, 3.0f, 100.0f, "world");
}

Let me know if there's anything else that you need help with.

Check out my custom stories(1)(2)!
09-18-2010, 01:27 AM
Find
gosseyn Offline
Member

Posts: 63
Threads: 7
Joined: Sep 2010
Reputation: 1
#17
RE: How To Make An Object Fly Once I Trigger It?

it is working now for me, my problem was a stupid little thing, "player" must be "Player" with the "P" as uppercase.

edit : placing the self made functions before or after OnEnter or OnStart doesn't change anything as long as it is not inside

And i have another question connected with the subject of this topic : how can i just move an entity slowly, making it loop between positions. I looked for something like SetEntityPosition, but that doesn't exists (can't be that easy heh). The closest i found is SetMoveObjectState, but i don't know how to use it. Is the only solution to use prop animations? Thanks.
09-18-2010, 02:31 AM
Find
gosseyn Offline
Member

Posts: 63
Threads: 7
Joined: Sep 2010
Reputation: 1
#18
RE: How To Make An Object Fly Once I Trigger It?

Anyone please, to move objects slowly or even making them stand in the air?
09-18-2010, 08:42 AM
Find
jens Offline
Frictional Games

Posts: 4,093
Threads: 199
Joined: Apr 2006
Reputation: 202
#19
RE: How To Make An Object Fly Once I Trigger It?

You can use SetMoveObjectState, but you have to use it with an entity that is of a special type. For example, look at the security doors, or the gates in level 07 - old archives. These are that sort of entity and they can do what you are looking for.
09-18-2010, 10:37 AM
Website Find
Alroc Offline
Junior Member

Posts: 24
Threads: 4
Joined: Sep 2010
Reputation: 0
#20
RE: How To Make An Object Fly Once I Trigger It?

(09-18-2010, 01:27 AM)theDARKW0LF Wrote:
(09-18-2010, 12:40 AM)Alroc Wrote: For me it does not work at all. The debugMessage dont show up and the vase is not flying Sad

here is my script:

My prop is named "Vase_01" and my area is "AreaFly01"

OnStart{
AddEntityCollideCallback("Player", "AreaFly01", "CollideAreaFly01", true, 1);
}

void CollideAreaFly01(string &in asParent, string &in asChild, int alState)
{
AddDebugMessage("Test 1-2 1-2 Flying object and ... action", false);
AddPropImpulse("Vase_01", 100.0f, 3.0f, 100.0f, "world");
}

As far as I can see, your OnStart is not correctly labeled, it should look like:
void OnStart()
{
not
OnStart{

Also, this part below needs to be under void OnEnter() as shown in the second box below
void CollideAreaFly01(string &in asParent, string &in asChild, int alState)
{
AddDebugMessage("Test 1-2 1-2 Flying object and ... action", false);
AddPropImpulse("Vase_01", 100.0f, 3.0f, 100.0f, "world");
}
to
void OnEnter()
{
}

void CollideAreaFly01(string &in asParent, string &in asChild, int alState)
{
AddDebugMessage("Test 1-2 1-2 Flying object and ... action", false);
AddPropImpulse("Vase_01", 100.0f, 3.0f, 100.0f, "world");
}

Let me know if there's anything else that you need help with.

Ok my problem was so stupid I was editing the wrong .hps (one in an other folder ...)
09-18-2010, 11:09 AM
Find




Users browsing this thread: 1 Guest(s)