Accessing an Actor's custom attributes

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!)
SuaveSteve
Posts: 79
Joined: Sat Jul 05, 2014 7:38 am

Accessing an Actor's custom attributes

Post by SuaveSteve »

I get "Unknown function x" when trying to access a member of an Actor inheriting class I spawned through Spawn.

This does not work:

Code: Select all

ActorHeadLight light = Actor.Spawn("ActorHeadLight");
Is this possible in some way to do?
User avatar
krokots
Posts: 272
Joined: Tue Jan 19, 2010 5:07 pm

Re: Accessing an Actor's custom attributes

Post by krokots »

Probably you are missing a cast.

Code: Select all

ActorHeadLight light = ActorHeadLight(Actor.Spawn("ActorHeadLight"));
SuaveSteve
Posts: 79
Joined: Sat Jul 05, 2014 7:38 am

Re: Accessing an Actor's custom attributes

Post by SuaveSteve »

Yes, I just read about casting on the pointers wiki page. Documentation is all over the place. You'd think casting would be automatic. Thanks.

Return to “Scripting”