Advertisement
Terrah

nwnx_areas

Sep 13th, 2015
288
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 2.33 KB | None | 0 0
  1. //Create an area based on sResRef
  2. object AREAS_CreateArea( string sResRef );
  3.  
  4. //Destroy an area, returns true/false
  5. //Areas which has players in them cannot be destroyed
  6. int AREAS_DestroyArea( object oArea );
  7.  
  8. //Set the name of oArea
  9. void AREAS_SetAreaName( object oArea, string sNewName );
  10.  
  11. //Returns corresponding area to nArea where nArea is the index into the area list
  12. //Returns object_invalid if nArea is invalid or there are no more areas
  13. object AREAS_GetArea( int nArea );
  14.  
  15. //Returns the ground height at location
  16. float AREAS_GetHeight( location lLoc );
  17.  
  18. //Get the number of players in the area
  19. int AREAS_GetPlayers( object oArea );
  20.  
  21. int AREAS_GetPlayers( object oArea ){
  22.  
  23.     SetLocalString( oArea, "NWNX!AREAS!GET_PLAY", ".........." );
  24.     int nRet = StringToInt( GetLocalString( oArea, "NWNX!AREAS!GET_PLAY" ) );
  25.     DeleteLocalString( oArea, "NWNX!AREAS!GET_PLAY" );
  26.     return nRet;
  27. }
  28.  
  29. float AREAS_GetHeight( location lLoc ){
  30.  
  31.     vector v = GetPositionFromLocation( lLoc );
  32.     object oArea = GetAreaFromLocation( lLoc );
  33.  
  34.     SetLocalString( oArea, "NWNX!AREAS!GET_HEIGHT", FloatToString( v.x )+" "+FloatToString( v.y )+" "+FloatToString( v.z ) );
  35.     float fData = StringToFloat( GetLocalString( oArea, "NWNX!AREAS!GET_HEIGHT" ) );
  36.     DeleteLocalString( oArea, "NWNX!AREAS!GET_HEIGHT" );
  37.     return fData;
  38. }
  39.  
  40. object AREAS_GetArea( int nArea ){
  41.  
  42.     SetLocalString( OBJECT_SELF, "NWNX!AREAS!GET_AREA", IntToString( nArea ) );
  43.     DeleteLocalString( OBJECT_SELF, "NWNX!AREAS!GET_AREA" );
  44.     return GetLocalObject( OBJECT_SELF, "NWNX!AREAS!GET_LAST_AREA_ID" );
  45. }
  46.  
  47. void AREAS_SetAreaName( object oArea, string sNewName ){
  48.  
  49.     SetLocalString( oArea, "NWNX!AREAS!SET_AREA_NAME", sNewName );
  50.     DeleteLocalString( oArea, "NWNX!AREAS!SET_AREA_NAME" );
  51. }
  52.  
  53. object AREAS_CreateArea( string sResRef ){
  54.  
  55.     SetLocalString( OBJECT_SELF, "NWNX!AREAS!CREATE_AREA", sResRef );
  56.     DeleteLocalString( OBJECT_SELF, "NWNX!AREAS!CREATE_AREA" );
  57.     return GetLocalObject( OBJECT_SELF, "NWNX!AREAS!GET_LAST_AREA_ID" );
  58. }
  59.  
  60. int AREAS_DestroyArea( object oArea ){
  61.  
  62.     SetLocalString( OBJECT_SELF, "NWNX!AREAS!DESTROY_AREA", ObjectToString( oArea ) );
  63.     int n = StringToInt( GetLocalString( OBJECT_SELF, "NWNX!AREAS!DESTROY_AREA" ) );
  64.     DeleteLocalString( OBJECT_SELF, "NWNX!AREAS!DESTROY_AREA" );
  65.     return n;
  66. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement