An Extra +UseSpecial Flag to Check Height

Post a reply

Smilies
:D :) :( :o :shock: :? 8-) :lol: :x :P :oops: :cry: :evil: :twisted: :roll: :wink: :geek: :ugeek: :!: :?: :idea: :arrow: :| :mrgreen: :3: :wub: >:( :blergh:
View more smilies

BBCode is ON
[img] is OFF
[url] is ON
Smilies are ON

Topic review
   

Expand view Topic review: An Extra +UseSpecial Flag to Check Height

Re: An Extra +UseSpecial Flag to Check Height

by Sir Robin » Sun Oct 22, 2023 11:54 am

camaxide wrote: Sat Oct 07, 2023 5:28 am was this ever "solved"? I need to be able to make checkrange on actors that has +UseSpecial :)
You know what? I'm over compilcating it. Here's a used function with a simple z check:

Code: Select all

class UsableWithZCheck : actor //actor is usable with a z check
{
	override bool used(actor user)
	{
		if (!user) return false;
		
		if (user.pos.z > pos.z+height) return false;
		if (user.pos.z+user.height < pos.z) return false;
		return usedz(user);
	}
	
	virtual bool usedz(actor user)
	{
		console.printf(level.time..": "..GetCharacterName()..": usedz by "..(user?user.GetCharacterName():"something"));//DEBUG
		return false;
	}
}

Re: An Extra +UseSpecial Flag to Check Height

by Sir Robin » Fri Oct 20, 2023 10:23 am

It would be nice to have an engine feature, but it's possible to code this yourself.

I have an object that can only be used from the front side, so I had to write code to check the user against the object before doing the use function.
Here's my thread. It's not exactly waht you're looking for because I don't consider pitch/z in my object because it's not important to me in the way I have my level layed out, but you get the idea of how you can do that yourself. Mine is projecting a plane out from the center of the object and checking for collisions with that. I do it that way because I wanted 360 degree accuracy. If you're only needing axis-aligned hitbox accuracy, the math is way simpler.

Something like this:

Code: Select all

class zUsable : actor
{
	default {+special}
	override bool used(actor user)
	{
		if (!isAimingAtMe(user)) return false;
		
		//do your used action here
		return true;
	}
	
	bool isAimingAtMe(actor other)
	{
		//calculate a ray from other's pos, angle, and pitch
		//check if that ray intersect's the caller's hitbox
		//return the result
	}
}

Re: An Extra +UseSpecial Flag to Check Height

by camaxide » Sat Oct 07, 2023 5:28 am

was this ever "solved"? I need to be able to make checkrange on actors that has +UseSpecial :)

Re: An Extra +UseSpecial Flag to Check Height

by NeuralStunner » Sat Oct 18, 2014 10:46 am

It would be nicest if it "simply" respected CheckSwitchRange, without need for another addition. But that would be harmful to backward compatibility, wouldn't it? :?

Re: An Extra +UseSpecial Flag to Check Height

by Nash » Sat Oct 18, 2014 12:12 am

Another useful check would be checking if the player's pitch is within the range of the actor also (so it shouldn't be possible to talk to someone in front of you when you are looking 90 degrees up :P)

Re: An Extra +UseSpecial Flag to Check Height

by NeuralStunner » Fri Oct 17, 2014 11:57 pm

I've thought of this before. I looked into adding it myself, but I never actually figured out where the activations are done.

An Extra +UseSpecial Flag to Check Height

by Ral22 » Fri Oct 17, 2014 11:23 pm

In the current implementation of actors that use the flag "UseSpecial" it does not (Or cannot) check the player's height in relation to the object. As such, you can be directly above the actor, even with a 3-d floor separating you, but still be able to activate it.

An additional flag, or altered, flag, such as "+UseSpecialCheckRange" or "+CheckRange", that does check the height distance (Much like "CheckSwitchRange") would be greatly appreciated and useful should anyone be creating a multi-floored building that utilizes "UseSpecial" actors.

I assumed that the lack of height checking was an intentional thing (Much like how Doom is that way by default), so that's why this idea is in the Feature Suggestions, not listed as a Bug.

Top