Product Chat / Make stuff fall out of the air and explode

Author
Message
mguy1122
Game Guru Backer
12
Years of Service
User Offline
Joined: 5th Mar 2013
Playing: witcher 3
Posted: 22nd Jul 2015 01:40
What I'm trying to do is when you walk under a bridge a car will fall off the other side and explode on impact. I placed the car in the air and set its strength to one and made it explodable but when I test it out it doesn't explode. Does anybody know how I can get it to blow up?
PM
synchromesh
Forum Support
11
Years of Service
Recently Online
Joined: 24th Jan 2014
Location:
Posted: 22nd Jul 2015 02:43
That may take a little scripting ....
Explodable objects do not blow up on impact at this time
The only person ever to get all his work done by "Friday" was Robinson Crusoe..
PM
perelect
10
Years of Service
User Offline
Joined: 27th Mar 2015
Location: Australia
Posted: 22nd Jul 2015 07:49 Edited at: 22nd Jul 2015 14:30
Hey, mguy1122

This script might help.

Place an entity at the impact point and give it this script. Set this entity to dynamic, explodeable and give it a low strength value.
Note: Make sure there is no other entities within the range as they will trigger the event as well.

EDITED:

I may be old, but at least my memory still ....hmmm

DT:Intel(R) Core(TM) i7-4790 CPU @ 3.60GHz (8 CPUs), ~3.6GHz, Windows 8.1 64-bit, 16 GB Ram, NVIDIA GeForce GTX 750 Ti, Display Memory: 4018 MB. Resolution 1360x768, Passmark 3528, AutoCAD, 3DsMax, Paint.Net, Solidworks.
Tarkus1971
Audio Media Maker
10
Years of Service
User Offline
Joined: 24th Feb 2015
Location: England, UK
Posted: 22nd Jul 2015 10:06
very cool script, and very useful. thank you.
Aftershock Quad Core AMD FM2+ 3.5 GHz 8GB Motherboard and Processor, A7700k apu, AMD HD7870 gfx card.
King Korg Synth, Alesis SR18 Drum Machine, Akai MPX8 sample player, Roland Fantom XA Synth, Axus Digital AXK2 Digital Drum Kit.
smallg
Community Leader
19
Years of Service
User Offline
Joined: 8th Dec 2005
Location:
Posted: 22nd Jul 2015 10:25
You don't need to define a,b,v and e (quite surprised it's not causing issues actually)
Also you have defined distx etc twice - you don't need the first ones.

This will also only work for the first 5 models placed in the editor and you will need to adjust the for loop if you have more objects (I'm sure you know this but you didn't mention it)
Specifically the line
For a =1,5 do

Not being picky, just trying to reduce the possible issues that may arise
life\'s one big game

windows vista ultimate

i5 @3.3ghz, 4gb ram, geforce gtx460, directx 11
Bored of the Rings
GameGuru Master
20
Years of Service
User Offline
Joined: 25th Feb 2005
Location: Middle Earth
Posted: 22nd Jul 2015 13:11 Edited at: 22nd Jul 2015 13:18
For a clean script I would remove any unused local variables. Thanks for the script by the way I'll give it a try when I finish work.
Professional Programmer: Languages- SAS, C++, SQL, PL-SQL, JavaScript, HTML, Darkbasic Pro, Purebasic, others
Hardware: Dell Precision 490; AMD Radeon HD 7570; LG TFT monitor (widescreen).
perelect
10
Years of Service
User Offline
Joined: 27th Mar 2015
Location: Australia
Posted: 22nd Jul 2015 13:41 Edited at: 22nd Jul 2015 17:31
Quote: "Not being picky, just trying to reduce the possible issues that may arise "


Thanks smallg,
That's not being picky at all.
I always appreciate the help and advice you give me. It helps me learn..
I copied and pasted the function/s from another scripts I done.
I didn't pick up on the double declare.. cheers

Ill make the changes you suggested and repost it. Can you check it out for me as well, please..

Thankyou..

Edit.. Bored of the Rings I updated the original script to take out the double declares, cheers..
I may be old, but at least my memory still ....hmmm

DT:Intel(R) Core(TM) i7-4790 CPU @ 3.60GHz (8 CPUs), ~3.6GHz, Windows 8.1 64-bit, 16 GB Ram, NVIDIA GeForce GTX 750 Ti, Display Memory: 4018 MB. Resolution 1360x768, Passmark 3528, AutoCAD, 3DsMax, Paint.Net, Solidworks.
mguy1122
Game Guru Backer
12
Years of Service
User Offline
Joined: 5th Mar 2013
Playing: witcher 3
Posted: 22nd Jul 2015 16:34
Thanks for the script perelect! I am having a problem getting it to work though but I see people above got it working so I must be missing something. I set it to dynamic, made it Explodable and gave it a low strength value but still no explosion. Here's a picture of the settings with the test car if you or anybody could tell me what I'm doing wrong, thanks

Attachments

Login to view attachments
PM
smallg
Community Leader
19
Years of Service
User Offline
Joined: 8th Dec 2005
Location:
Posted: 22nd Jul 2015 18:41
i think the problem is that this script kinda simulates something falling onto the car rather than the car falling to the ground
what you would need to do is set an invisible object at the ground where the car will land and give that the script and make it explodeable etc (and leave the car as dynamic & explodable but without the script - so it will fall)

p.s. you dont need to set both entities to 0 hp, any 1 explosion will automatically make other nearby objects that are explodeable explode


Or set a script that determines when the car reaches the ground height and make it explode

if g_Entity[e]['y'] < 610 then
SetEntityHealth(e,0)
end
life\'s one big game

windows vista ultimate

i5 @3.3ghz, 4gb ram, geforce gtx460, directx 11
mguy1122
Game Guru Backer
12
Years of Service
User Offline
Joined: 5th Mar 2013
Playing: witcher 3
Posted: 22nd Jul 2015 19:44
Thanks smallg! That made it work
PM
perelect
10
Years of Service
User Offline
Joined: 27th Mar 2015
Location: Australia
Posted: 22nd Jul 2015 22:04 Edited at: 23rd Jul 2015 00:23
Its good to see that you worked it out. Thanks smallg.. My original post was rushed while waiting for a taxi to arrive.
You need to place an entity (like a rock, landmine, etc) on the ground where the car lands and put the entityinarea.lua in this entity.
Once the car falls onto this entity, that is on the ground, it works.
_________________________________________________________________________________________________________________________________

Here is another script that will be more useful.

This one..
Detects the distance between entities and the events are only triggered by a selected entity name that comes within range.
So you can now have other entities within the DetectionRange of the impact point.(this is much more useful)

So place the..
default_name.lua script in the entity/s that you want to trigger the event/s, (ie: the car) and name the entity/s "BlowMeUp" in its properties window.(without quotes) and set this entity to dynamic and explodeable.
Note: Place the name BlowMeUp in the triggerzones, If Used section and set the car's SpawnatStart to NO, if you are spawning the above entity/s from a triggerzone action.

Place the..
nameinarea.lua script in the entity at the impact point and set this entity to dynamic and explodeable.
In the attached picture the nameinarea.lua script is in the landmine and the truck and the box are within the DetectionRange. (just for reference)




In action in a testmap


Enjoy.
I may be old, but at least my memory still ....hmmm

DT:Intel(R) Core(TM) i7-4790 CPU @ 3.60GHz (8 CPUs), ~3.6GHz, Windows 8.1 64-bit, 16 GB Ram, NVIDIA GeForce GTX 750 Ti, Display Memory: 4018 MB. Resolution 1360x768, Passmark 3528, AutoCAD, 3DsMax, Paint.Net, Solidworks.

Attachments

Login to view attachments
mguy1122
Game Guru Backer
12
Years of Service
User Offline
Joined: 5th Mar 2013
Playing: witcher 3
Posted: 22nd Jul 2015 22:45
Thanks perelect for taking your time to make this, it's what I needed. I found with the first script since other objects made it explode is quite useful for making random explosions. I put down the exploding box attached to a trigger zone and put a bunch of rubble around it so when you walk by they would all blow up and scatter which was actually another effect I was going for so it works out quite nice.
PM
Pirate Myke
Forum Support
14
Years of Service
User Offline
Joined: 31st May 2010
Location: El Dorado, California
Posted: 25th Jul 2015 03:50
Thanks guys this will be useful indeed.
Intel(R) Core(TM)2 Quad CPU Q6600 @ 2.40GHz, 2400 Mhz, 4 Core(s), 4 Logical Processor(s), 8gb RAM, Nvidia gtx660, Windows 7 Pro 64bit

Login to post a reply

Server time is: 2025-04-21 22:55:08
Your offset time is: 2025-04-21 22:55:08