Author Topic: Halo-Shielded Health Playertype  (Read 4390 times)

Quote from: Blockland Glass Description
Ever since Badspot removed the recharge delay function for the player's energy bar, the old 'Halo Shielded' player type by Mr. Wallet was broken. So I recently decided that I would recreate this, but using the player's health bar since it's much more versatile than the energy bar.

So now this add-on will make your health function similar to the player's shield in the Halo games. Mjolnir armor not included.

This add-on also has sounds taken from Halo 3 that's used for when your health is low or in danger, as you get hurt/shot at, and when your health recharges back to it's maximum capacity.

There are also particles that attempt to recreate the visual look of a Spartan's shields recharging

Anyway, this doesn't come with any fancy GUIs or anything, so I definitely recommend you also use one of the few health bar mods on here, like Visolator's: https://blocklandglass.com/addons/addon.php?id=752

Downloads:
Blockland Glass - Google Drive

Changelog:
5/22/21 - 1.1: Fixed any images mounted to the player being un-mounted after your shield health would recharge by using a janky workaround involving mounting a bot to the player and mounting the shield charge particles to that instead
6/19/21 - 1.2: Fixed a possible case of vehicle mounting breaking due to an un-parented script
Removed vehicle mount click sound when shields start recharging (if there was one)

Screenshots:
« Last Edit: June 19, 2021, 10:13:59 PM by Masterlegodude »



New update dropped, this one is a janky workaround for Torque's limit on images mounted directly to the player

When mounting fake bots to players I prefer to use setDamageLevel(999); instead of kill();. Seems to mitigate some collision issues that can snag projectiles and get the player stuck in some stupid desync crouch mode.

Also, aren't all the alx commands clientside? Might not work in multiplayer

Also, aren't all the alx commands clientside? Might not work in multiplayer
It's mostly used for GUI stuff, so there probably will be issues with players who don't have the mod on their end, so if it ends up being too much of a problem, i'll just make a separate version that uses 3D sounds instead

When mounting fake bots to players I prefer to use setDamageLevel(999); instead of kill();. Seems to mitigate some collision issues that can snag projectiles and get the player stuck in some stupid desync crouch mode.
Isn't that technically the same thing? Like, doesn't doing one or the other both put the player/bot into a dead/disabled state?

It's mostly used for GUI stuff, so there probably will be issues with players who don't have the mod on their end, so if it ends up being too much of a problem, i'll just make a separate version that uses 3D sounds instead
I tested it out with multiclients and it seems like some sounds are only playing for the host like the low health warning beep

Isn't that technically the same thing? Like, doesn't doing one or the other both put the player/bot into a dead/disabled state?
Dunno guess not, when I was using kill() I had repeatable bugs with collision that stopped with setDamageLevel()

I tested it out with multiclients and it seems like some sounds are only playing for the host like the low health warning beep
Not sure what you mean by "multiclients", was this done on one system and from the same Blockland installation? Or with separate installations? And did those other clients also have the add-on?

I was hoping at the very least that if other players had the add-on then they would be able to hear the sounds, and not just the host, but if it's just the host regardless, then that is a bit of an issue...

Yeah I ran two instances of the game and joined my own LAN server and muted one and tested it. On the host instance I shot at the other client and I heard their low health beeping sound.

Notice alxPlay doesn't take any arguments pertaining to which player/client it's playing the sound to. How would the game know who should be hearing the sound? This is usually a good indicator that the function is client-side.

The sound being client-side was intentional, because that's how it works in the Halo games, but i was assuming that the command being client-side would mean that all clients (provided they had the add-on) would be able to hear certain sounds only on their end, because hearing multiple instances of the shield warning sounds in 3D space would get annoying

So is there some way to accomplish having a 2D sound play on all clients without it being host only?

i was assuming that the command being client-side would mean that all clients (provided they had the add-on) would be able to hear certain sounds only on their end

In order to do something like that you could consider making a client.cs file that would contain client-side functions. Then you could make a function like clientCmdActivateShieldNoise() which contains all the alxPlay stuff, and then use commandToClient(%client, 'activateSheildNoise') server-side to call it.

To play sounds to a client from the server you can use %client.play2D(sound); and %client.play3D(sound, position); and only that client will hear it. Unfortunately this probably isn't going to work for you because I think you need looping sound. %player.playAudio can do that but everyone else will hear it. Maybe make an audio description with a very small range so you'd have to be very close to another player to hear it?
« Last Edit: May 24, 2021, 03:54:50 PM by Crook »

Is there a way to stop sounds used created by %client.play2d? The sounds stack (which is both a good and bad thing in this case), so i can't, say, play a silent audio clip with the same command to stop the looping shield sounds

I can use alxStopAll, but that's both not quite what i need, and probably also host only

Not that I know of... In the past, I've experimented with head + tailed sounds by using precise schedules, maybe you could try playing a non-looping sound and setting a schedule the exact length of the sound to see if it needs to be played again. Might not play nice with lag though

as ive suggested in bcc, can create and scope to a specific client a brick in the farlands way under plate and play serverwide music on it only they can hear

Would it be possible to skip the brick entirely and just make the audio emitter