Jump to content

Adding a new attack in zscript


Recommended Posts

So as the title of the topic implies, I'm trying to add an extra attack to the revenant via zsript. I specifically want to give him an additional attack which he will use when at longer range, to overcome the slow flight of revenant rockets. I was wondering if anyone had any advice on the best way to do this?

Share this post


Link to post

Since you're opting for a an attack that the revenant will use at a long range, so he will need something fast and precise, and since he already has 2 cannons of his shoulder, I would say that giving him the ability to shoot 2 railgun-like rays (like it has already been done with several revenants variant) would be a neat addition.

 

You'd need to add a could of checks for the target range, so that the monster will use the railguns or the missile attack, but the thing is pretty easy to do.

 

Best way to do this stuff is to modify the monster Missile state and add another ranged attack state, something like this

Spoiler

Missile:
		SKEL J 10 BRIGHT A_FaceTarget;
		TNT1 A 0 A_JumpIfCloser("Seeker", 800); //If the target is closer than 800 map units, then it will jump to the normal seeker rocket attack
		TNT1 AA 0 A_CustomRailgun(random(1,3)*8, -12, "Red", "White", RGF_FULLBRIGHT, 0, 0, "BulletPuff", 2, 2); //a pretty standard railgun (doubled) attack, costumize it as you please.
		SKEL K 10 A_FaceTarget;
		Goto Seeker+1; //end the attack.
Seeker:
		SKEL K 10 A_SkelMissile;
		SKEL K 10 A_FaceTarget;
		Goto See;

 

Check the A_CustomRailgun function on the wiki to change the parameters you want to etc.

Share this post


Link to post
7 hours ago, Kan3 said:

Since you're opting for a an attack that the revenant will use at a long range, so he will need something fast and precise, and since he already has 2 cannons of his shoulder, I would say that giving him the ability to shoot 2 railgun-like rays (like it has already been done with several revenants variant) would be a neat addition.

 

You'd need to add a could of checks for the target range, so that the monster will use the railguns or the missile attack, but the thing is pretty easy to do.

 

Best way to do this stuff is to modify the monster Missile state and add another ranged attack state, something like this

  Reveal hidden contents


Missile:
		SKEL J 10 BRIGHT A_FaceTarget;
		TNT1 A 0 A_JumpIfCloser("Seeker", 800); //If the target is closer than 800 map units, then it will jump to the normal seeker rocket attack
		TNT1 AA 0 A_CustomRailgun(random(1,3)*8, -12, "Red", "White", RGF_FULLBRIGHT, 0, 0, "BulletPuff", 2, 2); //a pretty standard railgun (doubled) attack, costumize it as you please.
		SKEL K 10 A_FaceTarget;
		Goto Seeker+1; //end the attack.
Seeker:
		SKEL K 10 A_SkelMissile;
		SKEL K 10 A_FaceTarget;
		Goto See;

 

Check the A_CustomRailgun function on the wiki to change the parameters you want to etc.

 

Thanks for the example, I had actually just stumbled across A_CheckRange and had used that to set up an attack. It's interesting to the see the multiple ways to skin a cat here, and I wonder if there are any significant differences between checkrange and jumpifcloser in this context, other than how they check distance.

Share this post


Link to post
7 hours ago, Doom_Pope said:

 

Thanks for the example, I had actually just stumbled across A_CheckRange and had used that to set up an attack. It's interesting to the see the multiple ways to skin a cat here, and I wonder if there are any significant differences between checkrange and jumpifcloser in this context, other than how they check distance.

There is, like the wiki says: "Jumps if the calling actor is beyond distance range from all player pawns."

So A_CheckRange only works with a player target, if your revenant start some infight he will not jump to another state.

 

Share this post


Link to post

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...