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.

Re: Weapon and Powerup float bobbing

Postby Jarewill » Mon Mar 29, 2021 1:57 pm

Adamast0r wrote:I got it to work with the lights, but do you know how to make it work with this?

You mean brightmaps? You define them in GLDEFS like dynamic lights.
For example:
Code: Select allExpand view
brightmap sprite SHOTA0 { map SHOTABM } //Map SHOTABM to the SHOTA0 sprite  

And this is how a brightmap should look like:

White parts will be visible in the dark, while the black parts will not.

Since brightmaps are assigned to sprites and not actors, they should work fine without defining new ones. Unless sprites were renamed.

Blue Shadow wrote:GZDoom 4.5.0 introduced A_SpriteOffset.

Oh, interesting. This may come in useful later, thanks!
Jarewill
 
 
 
Joined: 21 Jul 2019

Re: Weapon and Powerup float bobbing

Postby Adamast0r » Mon Mar 29, 2021 3:00 pm

Jarewill wrote:
Adamast0r wrote:I got it to work with the lights, but do you know how to make it work with this?

You mean brightmaps? You define them in GLDEFS like dynamic lights.
For example:
Code: Select allExpand view
brightmap sprite SHOTA0 { map SHOTABM } //Map SHOTABM to the SHOTA0 sprite   

And this is how a brightmap should look like:

White parts will be visible in the dark, while the black parts will not.

Since brightmaps are assigned to sprites and not actors, they should work fine without defining new ones. Unless sprites were renamed.

Blue Shadow wrote:GZDoom 4.5.0 introduced A_SpriteOffset.

Oh, interesting. This may come in useful later, thanks!

Alas, it works.
Thanks a lot for the assistance.
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 » Fri Apr 02, 2021 4:06 pm

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

GZDoom 4.5.0 introduced A_SpriteOffset.

I'm trying to do it in Zscript now, and I got much of it to work except for the height problem.
I tried to include the A_SpriteOFFset there, but GZDoom gives off this fatal error:

"Unexpected integer constant
Expecting ';' or ','".

And This is what I have working, for now:

class InvulnerabilitySphere : PowerupGiver
{
Default
{
+COUNTITEM
+FLOATBOB
+NOGRAVITY
+RELATIVETOFLOOR
+ZDOOMTRANS
+INVENTORY.AUTOACTIVATE
+INVENTORY.ALWAYSPICKUP
+INVENTORY.BIGPOWERUP
Inventory.MaxAmount 0;
Powerup.Type "PowerInvulnerable";
Powerup.Color "InverseMap";
RenderStyle "SoulTrans";
Inventory.PickupMessage "$GOTINVUL";
}
States
{
Spawn:
PINV ABCD 6 Bright;
Loop;
}
}
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 » Fri Apr 02, 2021 4:42 pm

The only error with that code I'm getting is an error about InvulnerabilitySphere being already defined.
You have to name your class something else and inherit and/or replace the base InvulnerabilitySphere.

Also, in ZScript you don't even need to edit every class individually, because you can use an automated event handler:
Spoiler:
Jarewill
 
 
 
Joined: 21 Jul 2019

Re: Weapon and Powerup float bobbing

Postby Adamast0r » Fri Apr 02, 2021 4:54 pm

Jarewill wrote:The only error with that code I'm getting is an error about InvulnerabilitySphere being already defined.
You have to name your class something else and inherit and/or replace the base InvulnerabilitySphere.

Also, in ZScript you don't even need to edit every class individually, because you can use an automated event handler:
Spoiler:

The only issue I'm having is the powerups height. For example: the Megasphere, when it bobs down, touches the floor, remains there for a second, and only then does it bob back up.
I don't have any problems doing it for each actor, as I'm only doing it for the artifacts so, I only wnated to know how to change the height on Zscript.
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 Molly Grimwater » Fri Apr 02, 2021 5:35 pm

You need to use A_SpriteOffset like in the example above.
First value is X position and the second is Y, lower Y positions will raise the sprite up, which is what you want.
The posted event handler should work fine with the adjusted offsets.
Molly Grimwater
 

Re: Weapon and Powerup float bobbing

Postby Adamast0r » Sat Apr 03, 2021 3:19 am

Molly Grimwater wrote:You need to use A_SpriteOffset like in the example above.
First value is X position and the second is Y, lower Y positions will raise the sprite up, which is what you want.
The posted event handler should work fine with the adjusted offsets.

I have this:
Default
{
+COUNTITEM;
+FLOATBOB
+NOGRAVITY
+RELATIVETOFLOOR
+ZDOOMTRANS
+INVENTORY.AUTOACTIVATE;
+INVENTORY.ALWAYSPICKUP;
+INVENTORY.FANCYPICKUPSOUND;
Inventory.Amount 100;
Inventory.MaxAmount 200;
A_SpriteOffset (0,-16)
Inventory.PickupMessage "$GOTSUPER";
RenderStyle "SoulTrans";
Inventory.PickupSound "misc/p_pkup";
}
States
{
Spawn:
SOUL ABCDCB 6 Bright;
Loop;
}

And it gives off that fatal error of an "unexepected integer constant".
However, if I have exactly the same and remove A_SpriteOffset it works fine. Therefore, my issue is how can I change this functioning actor's height in it's Zscript file?
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 SanyaWaffles » Sat Apr 03, 2021 3:47 am

A_SpriteOffset is an action function. It needs to be called in a state and frame, not in the Default block.
User avatar
SanyaWaffles
Now I've awoken, and I'm taking back control.
 
Joined: 25 Apr 2013
Location: Eastern Ohio
Discord: SanyaWaffles#5095
Twitch ID: sanyawaffles
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 Molly Grimwater » Sat Apr 03, 2021 3:48 am

A_SpriteOffset is a function, not a property.
You have to put it in a state and not the default block:
Spawn:
TNT1 A 0; TNT1 A 0 A_SpriteOffset(0,-16);
SOUL ABCDCB 6 Bright;
Goto Spawn+2;
Molly Grimwater
 

Re: Weapon and Powerup float bobbing

Postby Adamast0r » Sat Apr 03, 2021 3:55 am

SanyaWaffles wrote:A_SpriteOffset is an action function. It needs to be called in a state and frame, not in the Default block.

I got it working as I wanted. Many, many thanks for all the help.
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)

Previous

Return to Scripting

Who is online

Users browsing this forum: No registered users and 0 guests