Page 2 of 2

Re: Weapon and Powerup float bobbing

PostPosted: Mon Mar 29, 2021 1:57 pm
by Jarewill
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!

Re: Weapon and Powerup float bobbing

PostPosted: Mon Mar 29, 2021 3:00 pm
by Adamast0r
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.

Re: Weapon and Powerup float bobbing

PostPosted: Fri Apr 02, 2021 4:06 pm
by Adamast0r
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;
}
}

Re: Weapon and Powerup float bobbing

PostPosted: Fri Apr 02, 2021 4:42 pm
by Jarewill
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:

Re: Weapon and Powerup float bobbing

PostPosted: Fri Apr 02, 2021 4:54 pm
by Adamast0r
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.

Re: Weapon and Powerup float bobbing

PostPosted: Fri Apr 02, 2021 5:35 pm
by Molly Grimwater
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.

Re: Weapon and Powerup float bobbing

PostPosted: Sat Apr 03, 2021 3:19 am
by Adamast0r
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?

Re: Weapon and Powerup float bobbing

PostPosted: Sat Apr 03, 2021 3:47 am
by SanyaWaffles
A_SpriteOffset is an action function. It needs to be called in a state and frame, not in the Default block.

Re: Weapon and Powerup float bobbing

PostPosted: Sat Apr 03, 2021 3:48 am
by Molly Grimwater
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;

Re: Weapon and Powerup float bobbing

PostPosted: Sat Apr 03, 2021 3:55 am
by Adamast0r
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.