As the title implies, I'd like to add extra pin-pulling and throwing sounds to the vanilla grenades, but I don't know how to go about this.
I imagine you'd need to use lua or AEmitters, but I'm not sure. Any suggestions would be much appreciated.
Thu Feb 06, 2014 2:28 am
clunatic
Joined: Fri Nov 23, 2012 5:42 am Posts: 143
Re: Grenade Pin-Pull and Throw sounds
You need both!
First 2 AEmitters that look something like this (if you want to copy this code, make sure to replace the spaces before each line with tabs):
Code:
AddEffect = AEmitter PresetName = Pin AEmitter Mass = 0 PinStrength = 4000 LifeTime = 5 HitsMOs = 0 GetsHitByMOs = 0 SpriteFile = ContentFile FilePath = Base.rte/Null.bmp FrameCount = 1 SpriteOffset = Vector X = 0 Y = 0 AtomGroup = AtomGroup AutoGenerate = 1 Material = Material CopyOf = Military Stuff Resolution = 2 Depth = 5 DeepGroup = AtomGroup AutoGenerate = 1 Material = Material CopyOf = Military Stuff Resolution = 3 Depth = 5 DeepCheck = 0 JointStrength = 10000 JointStiffness = 1 DrawAfterParent = 1 BurstSound = Sound CopyOf = Pin Sound //link this to the sound you want to play BurstTriggered = 1 EmissionEnabled = 1 Flash = None FlashOnlyOnBurst = 0
Then attach this lua code to the grenade (and make sure the grenade has GetsHitByMOs = 1, otherwise it won't work):
Parentfinding method was written by Bad Boy, I just corrected a couple of mistakes.
Code:
function Create(self) self.Parent = nil; self.ParentPlayer = nil; self.Module = "YourModuleNameHere.rte" --change this to your module name end
function Update(self) --If it's not being held by an actor, set its parent and parent player to nil if self.ID == self.RootID then self.Parent = nil; self.ParentPlayer = nil; --If it is being held, give it a parent and find the parent's player else if self.Parent == nil and self.ParentPlayer == nil then self.Parent = ToActor(MovableMan:GetMOFromID(self.RootID)); self.ParentPlayer = self.Parent:GetController().Player; end end --if Parent's primary action (left mouse) is pressed then spawn pin sound if self.Parent:GetController():IsState(Controller.PRESS_PRIMARY) then local PinSound = CreateAEmitter("YourAEmitterNameHere",self.Module); --Change this to your pin sound AEmitter PinSound.Pos = self.Pos; MovableMan:AddParticle(PinSound); end --if Parent's primary action (left mouse) is release then spawn throw sound if self.Parent:GetController():IsState(Controller.RELEASE_PRIMARY) then local ThrowSound = CreateAEmitter("YourAEmitterNameHere",self.Module); --Change this to your throw sound AEmitter ThrowSound.Pos = self.Pos; MovableMan:AddParticle(ThrowSound); end end
If done correctly that should make the pin pull sound play when you press down the left mouse button (or controller button) and then the throw sound plays when you release the left mouse button (or controller button).
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot post attachments in this forum