What it says on the tin. Is there anything I can put into the .lua, statuseffect or animator files to get it to play a sound when inflicted?
playImmediateSound Might be the answer. But you would need to look up the parameters here http://doc.playstarbound.com/
Hmm, doesn't seem to be working. Can anyone suggest me as to what's wrong? I'm pretty new to LUA. Here's my code, with the change in line 4: Code: function init() animator.setParticleEmitterOffsetRegion("drips", mcontroller.boundBox()) animator.setParticleEmitterActive("drips", true) mcontroller.playImmediateSound("sfx/objects/redalert.wav") effect.setParentDirectives("fade=00BBFF=0.4") script.setUpdateDelta(1) self.tickTime = 1.0 self.tickTimer = self.tickTime end function update(dt) mcontroller.controlModifiers({ movementSuppressed = true }) self.tickTimer = self.tickTimer - dt if self.tickTimer <= 0 then self.tickTimer = self.tickTime world.spawnProjectile("kinepticforceexplosion", mcontroller.position(), 0, {0, 0}, false, { timeToLive = 0 } ) end end function uninit() end From docs.starbound.com: Anyone know what I'm doing wrong?
According to the docs there are 3 parameters http://doc.playstarbound.com/classStar_1_1NetworkedAnimator.html#aa041f1c96a0b779552b0c618bf5cc7a9 String Vec2F Audio [ volume \ loop \ etc ]
so line 4 should be: mcontroller.playImmediateSound("sfx/objects/redalert.wav", Vec2F(), AudioParameters()) ?
I would guess you would need to fill in those values, not just call the functions. After all you are giving it a value, not requesting one. Vec2F tells where the sound originates from + direction AudioParamaters tells how loud the sound is and how far that sound travels. Though it should replace it default values if none are given. There is also a chance the function it self might not be fully working.
Thanks. Tried mcontroller.playImmediateSound("sfx/objects/redalert.wav", Vec2F(x0, y0), AudioParameters()) and got Error: Exception while invoking lua function 'init'. (LuaException) [string "/stats/effects/kinepticforceexplosion/kinepti..."]:5: attempt to call global 'Vec2F' (a nil value) Hmm, I don't think something's working. Oh well.
mcontroller.playImmediateSound("sfx/objects/redalert.wav", Vec2F(0, 0), AudioParameters()) I don't believe you need to declare x and y. After all - you are inputting floating numbers. Letters are not part of those. Anywho its odd @severedskullz hasn't popped in yet. I would give metadept a dm on twitter and ask about how to use it, and if its working.
If you're using particle effects in your status effect, you might not need to struggle with LUA. Or, maybe, I think you can use entity.playImmediateSound or entity.playSound.
Well that's bloody strange. I did not get an alert when this topic was created, nor when @xxswatelitexx ping'd me. Vect2F is the C++ variant for just a table with 2 numbers for the X and Y coordinates... so: { 0, 0 } Im new to the whole movement controller right now, but it seems to work the same for the entity version. Code: mcontroller.playImmediateSound("sfx/objects/redalert.wav", {0, 0}) -- Will play at position (0,0) relative to the entity If it works the same way as the entity varient, its relative to itself... if NOT then it will be absolute coordinates and you will have to use the entity's location in there instead.