CheckProximity error: Cannot convert bool to class type

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

CheckProximity error: Cannot convert bool to class type

Post by Silentdarkness12 »

Working away on another addon for Hideous Destructor and i'm running into a bizarre error i've been unable to figure out how to fix.

Code: Select all

if(CheckProximity("BFGShard" || "NecroShard",300.0,1,CPXF_ANCESTOR|CPXF_SETTARGET,plr))
		{
			actor fragshardpointer = getpointer(AAPTR_TARGET);
			actor fakeshardpointer = fragshardpointer.spawn("frugshard");
			fakeshardpointer.target = invoker;
			A_Remove(AAPTR_TARGET,RMFV_EVERYTHING);
			
		}
I am being given the error "Cannot convert bool to class type". I've tried making it a singular check, and also changing out plr for AAPTR_DEFAULT, but neither of these are addressing the issue. Not sure what's missing here.

Code: Select all

void SiphonFrag()
	{
	if(weaponstatus[ENUMS_UMKR_CHAMBERLOADED] <1)
		{
		return;
		}
	if(weaponstatus[ENUMS_UMKR_LIQUIDFRAG]>9900)
		{
		return;
		}
	let plr = HDPlayerPawn(owner);
	if(!plr.GetPlayerInput(unmakernum,BT_ALTATTACK))
		{
		return;
		}
	if(CheckProximity("BFGShard" || "NecroShard",300.0,1,CPXF_ANCESTOR|CPXF_SETTARGET,plr))
		{
			actor fragshardpointer = getpointer(AAPTR_TARGET);
			actor fakeshardpointer = fragshardpointer.spawn("frugshard");
			fakeshardpointer.target = invoker;
			A_Remove(AAPTR_TARGET,RMFV_EVERYTHING);
			
		}
	}
User avatar
comet1337
Posts: 876
Joined: Fri Sep 25, 2015 3:48 am
Location: elsewhere

Re: CheckProximity error: Cannot convert bool to class type

Post by comet1337 »

you have to check the actors seperately per function
OR operator doesn't work like that with actors / class types (as much as i wish it would)
it checks if its either, but the result is a bool

if (checkproximity(A) || checkproximity(B))
Post Reply

Return to “Scripting”