Page 1 of 1

Building Proximity Events - 0.64.1

Posted: Mon Feb 11, 2013 12:32 pm
by Mit
I know Morb (for one) has been asking for this for ages, though i can't find a feature request thread for it.. anyway..

In 0.64.1 server, you can now add 'building proximity events' where you specify a building num and a distance, and an event will be triggered if the player enters or leaves the region of the building.
You activate that on a case by case basis as shown..

Code: Select all

Function  SetupProx()
{
	sysActivateBuildingProximityEvent( 22, 20 )
	sysActivateBuildingProximityEvent( 119, 15 )
	*msg %PLAYER% Building proximity events activated
}
First param to the 'Activate..' function is the building record number, the second is the distance. Each building can only have one active proximity event per online player.
Theres also DeactivateBuildingProximityEvent( [BuildingNum] ).

There are 4 new events.. BuildingIDProxEnter and BuildingIDProxLeave allow you to trigger events for a specific building. Alternatively, you can use the more general BuildingProxEnter and BuildingProxLeave events that are triggered for any prox event that isnt covered by a specific BuildingID event.

Here's an example of the generic events:

Code: Select all

Event( "BuildingProxEnter", "" )
{
	*msg %PLAYER% You entered the region of buildingID $gBuildingNum
}
Event( "BuildingProxLeave", "" )
{
	*msg %PLAYER% You left the region of buildingID $gBuildingNum
}
or alternatively you can do somethng like..

Code: Select all

Event( "BuildingIDProxEnter", "22" )
{
	*msg %PLAYER% You entered the region of the central bank
}
wahey.

Posted: Sun Oct 26, 2014 8:30 pm
by morbydvisns
I don't know why it's taken so long to use this with anything, but I cannot get any proximity events to kick.

Posted: Wed Oct 29, 2014 1:16 pm
by Mit
Its workin, but the command name has been changed to fit with current convention - its sysActivateBuildingProximityEvent not ActivateBuildingProximityEvent as was listed in the original post. (I've updated the original post now to avoid future confusion).
Same applies for "sysDeactivateBuildingProximityEvent"

On a related note, and in case i haven't documented it already, you've also got :

Code: Select all

sysActivateRangeEvent
sysDeactivateRangeEventEvent
Which is for triggering an event when the user leaves a particular region.
Format for the range event is :

Code: Select all

sysActivateRangeEvent( [EventID], [WorldX], [WorldY], [Range] )
and at the moment that triggers a "RangeLeave" event when the player leaves the specified region.