Frictional Games Forum (read-only)
Throwing entity at other entity - 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 - Development (https://www.frictionalgames.com/forum/forum-38.html)
+---- Forum: Development Support (https://www.frictionalgames.com/forum/forum-39.html)
+---- Thread: Throwing entity at other entity (/thread-19540.html)



Throwing entity at other entity - ElectricRed - 12-13-2012

Hi, hopefully this is a simple question.

I want to have the player break a pipe by throwing a rock or other heavy object at it. The player will throw the object at the pipe, and then a script will be triggered.

How would I go about doing this?

Thanks.


RE: Throwing entity at other entity - crisosphinx - 12-13-2012

Did you already search the forums for this answer?

If I recall, the throwing function is already built into the game. Are you, instead, asking about how to script?


RE: Throwing entity at other entity - Adny - 12-13-2012

Add entity collide callback for the rock + a small script area over the pipe (make sure its large enough so a portion of the rock can go inside it). Remember the callback syntax for collide callbacks is:

(string &in asParent, string &in asChild, int alState)

Hope that helped.


RE: Throwing entity at other entity - The chaser - 12-13-2012

So, make a ScriptArea that fits the pipe.

Now:

Code:
void OnStart()
{
AddEntityCollideCallback("Rock", "ScriptArea_pipe", "CRASH", true, 1);
}

void CRASH (string &in asParent, string &in asChild, int alState)
{
////Do the crash effect. It can be:
SetEntityActive("Broken_pipe", true);
SetEntityActive("Pipe", false);
///Feel free to add particle effects and others
}



RE: Throwing entity at other entity - ElectricRed - 12-13-2012

I assumed the collide function would trigger if the player just held the rock in the script area. Thanks!

Edit: Is it possible to make any object break the pipe, or do I have to specify which one(s)?


RE: Throwing entity at other entity - Rapture - 12-14-2012

You have to specify the selected "entities" that can break the pipe.

I know Damascus has a script already in his "The Great Work" that will determine whether the player has thrown the rock hard enough to damage the object.
Ask him and I'm sure he can help you.


RE: Throwing entity at other entity - ElectricRed - 12-15-2012

So I implemented the script, but it triggers even when the player walks up to the script area with the rock.
Quote:I know Damascus has a script already in his "The Great Work" that will
determine whether the player has thrown the rock hard enough to damage
the object.

Ask him and I'm sure he can help you.
I'm hesitant to take scripts from "The Great Work" but if that's my only option then I guess I'll ask him. I could have sworn the regular Amnesia had places like this where you have to throw an object to break something. How did those work?


RE: Throwing entity at other entity - crisosphinx - 12-15-2012

(12-15-2012, 04:21 PM)ElectricRed Wrote: So I implemented the script, but it triggers even when the player walks up to the script area with the rock.
Quote:I know Damascus has a script already in his "The Great Work" that will
determine whether the player has thrown the rock hard enough to damage
the object.

Ask him and I'm sure he can help you.
I'm hesitant to take scripts from "The Great Work" but if that's my only option then I guess I'll ask him. I could have sworn the regular Amnesia had places like this where you have to throw an object to break something. How did those work?
Just don't take my animations and models and you'll be ok.

Damascus is a kind fellow, he might be able to help you with the throwing and breaking.


RE: Throwing entity at other entity - ElectricRed - 12-15-2012

(12-15-2012, 04:24 PM)crisosphinx Wrote:
(12-15-2012, 04:21 PM)ElectricRed Wrote: So I implemented the script, but it triggers even when the player walks up to the script area with the rock.
Quote:I know Damascus has a script already in his "The Great Work" that will
determine whether the player has thrown the rock hard enough to damage
the object.

Ask him and I'm sure he can help you.
I'm hesitant to take scripts from "The Great Work" but if that's my only option then I guess I'll ask him. I could have sworn the regular Amnesia had places like this where you have to throw an object to break something. How did those work?
Just don't take my animations and models and you'll be ok.

Damascus is a kind fellow, he might be able to help you with the throwing and breaking.
Haha, I wouldn't dream of taking your models. Would this throwing script happen to be in the demo?


RE: Throwing entity at other entity - crisosphinx - 12-15-2012

(12-15-2012, 04:31 PM)ElectricRed Wrote:
(12-15-2012, 04:24 PM)crisosphinx Wrote:
(12-15-2012, 04:21 PM)ElectricRed Wrote: So I implemented the script, but it triggers even when the player walks up to the script area with the rock.
Quote:I know Damascus has a script already in his "The Great Work" that will
determine whether the player has thrown the rock hard enough to damage
the object.

Ask him and I'm sure he can help you.
I'm hesitant to take scripts from "The Great Work" but if that's my only option then I guess I'll ask him. I could have sworn the regular Amnesia had places like this where you have to throw an object to break something. How did those work?
Just don't take my animations and models and you'll be ok.

Damascus is a kind fellow, he might be able to help you with the throwing and breaking.
Haha, I wouldn't dream of taking your models. Would this throwing script happen to be in the demo?
Just message Damascus. I have no idea, I'm an artist not a coder. :I

Here's his user... thingy. Smile http://www.frictionalgames.com/forum/user-20368.html