Scripts / Barrel Launch

Author
Message
bluemeenie195
5
Years of Service
User Offline
Joined: 28th Oct 2018
Location:
Posted: 14th Feb 2021 15:12
Hi guys,
Here's a simple script to hopefully help with your gameplay action.




local launch = 0
local delay = 3000


function shoot_barrel_test_init(e)

end

function shoot_barrel_test_main(e)

if g_Entity[e]['health'] < 500 and launch == 0 then
ActivateIfUsed(e)
if GetTimer(e) >= delay then
launch = 1
PlaySound(e,0)

end

else
StartTimer(e)
end

if launch == 1 then
CollisionOff(e)
StartParticleEmitter(e)
MoveUp(e,500)
RotateX(e,600)
RotateZ(e,400)
RotateY(e,300)

if x == x then
MoveForward(e,1000)
end

if GetPlayerDistance(e) > 3000 then
SetEntityHealth(e,0)
Destroy(e)
CollisionOn(e)
StopSound(e,0)
StopParticleEmitter(e)


end
end
end

Attachments

Login to view attachments
PM
GubbyBlips
5
Years of Service
User Offline
Joined: 14th Jan 2019
Location:
Posted: 14th Feb 2021 17:38
Hey careful there!
Nice job. Creative idea.
That will spark a tender warm fire amongst the barrel people.
PM
bluemeenie195
5
Years of Service
User Offline
Joined: 28th Oct 2018
Location:
Posted: 14th Feb 2021 18:14
LOL, thanks GubbyBlips.

The only thing I couldn't figure out with my limited lua knowledge is to instead of blowing it up, Turn the collision back on and have it drop to the ground.

I think that would give it more realism where certain barrels explode but most just go up a few feet and fall back down.
PM
GubbyBlips
5
Years of Service
User Offline
Joined: 14th Jan 2019
Location:
Posted: 14th Feb 2021 21:21
Yeah, I modified the script a little to differentiate the entities separate activation. Also, I wasn't getting random rotations, so I had to add that in-- and placed a little twist before falling. Set health as desired and now you have 2 kinds to play with.

PM
bluemeenie195
5
Years of Service
User Offline
Joined: 28th Oct 2018
Location:
Posted: 14th Feb 2021 22:56
Perfect ! !

Thank you GubbyBlips ! That's exactly what I was looking for.

Your rock'n the scripts lately.
PM
Solar
7
Years of Service
User Offline
Joined: 11th Apr 2017
Location: South Africa
Posted: 20th Feb 2021 20:00
Okay, this ROCKS!!!
PM
3com
9
Years of Service
User Offline
Joined: 18th May 2014
Location: Catalonia
Posted: 20th Feb 2021 20:14
Nice one guys.
There may have some explodable barrels with debris somewhere, in GG.
Laptop: Lenovo - Intel(R) Celeron(R) CPU 1005M @ 1.90GHz

OS: Windows 10 (64) - Ram: 4 gb - Hd: 283 gb - Video card: Intel(R) HD Graphics
cpu mark: 10396.6
2d graphics mark: 947.9
3d graphics mark: 8310.9
memory mark 2584.8
Disk mark: 1146.3
Passmark rating: 3662.4

PM
bluemeenie195
5
Years of Service
User Offline
Joined: 28th Oct 2018
Location:
Posted: 1st Mar 2021 02:06
I've been fooling with the script and got some cool landing hit sounds.

It's not perfect and needs the right length audio sound for it to work right, but not to bad.

PlaySound(e,0) for hit sound, PlaySound(e,1) for landing sound.






PM
AmenMoses
GameGuru Master
8
Years of Service
User Offline
Joined: 20th Feb 2016
Location: Portsmouth, England
Posted: 1st Mar 2021 17:02
You should use proper physics for this!
Been there, done that, got all the T-Shirts!
PM
bluemeenie195
5
Years of Service
User Offline
Joined: 28th Oct 2018
Location:
Posted: 1st Mar 2021 17:55
I'm actually surprised I even got it to work as good as it does. LOL

I was hoping you or smallg would look at the script and maybe expand on it the correct way.
PM
AmenMoses
GameGuru Master
8
Years of Service
User Offline
Joined: 20th Feb 2016
Location: Portsmouth, England
Posted: 1st Mar 2021 18:15
I'm doing exactly that right now.
Been there, done that, got all the T-Shirts!
PM
bluemeenie195
5
Years of Service
User Offline
Joined: 28th Oct 2018
Location:
Posted: 1st Mar 2021 18:21
Yes !!
PM
AmenMoses
GameGuru Master
8
Years of Service
User Offline
Joined: 20th Feb 2016
Location: Portsmouth, England
Posted: 1st Mar 2021 18:45


Didn't have sounds so added a prompt where they would get played.

'Clang' where they hit another object (sound 0 ), 'Dong' where they hit the ground (sound 1 ).
Been there, done that, got all the T-Shirts!

Attachments

Login to view attachments
PM
bluemeenie195
5
Years of Service
User Offline
Joined: 28th Oct 2018
Location:
Posted: 1st Mar 2021 18:57
Love it !!
For some reason the PlaySoundIfSilent(e,0) don't work when you shoot it. The landing sound works perfectly.
PM
AmenMoses
GameGuru Master
8
Years of Service
User Offline
Joined: 20th Feb 2016
Location: Portsmouth, England
Posted: 1st Mar 2021 19:02
Ahh, I misunderstood. I have the sound 0 playing when the barrel hits some other object!
Been there, done that, got all the T-Shirts!
PM
bluemeenie195
5
Years of Service
User Offline
Joined: 28th Oct 2018
Location:
Posted: 1st Mar 2021 19:08
That's a cool idea too.
That would be great if you could work all three sounds in.
PM
AmenMoses
GameGuru Master
8
Years of Service
User Offline
Joined: 20th Feb 2016
Location: Portsmouth, England
Posted: 1st Mar 2021 19:10
Just add the play command for the hit at the point where the state is set to 'delay'.
Been there, done that, got all the T-Shirts!
PM
bluemeenie195
5
Years of Service
User Offline
Joined: 28th Oct 2018
Location:
Posted: 1st Mar 2021 19:16
Yep, Works perfect.
Thank you so much. This will make a lot of people happy.
PM
Honkeyboy
3D Media Maker
8
Years of Service
User Offline
Joined: 16th Sep 2015
Location: Doesnt know half the time ;)
Posted: 1st Mar 2021 19:17
stick that lot onto the ai _soldier script rofl
Intel i5 4950 Quad core 3.3ghz AMD FX 6300 x6 cores 3.5ghz(unclocked)
8gb Ram 8gb Ram
XFX R5 2gb AMD Radeon HD 6670 2gb
and a well fed mouse on a wheel

I only smile because i have absolutely no idea whats going on
bluemeenie195
5
Years of Service
User Offline
Joined: 28th Oct 2018
Location:
Posted: 1st Mar 2021 20:08
Then we would have some real action. LoL !
PM
smallg
Community Leader
18
Years of Service
User Offline
Joined: 8th Dec 2005
Location:
Posted: 2nd Mar 2021 10:48 Edited at: 2nd Mar 2021 10:54
made it so they fly away from the player so it's more realistic to the impact point
it's way more fun when they explode and cause a chain reaction
lua guide for GG
https://steamcommunity.com/sharedfiles/filedetails/?id=398177770
windows 10
i5 @4ghz, 8gb ram, AMD R9 200 series , directx 11

Attachments

Login to view attachments
bluemeenie195
5
Years of Service
User Offline
Joined: 28th Oct 2018
Location:
Posted: 2nd Mar 2021 11:33
That's awesome smallg !

definitely adding that to the collection.
PM
Honkeyboy
3D Media Maker
8
Years of Service
User Offline
Joined: 16th Sep 2015
Location: Doesnt know half the time ;)
Posted: 2nd Mar 2021 12:26 Edited at: 2nd Mar 2021 13:27
Ok i tried to add this to one of my imp scripts with the idea that basically he would do the same as the first script = fly away and blow up
this is the script to animate the imp

what happens is either the Imp doesn't animate and does fly away or will animate and wont fly away lol is this because of the imp using animations or just that i haven't got it right?


this is the combined script that animates just doesnt fly away etc




lol no worries had an end in the wrong place



and finally swapped out the Destroy (e) for an exit and......



lol heres the script you just need to change the animation frame to suit your character
Intel i5 4950 Quad core 3.3ghz AMD FX 6300 x6 cores 3.5ghz(unclocked)
8gb Ram 8gb Ram
XFX R5 2gb AMD Radeon HD 6670 2gb
and a well fed mouse on a wheel

I only smile because i have absolutely no idea whats going on

Attachments

Login to view attachments
smallg
Community Leader
18
Years of Service
User Offline
Joined: 8th Dec 2005
Location:
Posted: 2nd Mar 2021 13:49
lol, you want to change the launch variable to an array so you can have more than one but it's a neat idea, would make a good collectible item for a game like Doom
lua guide for GG
https://steamcommunity.com/sharedfiles/filedetails/?id=398177770
windows 10
i5 @4ghz, 8gb ram, AMD R9 200 series , directx 11
Honkeyboy
3D Media Maker
8
Years of Service
User Offline
Joined: 16th Sep 2015
Location: Doesnt know half the time ;)
Posted: 2nd Mar 2021 14:18
I've been adding it to my little game Asgood m8 and falling about laughing while trying to test it and making silly sounds to go with it, not laughed so much in ages
Intel i5 4950 Quad core 3.3ghz AMD FX 6300 x6 cores 3.5ghz(unclocked)
8gb Ram 8gb Ram
XFX R5 2gb AMD Radeon HD 6670 2gb
and a well fed mouse on a wheel

I only smile because i have absolutely no idea whats going on
AmenMoses
GameGuru Master
8
Years of Service
User Offline
Joined: 20th Feb 2016
Location: Portsmouth, England
Posted: 2nd Mar 2021 18:57 Edited at: 2nd Mar 2021 18:57
Another version.

This shows how much cleaner the script looks when using the vectlib.
Been there, done that, got all the T-Shirts!

Attachments

Login to view attachments
PM

Login to post a reply

Server time is: 2024-04-19 21:07:39
Your offset time is: 2024-04-19 21:07:39