+forward

Archive of the old editing forum
Forum rules
Before asking on how to use a ZDoom feature, read the ZDoom wiki first. This forum is archived - please use this set of forums to ask new questions.
Locked
User avatar
Galaxy_Stranger
Posts: 1326
Joined: Sat Aug 16, 2003 11:42 pm
Location: Shropshire
Contact:

+forward

Post by Galaxy_Stranger »

A while back I experimented with using the +forward console command to impose player behavior. This was ok, but obviously not the best solution.

Is there an equivalent Decorate Actor property to the +forward console command?
User avatar
Matt
Posts: 9696
Joined: Sun Jan 04, 2004 5:37 pm
Preferred Pronouns: They/Them
Operating System Version (Optional): Debian Bullseye
Location: Gotham City SAR, Wyld-Lands of the Lotus People, Dominionist PetroConfederacy of Saudi Canadia
Contact:

Re: +forward

Post by Matt »

[wiki]A_SetAngle[/wiki]
[wiki]A_SetPitch[/wiki]
[wiki]A_ChangeVelocity[/wiki]
[wiki]A_ScaleVelocity[/wiki]
[wiki]A_Recoil[/wiki] (though A_ChangeVelocity is needed to do anything on the Z axis - but without the Z axis A_Recoil may be the closest direct equivalent to +forward/backward)
[wiki]A_CheckFloor[/wiki]
User avatar
Galaxy_Stranger
Posts: 1326
Joined: Sat Aug 16, 2003 11:42 pm
Location: Shropshire
Contact:

Re: +forward

Post by Galaxy_Stranger »

Thanks!

After playing with this for a bit, I'm using A_Recoil with a negative value - which does exactly what I want:

Code: Select all

        Spawn:
            POSS A 1 A_PlaySound ("fly", 1, 1.0, 1)
			   POSS A 1 A_Recoil(-4)
			   POSS A 1 A_ChangeVelocity (0, 0, 1, CVF_RELATIVE) 
            Loop
As you mentioned, it doesn't affect the Z-axis at all. I can turn left and right, but not up or down. Using A_ChangeVelocity simply shoves the player up or down, ignoring the mouse.

Can I invoke the +forward console command via decorate?
User avatar
XutaWoo
Posts: 4005
Joined: Sat Dec 30, 2006 4:25 pm
Location: beautiful hills of those who are friends
Contact:

Re: +forward

Post by XutaWoo »

No.
User avatar
Galaxy_Stranger
Posts: 1326
Joined: Sat Aug 16, 2003 11:42 pm
Location: Shropshire
Contact:

Re: +forward

Post by Galaxy_Stranger »

Finally figured it out with the help TheMisterCat on the Zandronum IRC. I'm not a math person...

This is my solution:

Code: Select all

//     Actor properties to limit player control:
Player.ForwardMove 0.00, 0.00
Player.SideMove 0.00, 0.00

Code: Select all

States
{
     POSS A 1 A_PlaySound ("jetengine", 1, 1.0, 1)                  //  Play engine/flight sound.
     POSS A 1 SetPlayerProperty(0, 1, 3)                            //  Set fly property.
     POSS A 1 A_Recoil(-4)                                          //  Set player movement.
     POSS A 1 A_ChangeVelocity(0, 0, -sin(pitch)*5, CVF_RELATIVE)   //  Affect the z-height based on pitch.
     LOOP
}
And VOYLAY! YOUR OWN JET TO PILOT!
User avatar
NeuralStunner
 
 
Posts: 12328
Joined: Tue Jul 21, 2009 12:04 pm
Preferred Pronouns: No Preference
Operating System Version (Optional): Windows 11
Graphics Processor: nVidia with Vulkan support
Location: capital N, capital S, no space
Contact:

Re: +forward

Post by NeuralStunner »

Now that you're using A_ChangeVelocity, you don't even need A_Recoil any more.
User avatar
Galaxy_Stranger
Posts: 1326
Joined: Sat Aug 16, 2003 11:42 pm
Location: Shropshire
Contact:

Re: +forward

Post by Galaxy_Stranger »

I tried that first and couldn't get it to move straight forward - it would always slide to the side.
User avatar
NeuralStunner
 
 
Posts: 12328
Joined: Tue Jul 21, 2009 12:04 pm
Preferred Pronouns: No Preference
Operating System Version (Optional): Windows 11
Graphics Processor: nVidia with Vulkan support
Location: capital N, capital S, no space
Contact:

Re: +forward

Post by NeuralStunner »

Works fine for me. (*Plug plug*)
User avatar
Galaxy_Stranger
Posts: 1326
Joined: Sat Aug 16, 2003 11:42 pm
Location: Shropshire
Contact:

Re: +forward

Post by Galaxy_Stranger »

You're absolutely right!

Code: Select all

A_ChangeVelocity (-Cos(Pitch) * -10, 0, -Sin(Pitch) * 10, 1)
Locked

Return to “Editing (Archive)”