[Solved] Editing fast projectiles

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.

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!)
Post Reply
User avatar
Hornetzero
Posts: 312
Joined: Wed Dec 05, 2012 12:42 am
Location: Twighlight zone

[Solved] Editing fast projectiles

Post by Hornetzero »

I have two simple questions regarding fast projectiles. This here is suppose to be a long laser projectile that isn't a railgun (I want the laser to be a moving projectile, not an instant line created between two points).

Code: Select all

ACTOR LancerLaser : FastProjectile
{
	Radius 2
	Height 8
	Speed 50
	Damage 12
	Scale 0.5
	Alpha 1.0
	Projectile
	RenderStyle Add
	DeathSound "weapons/laserhit"
	Obituary "$OB_MPLASER"
	MissileType "LaserTrailSpawner"
	Decal "PlasmaScorchLower"
	DamageType "LancerLaser"
	//+EXTREMEDEATH
       //+SEEKERMISSILE
	+ALLOWBOUNCEONACTORS
	+BOUNCEONACTORS
	States
	{
	Spawn:
		LASP A -1 Bright
		loop
	Death:
		LASX ABCDEFGHIJK 2 Bright
               Stop
	}
}

ACTOR LaserTrailSpawner
{
	+NOBLOCKMAP
	+NOGRAVITY
	States
	{
	Spawn:
		TNT1 A 0
		TNT1 A 1 A_SpawnItemEx("LaserTrail",0,0,8,0,0,0,0,SXF_CLIENTSIDE,0)
		Stop
	}
}

ACTOR LaserTrail
{
	+NOBLOCKMAP
	+NOGRAVITY
	RenderStyle Add
	Alpha 1.0
	Scale 0.5
	Mass 5
	States
	{
	Spawn:
		LASP A 3 Bright
		Stop
	}
}

Q1, How do I increase the length of its trail?

Q2, How can I make the laser do continuous damage to the target it struck, while its trail catches up to it, and it vanishes (be it via sprite frames or some type of timer)?

Instead of their being a single collision burst, I want the laser to sear the opponent incrementally with constant damage until it dies.
Last edited by Hornetzero on Thu Nov 26, 2020 2:22 pm, edited 1 time in total.
User avatar
Dan_The_Noob
Posts: 880
Joined: Tue May 07, 2019 12:24 pm
Graphics Processor: nVidia with Vulkan support
Contact:

Re: Editing fast projectiles

Post by Dan_The_Noob »

to increase trial length you should be able to just change the number in "LASP A 3 Bright" on the LaserTrail

not sure about the continuous damage thing. maybe fire multiple projectiles a frame apart or something each shot and match it to the trail number?
User avatar
Hornetzero
Posts: 312
Joined: Wed Dec 05, 2012 12:42 am
Location: Twighlight zone

Re: Editing fast projectiles

Post by Hornetzero »

to increase trial length you should be able to just change the number in "LASP A 3 Bright" on the LaserTrail
Yup the works great.
not sure about the continuous damage thing. maybe fire multiple projectiles a frame apart or something each shot and match it to the trail number?


EDIT: No actually this is not the solution... because if the player is shooting this weapon or aiming it very quickly around, the laser would disperse instead of remaining one. :?
User avatar
Dan_The_Noob
Posts: 880
Joined: Tue May 07, 2019 12:24 pm
Graphics Processor: nVidia with Vulkan support
Contact:

Re: Editing fast projectiles

Post by Dan_The_Noob »

Hornetzero wrote:
to increase trial length you should be able to just change the number in "LASP A 3 Bright" on the LaserTrail
Yup the works great.
not sure about the continuous damage thing. maybe fire multiple projectiles a frame apart or something each shot and match it to the trail number?


EDIT: No actually this is not the solution... because if the player is shooting this weapon or aiming it very quickly around, the laser would disperse instead of remaining one. :?
try giving the projectile the RIPPER flag but lower the damage to compensate?

-EDIT-
RIPPER
For projectiles that can rip through monsters and players. Ripping projectiles constantly cause their damage amount when ripping through actors, so low damage values are recommended. Bleeding actors also spew blood when being ripped. They will never be reflectable by any actor unless it comes into contact with an actor containing DONTRIP.
User avatar
Hornetzero
Posts: 312
Joined: Wed Dec 05, 2012 12:42 am
Location: Twighlight zone

Re: Editing fast projectiles

Post by Hornetzero »

try giving the projectile the RIPPER flag but lower the damage to compensate?

-EDIT-
RIPPER
For projectiles that can rip through monsters and players. Ripping projectiles constantly cause their damage amount when ripping through actors, so low damage values are recommended. Bleeding actors also spew blood when being ripped. They will never be reflectable by any actor unless it comes into contact with an actor containing DONTRIP.
I do have an other laser weapon that uses the ripper flag to make its short laser projectiles more potent. Unfortunately this is not something I want to incorporate in the design of the long laser mentioned in this topic.

So I did a search for overriding this property in Zscript and found this: viewtopic.php?f=122&t=63558

I modified that script to force the fast projectile laser to register 3 consecutive damage points to the enemy instead of 1. Here is my script for it:

Image

It unfortunately spits this error out. I may be able to resolve the latter two issues, but the first three, I don't get.

Image
User avatar
Player701
 
 
Posts: 1710
Joined: Wed May 13, 2009 3:15 am
Graphics Processor: nVidia with Vulkan support
Contact:

Re: Editing fast projectiles

Post by Player701 »

You haven't defined a field called last_hit in your class, that's why there is an unknown identifier error. To solve it, define the field as follows:

Code: Select all

class NecroLaser : FastProjectile
{
    private Actor last_hit;

    // TODO: Rest of code goes here
}
As for DamageMobj, the example code you linked to is not compilable as-is because it doesn't specify any real arguments, only a placeholder. See here for the list of arguments you should supply to DamageMobj.
Jarewill
 
 
Posts: 1854
Joined: Sun Jul 21, 2019 8:54 am

Re: Editing fast projectiles

Post by Jarewill »

You could also try spawning an actor that will shoot three projectiles really quickly.
That way the laser will always go one way, instead of going in multiple directions when moving quickly.
Example:
Spoiler:
User avatar
Hornetzero
Posts: 312
Joined: Wed Dec 05, 2012 12:42 am
Location: Twighlight zone

Re: Editing fast projectiles

Post by Hornetzero »

You could also try spawning an actor that will shoot three projectiles really quickly.
That way the laser will always go one way, instead of going in multiple directions when moving quickly.
Example:
Thank you once again Jarewill. That is yet another very simple, efficient script that I will use.
You haven't defined a field called last_hit in your class, that's why there is an unknown identifier error. To solve it, define the field as follows:

CODE: SELECT ALL
class NecroLaser : FastProjectile
{
private Actor last_hit;

// TODO: Rest of code goes here
}

As for DamageMobj, the example code you linked to is not compilable as-is because it doesn't specify any real arguments, only a placeholder. See here for the list of arguments you should supply to DamageMobj.
Thank you as well. Although I may not have to opt for doing it this way anymore, the correction you provided gives me more insight on how Zscript is meant to be used and what I didn't get from the example provided. I will experiment more with this until I get it to work, regardless of use or not.
Post Reply

Return to “Scripting”