HidDest Addon script issue: Pointer conversion issue

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
User avatar
Silentdarkness12
Posts: 1555
Joined: Thu Aug 15, 2013 5:34 pm
Location: Plains of Pride

HidDest Addon script issue: Pointer conversion issue

Post by Silentdarkness12 »

Having a bit of a conundrum here. So i'm working on an addon for Hideous Destructor to add in a way to repair armor. Been working on trying to get the basic functionality working first, such as drawing the text for it on the screen, but i'm running into something that I can't quite figure out.

https://pastebin.com/ZKkUHHqF

The specific problem seems to be this function here

Code: Select all

override void DrawHUDStuff(HDStatusBar sb,HDWeapon hdw,HDPlayerPawn hpl){
        if(!thisarmour||thisarmour.mags.size()<1)return;
        sb.beginhud(forcescaled:true);
        thisarmour.DrawHUDStuff(sb,self,hpl);
        sb.beginhud(forcescaled:false);
        }

Code: Select all

thisarmour.DrawHUDStuff(sb,self,hpl);
It crashes on load with this:

Code: Select all

Script error, "HidDest_ArmorPatchKit.pk3:zscript" line 99: Cannot convert Pointer<Class<HDArmorFixerer>> to Pointer<Class<MagManager>>
I've been spending a good while trying to wind my way backwards through the code to figure out what's going on. The problem is that the specific line up above thinks that i'm trying to tap HD's MagManager into my armor fixerer as a self, and the pointers can't convert. The thing is, I cannot work out for the life of me what exactly in the code is causing this to happen. It's not inheiriting from MagManager anywhere I can see. I'm hoping someone can help me see what i'm missing here.
User avatar
Matt
Posts: 9696
Joined: Sun Jan 04, 2004 5:37 pm
Preferred Pronouns: They/Them
Operating System Version (Optional): Debian Bullseye
Location: Gotham City SAR, Wyld-Lands of the Lotus People, Dominionist PetroConfederacy of Saudi Canadia
Contact:

Re: HidDest Addon script issue: Pointer conversion issue

Post by Matt »

Code: Select all

thisarmour.DrawHUDStuff(sb,self,hpl);
I have no idea what the intended effect of this line even is. Which properties of what actor is this intended to display?

EDIT: ThisArmour is casted as HDArmour which is a descendant of HDMagAmmo. HDMagAmmo's DrawHUDStuff function expect a descendant of MagManager where "self" is.
User avatar
Silentdarkness12
Posts: 1555
Joined: Thu Aug 15, 2013 5:34 pm
Location: Plains of Pride

Re: HidDest Addon script issue: Pointer conversion issue

Post by Silentdarkness12 »

Matt wrote:

Code: Select all

thisarmour.DrawHUDStuff(sb,self,hpl);
I have no idea what the intended effect of this line even is. Which properties of what actor is this intended to display?

EDIT: ThisArmour is casted as HDArmour which is a descendant of HDMagAmmo. HDMagAmmo's DrawHUDStuff function expect a descendant of MagManager where "self" is.
Thanks, that got it.
Post Reply

Return to “Scripting”