[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.

[Solved] Editing fast projectiles

Postby Hornetzero » Mon Nov 23, 2020 2:59 pm

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 allExpand view
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
Hornetzero
 
Joined: 05 Dec 2012
Location: Twighlight zone

Re: Editing fast projectiles

Postby Dan_The_Noob » Tue Nov 24, 2020 12:24 am

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
Dan_The_Noob
 
Joined: 07 May 2019
Twitch ID: Dan_The_Noob
Operating System: Windows 10/8.1/8/201x 64-bit
Graphics Processor: nVidia with Vulkan support

Re: Editing fast projectiles

Postby Hornetzero » Tue Nov 24, 2020 12:54 am

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
Hornetzero
 
Joined: 05 Dec 2012
Location: Twighlight zone

Re: Editing fast projectiles

Postby Dan_The_Noob » Thu Nov 26, 2020 12:00 am

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
Dan_The_Noob
 
Joined: 07 May 2019
Twitch ID: Dan_The_Noob
Operating System: Windows 10/8.1/8/201x 64-bit
Graphics Processor: nVidia with Vulkan support

Re: Editing fast projectiles

Postby Hornetzero » Thu Nov 26, 2020 1:15 pm

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: https://forum.zdoom.org/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
Hornetzero
 
Joined: 05 Dec 2012
Location: Twighlight zone

Re: Editing fast projectiles

Postby Player701 » Thu Nov 26, 2020 1:50 pm

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 allExpand view
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.
User avatar
Player701
 
 
 
Joined: 13 May 2009
Location: Russia
Discord: Player701#8214
Operating System: Windows 10/8.1/8/201x 64-bit
OS Test Version: No (Using Stable Public Version)
Graphics Processor: nVidia with Vulkan support

Re: Editing fast projectiles

Postby Jarewill » Thu Nov 26, 2020 1:54 pm

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:
Jarewill
 
 
 
Joined: 21 Jul 2019

Re: Editing fast projectiles

Postby Hornetzero » Thu Nov 26, 2020 2:22 pm

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.
User avatar
Hornetzero
 
Joined: 05 Dec 2012
Location: Twighlight zone


Return to Scripting

Who is online

Users browsing this forum: No registered users and 2 guests