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

Is damage factor for power-ups possible?

Question

Okay so let's I were to make a reflection power-up and wanted all projectiles (even custom ones) to bounce back without taking your health but still have Archvile attacks and hitscans damage you, would this have to mean I'd have to create a damage factor like how I'd do with monsters? I don't think using invulnerability would be it and not give me what I need. I'm a decorate type modder so anything regarding Zscript I'd prefer to pass. If what I'm asking is possible let me know in replies. I'm also asking this in case any future modders come around and wanna seek some answers on what they could be curious about. Like how I am right now.

Share this post


Link to post

6 answers to this question

Recommended Posts

  • 0

So, if by reflection you mean like the REFLECTIVE flag, then I literally made what you're asking for, except for the DamageFactors.

 

It's possible in DECORATE, but you'll still need to make an ACS script.

Here's an example of what you can make:

Spoiler

Actor ReflectCharge : Inventory { Inventory.MaxAmount 60 } //Dummy item that will keep the powerup active for 60 seconds

Actor ReflectiveSphere : CustomInventory
{
	+COUNTITEM
	+INVENTORY.AUTOACTIVATE
	+INVENTORY.ALWAYSPICKUP
	+INVENTORY.BIGPOWERUP
	Inventory.MaxAmount 0
	Inventory.PickupMessage "Reflective Shield"; //Whatever you want
	Inventory.PickupSound "misc/p_pkup"

	States
	{
	Spawn:
		PINS ABCD 6 Bright //I'm using blursphere sprites
		Loop
	Pickup:
		TNT1 A 0 
		{
			A_GiveInventory("ReflectCharge", 60) //Give dummy item
			ACS_NamedExecute("Reflection",0,0,0,0) //The actor who pickups the powerup will be the activator of the script
		}
		Stop
	}
}

 

(I'm sorry if there are some error around, I quickly converted it to DECORATE from ZSCRIPT and modified it quite a bit).

 

For the script instead, it would be better for you to have a library, so make a "script" lump in Slade3 and then compile it:

Spoiler

#library "AWSMLIB.ACS" //Whatever you named your script (text) lump in name
#include "zcommon.acs"

script "Reflection" (void) {
	While(CheckInventory("ReflectCharge")>0) { //Looping check if the actor who pickedup the powerup has the dummy item
        SetActorFlag(0,"REFLECTIVE",true); //If yes, give to the actor the REFLECTIVE flag (you can give him any flag you need, or change its properies
										  //with SetPlayerProperty() or SetActorPropery() for example
        TakeInventory("ReflectCharge",1); //Take away 1 dummy item
        Delay(35);                       //per second
    }
    SetActorFlag(0,"REFLECTIVE",false); //When there are no more dummy items, remove the flags
}

 

 

Unfortunately I cannot think of a way to make some projectiles deal damage, while other (or in this case hitscans) don't without the DamageFactor property which will require to create a new armor actor that can give the "wearer" a DamageFactor protection, but armors have no time limit and have values that will drop when hit without exception (for what I know at least).

 

Anyway, You could make an armor with a 0% save percent and with a DamageFactor of 1.0 to a specific damage type and then remove that armor through the script when the player runs out of dummy items, but still I don't know what would happen if the player get another armor when the powerup is active...

 

EDIT:

I totally forgot that the PowerProtection has the DamageFactor property available!

So you could create a new actor inheriting from it, giving it a specified DamageFactor for a specified damage type (0.0 for 100% protection).

Then you "just" have to give every single projectile the damage type you want to... (you can choose from this list, from the ones that are in Doom unused).

Like this:

Spoiler

Actor DisintegrateProtection : PowerProtection
{
	Powerup.Duration -60 //Since I want the entirety of the effects to stay for 1 minute
	DamageFactor "Disintegrate", 0.0 //Choose the damage you wish or make a new one 
	+DONTBLAST //Just because why not
}

///////////////////////////////////////////////////

Actor FireImpBall : DoomImpBall Replaces DoomImpBall { DamageType "Disintegrate" } //Same for every Doom projectile

 

Don't forget to give this powerup in the Pickup state of the "true" powerup!!

Edited by Kan3

Share this post


Link to post
  • 0
6 hours ago, Kan3 said:

 

Alright, glad to know it can be done because I'm making a special armor that not only gives you 250 things of health but can also bounce back visible projectiles. But hitscans and archvile attacks can still hurt you. Only issue is I can't seem to find the damage type for both those attacks.

Share this post


Link to post
  • 0
1 hour ago, Ani said:

Alright, glad to know it can be done because I'm making a special armor that not only gives you 250 things of health but can also bounce back visible projectiles. But hitscans and archvile attacks can still hurt you. Only issue is I can't seem to find the damage type for both those attacks.

Because they don't have a damage type, every damaging projectile and hitscan (except for melee I think) deal "normal" damage.

To change the damage type of hitscan stuff (punches included) you have to define the DamageType property in the puff they use (Every hitscan use BulletPuff by default), while for the archvile you actually need to rewrite its missile state entirely to give the damage type you want, because you have to change it from the A_VileAttack function.

I don't know if it would work otherwise.

Share this post


Link to post
  • 0
1 hour ago, Kan3 said:

 

Damn... guess I'll just leave the armor the way it is then.

Share this post


Link to post
  • 0

making the necessary changes in DECORATE (and probably ZSCRIPT too, but I don't really use it) is simple enough, if a bit tedious. Don't let it dissuade you.

Share this post


Link to post
  • 0
4 minutes ago, SMG_Man said:

 

Well again, I don't use Zscript.

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
×