Getting actor class defaults?

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
Xabis
Posts: 63
Joined: Wed Mar 06, 2013 7:15 pm

Getting actor class defaults?

Post by Xabis »

Hello,

I am writing a generic projectile spawn function that takes the actor class type as a parameter, but i need to run some calculations using the projectile's speed and gravity. Is there a way to retrieve the default values on a class type?

ex:

Code: Select all

void A_CustomSpawnProjectile(class<Actor> missiletype, ...) {

	missiletype.gravity ?
	
	missiletype.speed ?
	
}
Xabis
Posts: 63
Joined: Wed Mar 06, 2013 7:15 pm

Re: Getting actor class defaults?

Post by Xabis »

Nevermind, i found it:

Code: Select all

GetDefaultByType("Type").Speed
User avatar
Apeirogon
Posts: 1606
Joined: Mon Jun 12, 2017 12:57 am

Re: Getting actor class defaults?

Post by Apeirogon »

If you have pointer to actor, from which you want get defaults, you can also do this

Code: Select all

pointer.default.speed/health/tag/etc
Post Reply

Return to “Scripting”