Jump to content
Search In
  • More options...
Find results that contain...
Find results in...
rabidrage

ACS recoil

Recommended Posts

So this script is attached to the MP40 in the latest Brutal Doom:

script 278 (void) //Rifle Recoil
{
int angle;
angle = GetActorPitch(0);

SetActorPitch(0, (angle-0.002));
delay (6);
angle = GetActorPitch(0);
SetActorPitch(0, (angle+0.001));
}

I took the MP40 from an earlier version that did not feature any recoil. I'd love to know how to convert this to Decorate, since I can't just cut and paste the ACS folder from Brutal Doom. I know it must involve the A_SetPitch feature since that was used in a conversion of the Doom 64 weapons--but it seems like I can't use that to replicate the effect.

What's my move?

Share this post


Link to post
rabidrage said:

I'd love to know how to convert this to Decorate, since I can't just cut and paste the ACS folder from Brutal Doom. I know it must involve the A_SetPitch feature since that was used in a conversion of the Doom 64 weapons--but it seems like I can't use that to replicate the effect.

Does your DECORATE code look something like this? (in principle)

RIFL A 0 A_FireCustomBullets(somethingsomething)
RIFL B 0 A_SetPitch(pitch-2)
RIFL C 6
RIFL D 0 A_SetPitch(pitch+1)

Share this post


Link to post

Um...in principle, yes. I got the -2/+1 part right, but as for where to put them...well, it's tough to figure out where to attach them. The MP40 "fire" mode is below, with my failed modification and the line pointing to the formerly active ACS code both still intact (and right next to each other):

Fire:
TNT1 A 0
TNT1 A 0 A_JumpIfInventory("Zoomed",1,"Fire2")
TNT1 A 0 A_JumpIfInventory("MPAmmo",1,2)
Goto Reload
TNT1 AAAA 0
TNT1 A 0 A_PlaySound("MP40")
TNT1 A 0 A_Takeinventory("MPAmmo",1)
TNT1 A 0 A_FireCustomMissile("SmokeSpawner",0,0,0,5)
TNT1 A 0 A_FireCustomMissile("YellowFlareSpawn",-5,0,0,0)
MP40 B 1 BRIGHT A_AlertMonsters
MP40 C 1 A_FireBullets (5, 3, -1, 8, "HitPuff")
//TNT1 A 0 ACS_Execute(278, 0, 0, 0, 0)
TNT1 A 0 A_SetPitch (pitch-2)
TNT1 A 0 A_SetPitch (pitch+1)
TNT1 A 0 A_FireCustomMissile("ShakeYourAss", 0, 0, 0, 0)
MP40 D 1 A_FireCustomMissile("RifleCaseSpawn",-5,0,8,-4)
//MP40 E 1
TNT1 A 0 A_Refire
Goto Ready+6

Share this post


Link to post

That code is obviously wrong - you have no delay between calling the two instances of A_SetPitch.

Each line of DECORATE code is a frame. Each frame has a sprite name (like "MP40 C"), a duration (like "1"), and possibly an action (like "A_FireBullets (5, 3, -1, 8, "HitPuff")"). The action is performed as soon as the frame is entered. Then the code waits for a time specified by duration (durations are in game tics, 1 game tic = 1/35 of a second). Then the code follows by the next frame.

Hope you get it now. You need to modify the code so that there's a frame (or frames) with a total delay of "6" between the two calls of A_SetPitch.

Share this post


Link to post

Kind of. It seems like I would have to add frames, which slows the gun down tremendously. Unless there's still something I'm missing. Even then, I don't think the effect is the same as what the ACS script does. Maybe Decorate can't replicate it? I tried compiling the script into my WAD via GZDoom Builder, but it doesn't do anything.

Share this post


Link to post
rabidrage said:

It seems like I would have to add frames, which slows the gun down tremendously.

Wait, what?

Even then, I don't think the effect is the same as what the ACS script does.

What? Please, tell me how so.

Maybe Decorate can't replicate it?

What??? It must be able to.

I tried compiling the script into my WAD via GZDoom Builder, but it doesn't do anything.

Are you sure you ran the wad with the ACS script inside AND the correct DECORATE (the one actually calling the ACS)? Also if the ACS is in a global library (=not in a map), you need LOADACS lump to make it accessible from everywhere.

However, I recommend going the DECORATE way. I can't see why it shouldn't be possible.

Share this post


Link to post

I'm just having a really hard time with this. So if each line is a frame, how do I get that delay of 6 in there without adding a new frame with a 6 duration?

I was thinking that Decorate couldn't replicate the effect because it doesn't just go up and down in Brutal Doom, it kind of rattles the player around. Then I noticed the word "angle" in the ACS code and typed it into Decorate. It turned blue, so that means it has a function there too. Is it going to be important?

I honestly don't know where the ACS went once I opened the Script editor and clicked "compile". When I open the editor again it's still there, and it said it had compiled it successfully. I know I'm opening the same map and the right WAD and everything. I can't imagine what's going wrong.

Share this post


Link to post
rabidrage said:

I'm just having a really hard time with this. So if each line is a frame, how do I get that delay of 6 in there without adding a new frame with a 6 duration?

I see now. The MP40 fires faster than one shot per 6 tics, right? I'm not sure how to implement it, then. Maybe just try 1 tic, for a temporary solution - I mean, place the latter call of A_SetPitch() after the "MP40 D 1" frame.

I was thinking that Decorate couldn't replicate the effect because it doesn't just go up and down in Brutal Doom, it kind of rattles the player around. Then I noticed the word "angle" in the ACS code and typed it into Decorate. It turned blue, so that means it has a function there too. Is it going to be important?

No, no, no. In that ACS script, "angle" is just a normal variable declared within the script, it has nothing to do with player's angle or the DECORATE's "angle" property. It's there merely as an object where to save the value of "GetActorPitch(0)". It could have been called "x" instead of "angle", or "pitch", or "your_mum", and it would work the same way.

I'm pretty sure that the rattling you mentioned is actually caused by this line:
TNT1 A 0 A_FireCustomMissile("ShakeYourAss", 0, 0, 0, 0)

And because you haven't copied the definition of "ShakeYourAss" into your wad, nothing happens.

I honestly don't know where the ACS went once I opened the Script editor and clicked "compile". When I open the editor again it's still there, and it said it had compiled it successfully. I know I'm opening the same map and the right WAD and everything. I can't imagine what's going wrong.

Your script is probably alright and in the map, but maybe you've just used your DECORATE version where the script call was //commented out, haven't you? I don't know. Maybe you'd need the LOADACS and making the script global, if you wanted to call ACS scripts from DECORATE, just maybe. Nevermind.

Share this post


Link to post

I think you've nailed it with your comment about the "ShakeYourAss". I scoured Brutal Doom pretty good and haven't found it, but I'll look again more carefully. I'm assuming it has to be a custom actor, but the question is where the heck this guy hid the thing. In the meantime, I'll try moving the two setpitch calls around and see what happens.

Share this post


Link to post

Okay, so this problem is now solved. First off, it turns out that having the WAD open in two programs simultaneously can lead to problems when you think you've saved a script and it doesn't appear to work. :P

Second, I found the "shakeyourass" actor--it was hidden in the "Sparks" lump, of all places!

Share this post


Link to post

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×