
Originally Posted by
Btcc22
Detecting hits is certainly doable, it's just something I haven't added yet because I'd likely end up having to redo it when I've settled on a solution for the other events I'd like to get working.
I'd be fine with having it called with the "ding" noise if nothing else.
So, are there going to be lua scripts shipping with the updated HAC2 that I'll be able to use for reference for the medals? And perhaps a library I can look at of the available functions?
Ideally, the idea I have is as follows:
When the "ding" noise plays, a .wav and an X-texture are called. The texture is based on whatever weapon the player is holding (wider bitmap for wider reticules). A pure white "X" texture that recolors based on whatever HUD color the player is using. On a killshot, the hit sound called could be a bit meatier to communicate a kill.
I'm not much of a coder/scripter.. but I can get around. the logic would be something like (whipped this up in like 5-10 minutes, it's sketchy as fuck):
Code:
global HitMarkerImage = "smallasshitmarker.png"
function hitmarkervisuals() -- this sets the texture called based on weapon held and changes the color
SleepUntil([|
weapon is switched or user's set hud color is updated
|]);
TextureColors = user's set HUD color
if (WeaponReadied = "Shotgun");
or (WeaponReadied = "Assault Rifle");
or (WeaponReadied = "Rocket Launcher");
or (WeaponReadied = "anything else with a big ass reticule") then
HitMarkerImage = bighitmarker.png;
elseif (WeaponReadied = Sniper Rifle)
or (WeaponReadied = Pistol)
or (WeaponReadied = blah blah small shit) then
HitMarkerImage = smallasshitmarker.png;
else
return;
end
end
function displayhitmarker() -- this displays the hitmarker in the center of the screen
SleepUntil([| ping sound is hit |])
DisplayTexture ("HitMarkerImage");
TextureCoordinates = middle of the fucking screen;
playhitmarkersound();
end
function playhitmarkersound() -- this plays the hitmarker sound based on damage or kill
if (enemydamaged) then
playsound HitSound.wav;
elseif (enemykilled) then
playsound KillSound.wav;
end
e:
Ideally there'd be a way to listen for headshots as well, could add headshot-specific hitsounds. not certain how feasable that would be.
Bookmarks