![]() |
Throw an exploding object? - 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: Throw an exploding object? (/thread-14061.html) |
RE: Throw an exploding object? - Equil - 03-18-2012 What if you made a collide area the size of the entire map and had.. Code: void OnStart() { I have no idea if this would work. Haven't tested it, but I suppose it's something you could try. RE: Throw an exploding object? - Apjjm - 03-18-2012 (03-18-2012, 06:31 AM)Damascus Wrote: 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.One solution would be to provide an infinite supply of the explosive items (e.g fill a chest with 3 or 4 of them, and when one is destroyed spawn a new one with createEntityAtArea). When the puzzle is solved you can just disable the respawn. I Might make an attempt to come up with an example map showing my approach later today. Edit: Done, download link: http://dl.dropbox.com/u/64805489/explosions.zip Youtube video (Processing at time of post): http://youtu.be/THiQ-gF1qJ8 RE: Throw an exploding object? - Acies - 03-18-2012 (03-18-2012, 11:47 AM)Apjjm Wrote:Hoho. Molotov shocktails.(03-18-2012, 06:31 AM)Damascus Wrote: 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.One solution would be to provide an infinite supply of the explosive items (e.g fill a chest with 3 or 4 of them, and when one is destroyed spawn a new one with createEntityAtArea). When the puzzle is solved you can just disable the respawn. I Might make an attempt to come up with an example map showing my approach later today. Edit: Nice work. RE: Throw an exploding object? - Damascus - 03-18-2012 You sir are a gentleman and a scholar! This is exactly what I was going for! I don't quite understand how you got all the boxes to fly away from it, based on your earlier post, but I'm going to work hard to get this to work in my level! By the way, what sound and PS did you use? I can't find anything that comes close. RE: Throw an exploding object? - Apjjm - 03-18-2012 Firstly, i forgot to include the SDIV entities, so re-download the zip file if you downloaded the old one and all the stuff should be there now ![]() I created a custom particle effect called "explosion.ps" - based off one of the gaurdian effects initially. The sound is one of the break sound effects. An overview of how the system works is as follows: Firstly, I added two routines for handling math functions later, called "approx" and "sqrt", fairly self explanatory as to what these do, and these are taken from my math library. I then included my string list library (with a few functions stripped out & optimised for viewing without the collapsing editor regions). This library simply maintains a list data structure of strings without leaking variables - this lets me add and remove elements to and from a list which is very useful later on. Both these libraries are self contained and the full versions can be obtained in the wiki topic in the development forum. I've tried to build a self contained system for explosions, but note there are some limitations which i will come to later on. Firstly, here is a more detailed description of how the system works overview Spoiler below!
constants Spoiler below!
Initialising an explosion object Spoiler below!
How the system tracks objects to effect by explosion impulses Spoiler below!
How the system applies impulses to objects Spoiler below!
The code in the OnStart(), LeverCallback and OnGrenadeExplode() is the specific code used for this demo (allowing the lever to spawn a new grenade object if the old one has detonated). However, there are still some limitations:
When getting this to work in your level, you should be able to copy any paste everything but the OnStart and cbLeverPull code. RE: Throw an exploding object? - Damascus - 03-18-2012 THANK YOU SO MUCH! Any chance you can make one with the small_stone01.dae mesh and body? I'm trying to do it myself but it keeps showing up as just a regular bottle. I'll credit the hell out of you when I use it in my custom story! So for blowing open the door I basically want to copy and paste all this into my script (except the exceptions you mentioned) and give the door "item_" to begin it's name? And just to make sure it dies, I can also make a script area that instakills the door on impact. RE: Throw an exploding object? - Apjjm - 03-19-2012 Entity using the rock: http://dl.dropbox.com/u/64805489/grenade1_NEW.ent A note about "bodies" which I forgot to mention - you need to ensure the body cannot rotate (I do this with an insane damping value and angular speed limit) otherwise the explosion will push things in the wrong direction. With regards to your second question, yes that would work, but you can also give the explosion a damage value (see the parameter afDamage in the creation code). I believe doors do actually use health to track how broken by a monster they are so a script area might not be necessary. RE: Throw an exploding object? - Damascus - 03-19-2012 I searched for afDamage, is this the part of the script, you're talking about? Spoiler below!
I'm not sure exactly what in the code to edit, but I evidently need to deal 100 damage to destroy the door (and the boards blocking it). If I don't do this, though, the script area is working pretty nicely. It just also goes off when you carry the rock up to the door, too. EDIT: Also, not entirely sure why, but I had this issue in another thread, too. I put in the new grenade you provided and am still getting a bottle in-game. someone suggested I delete my map_cache, but I don't have any. RE: Throw an exploding object? - Apjjm - 03-19-2012 (03-19-2012, 01:09 AM)Damascus Wrote: I searched for afDamage, is this the part of the script, you're talking about?I was meaning the relevant parameter, e.g: Code: explosions_AddExplosiveItem("grenade1_1","grenade1_explosion.ent",2,10000,10); --- Are the grenade objects placed through the level editor or created inside the script? If it's inside the script make sure you are using the correct names (the new entity was called grenade01_NEW.ent so you might have accidentally missed a line or something), if it's the level editor (after re-starting it) verify that the changes appear in the level editor (if they don't, the fault isn't with the map cache). Also make sure you have "forceCacheLoadingAndSkipSaving" set to false in the main_settings.cfg in your saves folder. RE: Throw an exploding object? - Damascus - 03-19-2012 I'm placing it in the level editor. The change does appear in the editor, and shows up as a small rock. If I replace the original grenade .ent with the new one, it still appears as a bottle in game. If I instead choose to just target the new "grenade1_NEW.ent", then it doesn't show up in game at all. Still, both of them appear correctly when viewed through the level editor. |