Frictional Games Forum (read-only)
How To Make An Object Fly Once I Trigger It? - 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 (https://www.frictionalgames.com/forum/forum-35.html)
+--- Thread: How To Make An Object Fly Once I Trigger It? (/thread-4404.html)

Pages: 1 2


RE: How To Make An Object Fly Once I Trigger It? - MulleDK19 - 09-17-2010

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



RE: How To Make An Object Fly Once I Trigger It? - gosseyn - 09-17-2010

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 :
Code:
void ChairFly()
{
AddPropImpulse("MyChair", 0.0f, 15.0f, 0.0f, "world");
}

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

What is wrong? Thanks!


RE: How To Make An Object Fly Once I Trigger It? - Alroc - 09-18-2010

Same issue the vase don't want to fly Sad


RE: How To Make An Object Fly Once I Trigger It? - theDARKW0LF - 09-18-2010

(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 :
Code:
void ChairFly()
{
AddPropImpulse("MyChair", 0.0f, 15.0f, 0.0f, "world");
}

and then inside OnStart i add this :
Code:
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:
Code:
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:
Code:
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.


RE: How To Make An Object Fly Once I Trigger It? - Alroc - 09-18-2010

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"

Code:
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 )


RE: How To Make An Object Fly Once I Trigger It? - theDARKW0LF - 09-18-2010

(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"

Code:
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:
Code:
void OnStart()
{
not
Code:
OnStart{

Also, this part below needs to be under void OnEnter() as shown in the second box below
Code:
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
Code:
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.


RE: How To Make An Object Fly Once I Trigger It? - gosseyn - 09-18-2010

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.


RE: How To Make An Object Fly Once I Trigger It? - gosseyn - 09-18-2010

Anyone please, to move objects slowly or even making them stand in the air?


RE: How To Make An Object Fly Once I Trigger It? - jens - 09-18-2010

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.


RE: How To Make An Object Fly Once I Trigger It? - Alroc - 09-18-2010

(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"

Code:
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:
Code:
void OnStart()
{
not
Code:
OnStart{

Also, this part below needs to be under void OnEnter() as shown in the second box below
Code:
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
Code:
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 ...)