How to implement proper model based weapon tracers?

Ask about ACS, DECORATE, ZScript, or any other scripting questions here!
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.

Please bear in mind that the people helping you do not automatically know how much you know. You may be asked to upload your project file to look at. Don't be afraid to ask questions about what things mean, but also please be patient with the people trying to help you. (And helpers, please be patient with the person you're trying to help!)
User avatar
Enjay
 
 
Posts: 27303
Joined: Tue Jul 15, 2003 4:58 pm
Location: Scotland
Contact:

Re: How to implement proper model based weapon tracers?

Post by Enjay »

I can't check it in game right now but I can have a quick look inside the files.

Your DECORATE says:

Code: Select all

#include "actors/weapons/mk18.txt"
#include "actors/player.txt"
But, as far as I can see, the "556Tracer" actor is in "actors/projectiles.txt". Your DECORATE lump doen't #include this file so none of the actors in it will load. That would certainly explain the error message that you posted earlier. (It's exactly what I said - the actor hasn't loaded, so MODELDEF is referencing an actor that GZDoom doesn't know about.)

Try adding

Code: Select all

#include "actors/projectiles.txt"
to your DECORATE lump and see what happens.

[edit]
Doh! A second issue, the MODELDEF says "Model Tracer556" and the projectiles.txt file says "Actor 556Tracer: FastProjectile".
i.e one has Tracer556 and the other 556Tracer. Different names. The MODELDEF needs to use the name that is in the actor definition. This would also give the error that you posted.
[/edit]

[edit2]
And another issue, there's a missing " after tha path in MODELDEF.

Try the following in place of your lumps:

DECORATE

Code: Select all

#include "actors/weapons/mk18.txt"
#include "actors/player.txt"
#include "actors/projectiles.txt"
MODELDEF

Code: Select all

Model 556Tracer
{
Path "models/Projectiles"
Model 0 "tracer.md3"
Skin 0 "tracer4.png"
Scale 20.0 20.0 1.0

FrameIndex TRAC A 0 0
}
I have to say, the actual values all look a bit weird to me but I think that should get things working at least.
[/edit2]

[edit3]
OK, I had a quick chance to see it in game. I don't know exactly what you are looking for, but my guess is, it's not set up the way that you want right now. If I type "summon 556Tracer" at the console, I see a very brief flash or red and then is vanishes. If I use the "freeze" command before summoning the projectile, I see this:



So, if you were looking for something that behaves a bit like a tracer round, it doesn't look like it's set up right, but at least now that the MODELDEF is working, you can tweak the DECORATE to make the actor behave like you want and I suspect that you'll want to look at the scale values in the MODELDEF too.
[/edit3]
User avatar
Cherno
Posts: 1337
Joined: Tue Dec 06, 2016 11:25 am

Re: How to implement proper model based weapon tracers?

Post by Cherno »

Edit: Posted too late :)
Last edited by Cherno on Sun May 31, 2020 6:39 pm, edited 1 time in total.
User avatar
Enjay
 
 
Posts: 27303
Joined: Tue Jul 15, 2003 4:58 pm
Location: Scotland
Contact:

Re: How to implement proper model based weapon tracers?

Post by Enjay »

Yes, I hadn't noticed that casings.txt was also missing from the #include
User avatar
AFADoomer
Posts: 1344
Joined: Tue Jul 15, 2003 4:18 pm
Contact:

Re: How to implement proper model based weapon tracers?

Post by AFADoomer »

You also used [wiki]A_FireCustomMissile[/wiki] in the weapon's fire state, but the parameters are all mixed up, and the flags are wrong.

Try this instead:

Code: Select all

A_FireProjectile("Tracer556", FRandom(-2.0, 2.0), true, 0, 0, 0, FRandom(-2.0, 2.0))
Also, as Enjay mentioned, your scale in the MODELDEF file will make the model look very odd. I recommend just using 1.0 1.0 1.0.

Oh, and you'll want to add PITCHFROMMOMENTUM at the top of your MODELDEF entry, too, otherwise the bolts will just stay oriented flat even if you aim up or down with them.
User avatar
Graaicko
Posts: 534
Joined: Tue Jun 17, 2014 11:22 pm
Graphics Processor: nVidia (Legacy GZDoom)

Re: How to implement proper model based weapon tracers?

Post by Graaicko »

What the actaul f*ck??? The original file I made the test for you guys included the include decorate commands... Must of unnoticedly deleted the projectile line from it. SO now I can starting working on it. But once summoning the tracer. Its not exactly what I am looking for. I guess I'll have to figure that out. :/ Thanks for making it work.
User avatar
Graaicko
Posts: 534
Joined: Tue Jun 17, 2014 11:22 pm
Graphics Processor: nVidia (Legacy GZDoom)

Re: How to implement proper model based weapon tracers?

Post by Graaicko »

Enjay wrote:Yes, I hadn't noticed that casings.txt was also missing from the #include
Yeah didin't think it was important enough to effect the tracers. I wanted to make the test file as small as possible.
User avatar
Enjay
 
 
Posts: 27303
Joined: Tue Jul 15, 2003 4:58 pm
Location: Scotland
Contact:

Re: How to implement proper model based weapon tracers?

Post by Enjay »

General point (not specifically to Graaicko):
This thread also shows why posting an actual example can be far more useful than trying to describe it. After a page of posts spanning a day or two, uploading the example allowed Cherno, AFADoomer and I to find the problem within a few minutes.

Graaicko posted code and quoted error messages, and that is often enough, but the actual example allowed things to be pinpointed very quickly. This is why it's useful in the various editing forums and critical in the bugs forum.
User avatar
Graaicko
Posts: 534
Joined: Tue Jun 17, 2014 11:22 pm
Graphics Processor: nVidia (Legacy GZDoom)

Re: How to implement proper model based weapon tracers?

Post by Graaicko »

AFADoomer wrote:You also used [wiki]A_FireCustomMissile[/wiki] in the weapon's fire state, but the parameters are all mixed up, and the flags are wrong.

Try this instead:

Code: Select all

A_FireProjectile("Tracer556", FRandom(-2.0, 2.0), true, 0, 0, 0, FRandom(-2.0, 2.0))
That is a weird piece of code. Slades decorate doesn't seem to recognize it (Highlights it when pasted), but it works regardless. Thanks. Now what if I wanted a monster to fire this tracer with the same effect??? A_CustomMissile doesn't seem to work.
User avatar
Graaicko
Posts: 534
Joined: Tue Jun 17, 2014 11:22 pm
Graphics Processor: nVidia (Legacy GZDoom)

Re: How to implement proper model based weapon tracers?

Post by Graaicko »

Aha, I found this:

Code: Select all

A_SpawnProjectile("556Tracer",38,6,random(-4,4))
^
Use this if you want it to be used by monsters. My projectiles seem a little too fast. I'll have to slow them down.
Post Reply

Return to “Scripting”