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
Throwing entity at other entity
ElectricRed Offline
Member

Posts: 106
Threads: 13
Joined: Jun 2012
Reputation: 5
#1
Throwing entity at other entity

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.

[Image: 9lkjf4.jpg]

12-13-2012, 10:45 PM
Find
crisosphinx Offline
Senior Member

Posts: 501
Threads: 5
Joined: Apr 2012
Reputation: 24
#2
RE: Throwing entity at other entity

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?

Animation and Rig questions -> crisosphinx@yahoo.com

3D Generalist. Notable work on FG Forums - The Great Work, Five Magics and Cowards Debt.
12-13-2012, 10:51 PM
Find
Adny Offline
Posting Freak

Posts: 1,766
Threads: 6
Joined: Mar 2012
Reputation: 173
#3
RE: Throwing entity at other entity

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.

I rate it 3 memes.
12-13-2012, 11:02 PM
Find
The chaser Offline
Posting Freak

Posts: 2,486
Threads: 76
Joined: Jun 2012
Reputation: 113
#4
RE: Throwing entity at other entity

So, make a ScriptArea that fits the pipe.

Now:

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
}

THE OTHERWORLD (WIP)
[Image: k6vbdhu]

Aculy iz dolan.
(This post was last modified: 12-13-2012, 11:04 PM by The chaser.)
12-13-2012, 11:03 PM
Find
ElectricRed Offline
Member

Posts: 106
Threads: 13
Joined: Jun 2012
Reputation: 5
#5
RE: Throwing entity at other entity

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)?

[Image: 9lkjf4.jpg]

(This post was last modified: 12-13-2012, 11:15 PM by ElectricRed.)
12-13-2012, 11:14 PM
Find
Rapture Offline
Posting Freak

Posts: 1,078
Threads: 79
Joined: May 2011
Reputation: 30
#6
RE: Throwing entity at other entity

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.
12-14-2012, 03:38 AM
Find
ElectricRed Offline
Member

Posts: 106
Threads: 13
Joined: Jun 2012
Reputation: 5
#7
RE: Throwing entity at other entity

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?

[Image: 9lkjf4.jpg]

12-15-2012, 04:21 PM
Find
crisosphinx Offline
Senior Member

Posts: 501
Threads: 5
Joined: Apr 2012
Reputation: 24
#8
RE: Throwing entity at other entity

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

Animation and Rig questions -> crisosphinx@yahoo.com

3D Generalist. Notable work on FG Forums - The Great Work, Five Magics and Cowards Debt.
12-15-2012, 04:24 PM
Find
ElectricRed Offline
Member

Posts: 106
Threads: 13
Joined: Jun 2012
Reputation: 5
#9
RE: Throwing entity at other entity

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

[Image: 9lkjf4.jpg]

12-15-2012, 04:31 PM
Find
crisosphinx Offline
Senior Member

Posts: 501
Threads: 5
Joined: Apr 2012
Reputation: 24
#10
RE: Throwing entity at other entity

(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

Animation and Rig questions -> crisosphinx@yahoo.com

3D Generalist. Notable work on FG Forums - The Great Work, Five Magics and Cowards Debt.
12-15-2012, 04:47 PM
Find




Users browsing this thread: 2 Guest(s)