[Open Assets] Object Shadows

This content may be freely modified and/or maintained by anyone.
Status
Not open for further replies.

TehRealSalt

(σᴥσ)
Kart Krew™️
This relatively simplistic addon adds drop shadows for both players and objects.

You may use the console variables "playershadows" and "objectshadows" to toggle them, and "addshadow <object>" to add a shadow to an object type. By default, object shadows are off as they can eat performance depending on what objects are whitelisted by the server. Add shadows to objects placed in huge quantities, such as rings, at you (and your computer's) own risk.

Also included is a MD2 for it, made to be perfectly 1:1 with the actual sprite in terms of look and size. To use it, add "OSHD OSHD.md2 2.0 0.0" to your md2.dat.

Special thanks go out to RedEnchilada for helping me with the original version of the script, and MonsterIestyn for finding a method to retrieve the validity of MT_ constants without Lua throwing an error message.
 

Attachments

  • lua_playershadows.png
    lua_playershadows.png
    42.2 KB · Views: 2,399
  • lua_playershadows.gif
    lua_playershadows.gif
    1.1 MB · Views: 3,292
  • objectshadows.zip
    3.1 KB · Views: 2,408
  • Object Shadows & MD2.jpg
    Object Shadows & MD2.jpg
    102.3 KB · Views: 2,572
Last edited:
It's a pretty simple script, but it works. My only complaint is that it was a bit hard to actually see the shadow a lot of the time for me. It could also scale itself depending on the height difference from the character, maybe with a console variable? Finally, a console variable to disable them might also be nice in case people wanted to use the OpenGL sprite shadows, no point having 2 sets of shadows. Nothing I'm going to keep this back over though.
 
Yep, I posted a gif of this a week or so ago and got some of the same critique; I just have to get around to implementing them.
 
Everything looks good so far... I thought I would just point this out:

SlippyShow.png

EDIT: Hmm... The shadow doesn't seem to appear anywhere else when the player is holding on to something. Disregard this post.
 
Last edited:
It's pretty dumb but the script doesn't check if there is a player mobj on the map, resulting in a "crash" when the script attempts to launch on a spectator player.

I know I'm dumb at Lua, but adding this at the start of the Hook fixes the problem:

Code:
addHook("ThinkFrame", function()
	for player in players.iterate do
	[B]if not player.mo return end[/B]
 
I meant to update this sooner (as in, the "sooner than nearly a year" type of sooner) to fix that bug, but I wanted to add more features. I was going to add even more to it, but I kinda like how it is now. (BTW, just to note, the above fix only half-worked. It prevents the error, but the shadow won't appear once you stop spectating. I had to do something slightly different. Thanks for helping, though; it pointed me towards my current fix!)

Now the sprite is darker, it shrinks depending on how high above the ground you are, and it has a cvar for turning them on/off (playershadows <bool>).
 
Last edited:
What about if the shadows were actually shaped like the characters and objects that the shadows mimic? I'm pretty sure I saw something like that before. Probably a build of SRB2 CB. I'm not a big fan of the dark blob shadows.
 
Fixed the reverse gravity shadow error, and slight gfx offset adjustments.
 
Last edited:
New update.

  • Now supports objects other than players. Turned off by default, use "objectshadows on" to enable them. A very small pool of objects are supported by default, but you can add more with the "addshadow" command.
  • Refactored code. No one will notice but it's a lot nicer for me to work with.
  • Included an MD2 I made a while back. It's made to be look exactly like the sprite version, down to the dimensions of it.
  • Changed the name.
 
Status
Not open for further replies.

Who is viewing this thread (Total: 1, Members: 0, Guests: 1)

Back
Top