Jump to content
Sign in to follow this  
Alpine_gremlin

Class of Chernarus General Stores

Recommended Posts

So I am writing script that returns whether the player is inside certain types of enterable buildings. To accomplish this I am using the distance and nearestBuilding commands. The check works well with buildings such as the fire station and pub, but it does not seem to work with the general store. I am running the check with the general store in Elektrozavodsk. I have attempted to use the following classnames:

 

"Land_A_GeneralStore_01a"

"Land_A_GeneralStore_01a_dam"

"Land_A_GeneralStore_01"

"Land_A_GeneralStore_01_dam"

 

None of these seem to work. I realize that the nearestBuilding command requires the building to be of class "House". Is the general store not of this class? Should I be using a different command such as nearestObject?

 

If anyone is curious about the script itself:

 

	if (((_playerPos distance nearestBuilding player) < 15) && ((typeOf nearestBuilding player) == (_enterableBuildings select 28))) then {
		
		systemChat format ["%1 is inside a general store", name player];
                                                           
//_enterableBuildings is my array with all enterable building classnames in it. 

 

Any help would be appreciated! Cheers!

Share this post


Link to post
Share on other sites

Try this perhaps:

 

_inBuilding = lineIntersectsWith [eyePos player, [getPos player select 0, getPos player select 1, 20]];

if ((typeOf (_inBuilding select 0)) == (_enterableBuildings select 28)) then 
{	
	systemChat format ["%1 is inside a general store", name player];
};

This projects an invisible line from the eyes of your character and looks for any objects that intersect with it, in this case, it could be a general store. This way you can check if someone is inside a building without having to check for distance with nearestBuilding.

 

You can also use this like this to tell you what the class name of any building you enter is:

 

hint typeOf ((lineIntersectsWith [eyePos player, [getPos player select 0, getPos player select 1, 20]]) select 0);

 

Also, make sure you triple-check your _enterableBuildings array for any typos or any other mistakes.

Edited by alpha993
Fixed stupid mistake on my part
  • Like 1

Share this post


Link to post
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
Sign in to follow this  

×