Scripts / How to Spawn an Explosive Barrel

Author
Message
Centre Divided
16
Years of Service
User Offline
Joined: 12th Aug 2008
Location: United States
Posted: 1st Dec 2014 01:16
So I'm trying a work around on getting a landmine to "blow up". I have the land mine from the converted Modern Warfare model pack and I am using an explosive barrel from FPSCR. I'm trying to use a trigger zone to spawn the explosive barrel above the player so it falls and loses it's "1" health (I can't set it to "0" otherwise it's just invincible) and explodes and blows the player up. I was hoping I could use this workaround to prevent players from crossing areas I don't want them to (try getting through my mine fields :p) However, no matter what I've done, I cannot get the trigger zone to spawn the explosive barrel causing it to blow me up. Does anyone know how to get it to work? I just want the trigger zone to spawn the barrel so it falls and explodes and blows the player up.

Intel Core i5-4440k (3.1 GHz), Nvidia GeForce GTX 760
PM
tomjscott
User Banned
Posted: 1st Dec 2014 04:03
Well, first off, you can make anything explosive by just setting its isexplosive property in the entity's settings. Second, if it's set as explosive then when it's health reaches zero then it'll explode. You can force that to happen by the following:



All you're left with now is spawning the entity, which you should be able to do by just setting the entity's position to the player's position with something like this:



System Specs: OS - Windows 7 Home Premium 64-bit SP1, CPU - AMD Phenom II X4 945, 3.0Ghz, RAM - 8Gb DDR3, GFX Card - 2048MB NVIDIA GeForce GT 640, FPSC-R Version - Beta 1.0085
Centre Divided
16
Years of Service
User Offline
Joined: 12th Aug 2008
Location: United States
Posted: 2nd Dec 2014 06:11
Sweet, so where do I plug these scripts in?

Intel Core i5-4440k (3.1 GHz), Nvidia GeForce GTX 760
PM
tomjscott
User Banned
Posted: 2nd Dec 2014 17:06
Well, it's up to you how you put this all together. It can be done a number of ways depending on your needs. I don't really have time right now to outline a complete solution. I was hoping the code snippets would point you in the right direction.

System Specs: OS - Windows 7 Home Premium 64-bit SP1, CPU - AMD Phenom II X4 945, 3.0Ghz, RAM - 8Gb DDR3, GFX Card - 2048MB NVIDIA GeForce GT 640, FPSC-R Version - Beta 1.0085
Centre Divided
16
Years of Service
User Offline
Joined: 12th Aug 2008
Location: United States
Posted: 6th Dec 2014 06:51
I meant like do I put these Code Snippets into the entity script or into one of the main scripts?

Intel Core i5-4440k (3.1 GHz), Nvidia GeForce GTX 760
PM

Login to post a reply

Server time is: 2024-12-21 18:24:35
Your offset time is: 2024-12-21 18:24:35