hi all , i am working on a different project than my W.I.P and i have the script of perelect were you switch on the custom hud which i modified by adding a third sound which plays power on when you select the hud.
but the sound1 and sound2 slots volume gets lower the further you go away from the object with the script on, but the the sound0 slot's volume stays the same.
--[[
mech_hud.lua - Version 1.00 scripted by perelect. 30.10.2017.
--]]
mask = 0
local mh_pressed = 0
local mh_active = 0
local mh_key = 0
local mh_1_image = 0
local mh_1_sprite = 0
function mech_hud_init(e)
-- you can edited the number values below here, to suit your needs --
mh_key = 35 -- H key, This key turns the hud On and Off, this is the scancode value.
mh_active = 0 -- Hud startup state, if 0 then the hud is Off at startup, if 1 then the hud is On at startup
-- no need to edit any values below here --
mech_hud_loadimages(e)
end
function mech_hud_loadimages(e)
-- load images and create a sprite
mh_1_image = LoadImage ("scriptbank\\huds\\alien\\Full_helmet_HUD.png") -- change the image name here to use a different image, ie: meckHUD.png
mh_1_sprite = CreateSprite (mh_1_image)
SetSpriteDepth ( mh_1_sprite , 50 )
SetSpritePosition ( mh_1_sprite , 200 , 200 )
SetSpriteSize ( mh_1_sprite , 100.5 , 100.5 )
end
function mech_hud_main(e)
if g_PlayerThirdPerson == 0 then
-- Monitor the On / Off key
if g_Scancode ~= mh_key then
mh_pressed = 0
end
if g_Scancode == mh_key and mh_pressed == 0 and mh_active == 0 then
mh_pressed = 1
mh_active = 1
PlaySound(e,1)
end
if g_Scancode == mh_key and mh_pressed == 0 and mh_active == 1 then
mh_pressed = 1
mh_active = 0
PlaySound(e,0)
end
-- The hud is On
if mh_active == 1 then
PasteSpritePosition ( mh_1_sprite , 0 , 0 )
mask = 1
counter = counter + 1
if counter >= 80 then
counter = 80
end
if counter == 80 and playonce == 0 then
PlaySound (e,2)
playonce = 1
end
HideHuds() -- Hide the GameGuru default hud, if the helmet is On
else
SetSpritePosition ( mh_1_sprite , 200 , 200 )
ShowHuds() -- Show the GameGuru default hud, if the helmet is Off
mask = 0
if mask == 0 then
playonce = 0
counter = 0
end
end
end
end
Have anyone maybe experience something similar with the sound going softer if you move away from your entity which have the script on.
hoping AmenMoses will read this. lol , i know he will tel me straight that i am doing something wrong.
Thanks
Pcs
Windows 7 Professional 64-bit
Intel(R) Pentium(R) CPU G3260 @ 3.30GHz (2 CPUs), ~3.3GHz RAM 16GB NVIDIA GeForce GT 730
DirectX Version: DirectX 11
The author of this post has marked a post as an answer.
Go to answer