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
Throw an exploding object?
Damascus Offline
Senior Member

Posts: 646
Threads: 118
Joined: Mar 2012
Reputation: 29
#1
Throw an exploding object?

Is it possible to make something explode (a damaging explosion) when it is thrown and hits something with enough force?

If not, is it possible to instead make it explode when it is thrown into a specific Script Area (as opposed to carried into)?

(This post was last modified: 03-19-2012, 02:55 AM by Damascus.)
03-17-2012, 08:56 PM
Find
SilentStriker Offline
Posting Freak

Posts: 950
Threads: 26
Joined: Jul 2011
Reputation: 43
#2
RE: Throw an exploding object?

(03-17-2012, 08:56 PM)Damascus Wrote: Is it possible to make something explode (a damaging explosion) when it is thrown and hits something with enough force?

If not, is it possible to instead make it explode when it is thrown into a specific Script Area (as opposed to carried into)?
There is no things that explode put you can always script it Smile for example take a rock and throw it at some boxes, use SetPropHealth so they break and some particles and some prop force and sound then you're done Smile



03-17-2012, 09:21 PM
Find
ClayPigeon Offline
Member

Posts: 214
Threads: 13
Joined: Mar 2012
Reputation: 8
#3
RE: Throw an exploding object?

You can play with areas and sounds:

void OnStart()
{
AddEntityCollideCallback("SCRIPT_AREA", "ITEM_TO_EXPLODE", "function_explode", true, 1);
}

void function_explode(string &in asChild, string &in asParent, int alState)
{
PlaySoundAtEntity("", "explosion_rock_large.snt", "Player", 0, false);
SetPropHealth("ITEM_TO_EXPLODE", 0.0f);
StartScreenShake(1.0f, 2.0f, 1.0f, 2.0f);
}
(This post was last modified: 03-17-2012, 09:23 PM by ClayPigeon.)
03-17-2012, 09:22 PM
Find
Damascus Offline
Senior Member

Posts: 646
Threads: 118
Joined: Mar 2012
Reputation: 29
#4
RE: Throw an exploding object?

(03-17-2012, 09:22 PM)ClayPigeon Wrote: You can play with areas and sounds:

void OnStart()
{
AddEntityCollideCallback("SCRIPT_AREA", "ITEM_TO_EXPLODE", "function_explode", true, 1);
}
void function_explode(string &in asChild, string &in asParent, int alState)
{
PlaySoundAtEntity("", "explosion_rock_large.snt", "Player", 0, false);
SetPropHealth("ITEM_TO_EXPLODE", 0.0f);
StartScreenShake(1.0f, 2.0f, 1.0f, 2.0f);
}
With this script though it would also destroy the item if you just carry it into the script area, which I would like to avoid. I also suppose there's no way to create an explosion no matter what you throw the object against? Creating particle systems and sounds depend largely on stationary script areas, but if you guys know of any way I can make the explosion happen anywhere, I'd love the advice.

03-17-2012, 09:36 PM
Find
ClayPigeon Offline
Member

Posts: 214
Threads: 13
Joined: Mar 2012
Reputation: 8
#5
RE: Throw an exploding object?

(03-17-2012, 09:36 PM)Damascus Wrote:
(03-17-2012, 09:22 PM)ClayPigeon Wrote: You can play with areas and sounds:

void OnStart()
{
AddEntityCollideCallback("SCRIPT_AREA", "ITEM_TO_EXPLODE", "function_explode", true, 1);
}
void function_explode(string &in asChild, string &in asParent, int alState)
{
PlaySoundAtEntity("", "explosion_rock_large.snt", "Player", 0, false);
SetPropHealth("ITEM_TO_EXPLODE", 0.0f);
StartScreenShake(1.0f, 2.0f, 1.0f, 2.0f);
}
With this script though it would also destroy the item if you just carry it into the script area, which I would like to avoid. I also suppose there's no way to create an explosion no matter what you throw the object against? Creating particle systems and sounds depend largely on stationary script areas, but if you guys know of any way I can make the explosion happen anywhere, I'd love the advice.
I thought the idea is that the object that is carried will be exploded after entering an area, so I assumed it needs to be destroyed after exploding...

Anyway I am clueless about the explosion effect itself... I am weak with particle systems.
03-17-2012, 09:39 PM
Find
Damascus Offline
Senior Member

Posts: 646
Threads: 118
Joined: Mar 2012
Reputation: 29
#6
RE: Throw an exploding object?

Basically the effect I'm trying to achieve is a grenade like effect. you throw the object, and when it hits something, it explodes. You are supposed to throw it against a blocked door to destroy it.

03-17-2012, 10:05 PM
Find
Stepper321 Offline
Senior Member

Posts: 263
Threads: 26
Joined: Nov 2011
Reputation: 8
#7
RE: Throw an exploding object?

I don't know if theres get speed function, example when its over 1.9 (2 is the throwing speed and 1.5 is the running speed.)

Signature to awesome to be displayed.
03-17-2012, 11:13 PM
Find
SilentStriker Offline
Posting Freak

Posts: 950
Threads: 26
Joined: Jul 2011
Reputation: 43
#8
RE: Throw an exploding object?

(03-17-2012, 10:05 PM)Damascus Wrote: Basically the effect I'm trying to achieve is a grenade like effect. you throw the object, and when it hits something, it explodes. You are supposed to throw it against a blocked door to destroy it.
I don't think it's possible to be able to throw the object anywhere and make it explode like a grenade, it must more or less be inside a script area


03-17-2012, 11:14 PM
Find
Apjjm Offline
Is easy to say

Posts: 496
Threads: 18
Joined: Apr 2011
Reputation: 52
#9
RE: Throw an exploding object?

You may be able to configure the entity properties so that it takes damage from impacts (see bottles for how this is done). You can either try issuing a callback on "breaking" the object to create the explosion (see SetEntityCallbackFunc).

As for determining what objects are nearby when the object breaks: You can always create an entity based of block_box with a large spherical mesh for a body and set this mesh entity to be the target entity after the grenade object breaks. Every object that then collides with this mesh can then be effected by the explosion somehow (if you want to be really fancy and apply impulses you may want to consider setting up an octtree to determine relative positions of entities and then applying an impulse along the vector and diminishing the intensity by an inverse square). Particle effects can be defined in the entity settings in the model editor for onbreak too.
(This post was last modified: 03-18-2012, 12:53 AM by Apjjm.)
03-18-2012, 12:51 AM
Find
Damascus Offline
Senior Member

Posts: 646
Threads: 118
Joined: Mar 2012
Reputation: 29
#10
RE: Throw an exploding object?

I studied the section you were talking about, and saw that there are options for creating particle effects, sounds, and thrown objects when something hits hard enough. I probably won't be able to deal damage with it, but can probably achieve the explosion effect.

However, after thinking hard about it, I think it might make the game far too frustrating if the player throws it against the wrong object and loses the item, no longer able to advance in the game. But then, if I make it only explode when thrown against the right object, I risk making it look unrealistic. What to do... what to do...

03-18-2012, 06:31 AM
Find




Users browsing this thread: 1 Guest(s)