Weapon and Powerup float bobbing

Ask about ACS, DECORATE, ZScript, or any other scripting questions here!

Moderator: GZDoom Developers

Forum rules
Before asking on how to use a ZDoom feature, read the ZDoom wiki first. If you still don't understand how to use a feature, then ask here.

Weapon and Powerup float bobbing

Postby Adamast0r » Sun Mar 28, 2021 7:10 am

Hey guys.
First of all, let me just say that, unfortunately, I'm not savvy in respect to modding at all. However, I've been looking for any simple mod for Z-based ports that simply makes the weapons, power-ups and maybe keys float and bob up and down, while not altering their vanilla properties (no extra buffs or anything of the sort).
So I was hoping if anyone could help me out by explaining how one without much knowledge in this area can make that happen in DECORATE or something of the sort.
That's about the size of it. I'd really appreciate any help with this.
User avatar
Adamast0r
UAC Employee ID #1992
 
Joined: 22 May 2020
Location: Phobos
Discord: Adamast0r#1899
Operating System: Windows 10/8.1/8/201x 64-bit
OS Test Version: No (Using Stable Public Version)
Graphics Processor: Intel (Modern GZDoom)

Re: Weapon and Powerup float bobbing

Postby Jarewill » Sun Mar 28, 2021 7:31 am

If you want to use DECORATE, you will need to replace all actors and give them the +FLOATBOB flag. Also probably adjust their sprite offsets.
If you don't want to replace the weapons, you can just inherit from a WeaponGiver:
Spoiler:


If you plan on using ZScript, you can just use a event handler to automatically add the flag to all weapons, powerups and keys:
Spoiler:

This still needs offset adjustments to work though.
Jarewill
 
 
 
Joined: 21 Jul 2019

Re: Weapon and Powerup float bobbing

Postby Player701 » Sun Mar 28, 2021 7:44 am

In addition to the above, event handlers have to be registered via MAPINFO to work:

Code: Select allExpand view
gameinfo
{
    AddEventHandlers = "FloatBobHandler"
}
User avatar
Player701
 
 
 
Joined: 13 May 2009
Location: Russia
Discord: Player701#8214
Operating System: Windows 10/8.1/8/201x 64-bit
OS Test Version: No (Using Stable Public Version)
Graphics Processor: nVidia with Vulkan support

Re: Weapon and Powerup float bobbing

Postby Adamast0r » Sun Mar 28, 2021 8:02 am

Thanks for the speedy replies, guys.
So I create a pk3 with event handlers in a MAPINFO textfile and an additional ZScript textfile with the floatbob flag?
User avatar
Adamast0r
UAC Employee ID #1992
 
Joined: 22 May 2020
Location: Phobos
Discord: Adamast0r#1899
Operating System: Windows 10/8.1/8/201x 64-bit
OS Test Version: No (Using Stable Public Version)
Graphics Processor: Intel (Modern GZDoom)

Re: Weapon and Powerup float bobbing

Postby Adamast0r » Sun Mar 28, 2021 8:04 am

I was interested in doing it in DECORATE, so it could work with Zandro as well, for example.
I just don't know anything about adjusting sprite offsets, as the berserk pack on TNT's first map was clipping through the floor in a test I did.
User avatar
Adamast0r
UAC Employee ID #1992
 
Joined: 22 May 2020
Location: Phobos
Discord: Adamast0r#1899
Operating System: Windows 10/8.1/8/201x 64-bit
OS Test Version: No (Using Stable Public Version)
Graphics Processor: Intel (Modern GZDoom)

Re: Weapon and Powerup float bobbing

Postby Dan_The_Noob » Mon Mar 29, 2021 1:39 am

there's a setting to adjust sprite clipping in the display settings, i think?
User avatar
Dan_The_Noob
 
Joined: 07 May 2019
Twitch ID: Dan_The_Noob
Operating System: Windows 10/8.1/8/201x 64-bit
Graphics Processor: nVidia with Vulkan support

Re: Weapon and Powerup float bobbing

Postby Adamast0r » Mon Mar 29, 2021 2:53 am

Dan_The_Noob wrote:there's a setting to adjust sprite clipping in the display settings, i think?

I think I have to adjust the offset of the sprites to be higher than the bobbing action. Someone told me that, and that I would need Slade for it. I'm not sure how to go on about it, though.
User avatar
Adamast0r
UAC Employee ID #1992
 
Joined: 22 May 2020
Location: Phobos
Discord: Adamast0r#1899
Operating System: Windows 10/8.1/8/201x 64-bit
OS Test Version: No (Using Stable Public Version)
Graphics Processor: Intel (Modern GZDoom)

Re: Weapon and Powerup float bobbing

Postby Jarewill » Mon Mar 29, 2021 4:57 am

The easiest way to do this would be to copy the sprites from Doom to your mod and changing their offsets.
Offsets are shown in the bottom left corner of the graphic space:

You will just have to raise the second one a bit.

This method does mess up with mods that have custom weapon pickup sprites though.
Alternatively you can use SLADE's texture editor:
Spoiler:

This method is a bit more time consuming and it will still break if a custom sprite is bigger than the vanilla one.

If wonder if offsets can be edited automatically with ZScript....
Or maybe just setting the +NOGRAVITY flag and changing their Z-position?
Jarewill
 
 
 
Joined: 21 Jul 2019

Re: Weapon and Powerup float bobbing

Postby Adamast0r » Mon Mar 29, 2021 6:42 am

Jarewill wrote:The easiest way to do this would be to copy the sprites from Doom to your mod and changing their offsets.
Offsets are shown in the bottom left corner of the graphic space:

You will just have to raise the second one a bit.

This method does mess up with mods that have custom weapon pickup sprites though.
Alternatively you can use SLADE's texture editor:
Spoiler:

This method is a bit more time consuming and it will still break if a custom sprite is bigger than the vanilla one.

If wonder if offsets can be edited automatically with ZScript....
Or maybe just setting the +NOGRAVITY flag and changing their Z-position?

It worked. I only tried it for the powerups, but it's much better now. They already have both the +NOGRAVITY, as well as the +FLOATBOB flags.
Additionally, I don't know about the ZScript solution, but it might be even better.
I'd just like to figure out a way to make the keys rotate now. Anyway, thank you for all the help.
EDIT: One issue is that I can get this to work with brightmaps, but not with the default lights.pk3 that comes with GZDoom. How can I fix that?
User avatar
Adamast0r
UAC Employee ID #1992
 
Joined: 22 May 2020
Location: Phobos
Discord: Adamast0r#1899
Operating System: Windows 10/8.1/8/201x 64-bit
OS Test Version: No (Using Stable Public Version)
Graphics Processor: Intel (Modern GZDoom)

Re: Weapon and Powerup float bobbing

Postby Jarewill » Mon Mar 29, 2021 6:57 am

Since the actors have been replaced, you will also have to add a GLDEFS file containing definitions of new actors.
The definitions can be found in lights.pk3, for example the Soulsphere:
Code: Select allExpand view
object SoulSphere //Replace this name with your own soulsphere
{
    frame SOUL { light SOULSPHERE }
}


Also since you are replacing the keys too, you will have to provide LOCKDEFS as well.
The definitions can be found in the gzdoom.pk3 file, you will have to copy them and replace what key is needed with your custom one.
Jarewill
 
 
 
Joined: 21 Jul 2019

Re: Weapon and Powerup float bobbing

Postby Adamast0r » Mon Mar 29, 2021 7:37 am

Jarewill wrote:Since the actors have been replaced, you will also have to add a GLDEFS file containing definitions of new actors.
The definitions can be found in lights.pk3, for example the Soulsphere:
Code: Select allExpand view
object SoulSphere //Replace this name with your own soulsphere
{
    frame SOUL { light SOULSPHERE }


Also since you are replacing the keys too, you will have to provide LOCKDEFS as well.
The definitions can be found in the gzdoom.pk3 file, you will have to copy them and replace what key is needed with your custom one.

Awesome. Done and done. I'll leave the keys for later.
Just one final question: I'm making a custom powerup. A quad damage, basically. How can I add that extra, non-vanilla, sphere to the lights.pk3?
User avatar
Adamast0r
UAC Employee ID #1992
 
Joined: 22 May 2020
Location: Phobos
Discord: Adamast0r#1899
Operating System: Windows 10/8.1/8/201x 64-bit
OS Test Version: No (Using Stable Public Version)
Graphics Processor: Intel (Modern GZDoom)

Re: Weapon and Powerup float bobbing

Postby Jarewill » Mon Mar 29, 2021 8:02 am

Instead of adding to the lights.pk3, you should create a GLDEFS file in your own mod.
Then do it the same way as the other actors.
More information is in the GLDEFS wiki page linked above.
Jarewill
 
 
 
Joined: 21 Jul 2019

Re: Weapon and Powerup float bobbing

Postby Adamast0r » Mon Mar 29, 2021 8:49 am

Jarewill wrote:Instead of adding to the lights.pk3, you should create a GLDEFS file in your own mod.
Then do it the same way as the other actors.
More information is in the GLDEFS wiki page linked above.

I did it. Many thanks for showing me the ropes. I'll work on getting more acquainted with this stuff from now on.
User avatar
Adamast0r
UAC Employee ID #1992
 
Joined: 22 May 2020
Location: Phobos
Discord: Adamast0r#1899
Operating System: Windows 10/8.1/8/201x 64-bit
OS Test Version: No (Using Stable Public Version)
Graphics Processor: Intel (Modern GZDoom)

Re: Weapon and Powerup float bobbing

Postby Blue Shadow » Mon Mar 29, 2021 12:04 pm

Jarewill wrote:If wonder if offsets can be edited automatically with ZScript....

GZDoom 4.5.0 introduced A_SpriteOffset.
User avatar
Blue Shadow
 
Joined: 14 Nov 2010
Operating System: Windows 10/8.1/8/201x 64-bit
OS Test Version: No (Using Stable Public Version)
Graphics Processor: ATI/AMD (Modern GZDoom)

Re: Weapon and Powerup float bobbing

Postby Adamast0r » Mon Mar 29, 2021 1:02 pm

Blue Shadow wrote:
Jarewill wrote:If wonder if offsets can be edited automatically with ZScript....

GZDoom 4.5.0 introduced A_SpriteOffset.

I found a work-around. Think it's good.
I got it to work with the lights, but do you know how to make it work with this?
User avatar
Adamast0r
UAC Employee ID #1992
 
Joined: 22 May 2020
Location: Phobos
Discord: Adamast0r#1899
Operating System: Windows 10/8.1/8/201x 64-bit
OS Test Version: No (Using Stable Public Version)
Graphics Processor: Intel (Modern GZDoom)

Next

Return to Scripting

Who is online

Users browsing this forum: Shibainumaster and 0 guests