I tried a different method that I just recently learned, and it seems to partially work. I went into the WED file and applied the water block to a region titled "water". I then used the region_check() function in the player_code() function to see if the player made contact with the "water" region. Sure enough, the player did. The game is beeping like crazy when the player makes contact with the water block, but I keep getting this error pop-up message every time before the game loads as follows:

Code:
Error E1513
Script crash in terrain_get_z:
OK             Cancel



When I click the OK button, the player starts moving on its own without me moving it. Once I fiddle with the move buttons, then the player will stay put, and move according to my commands. However, the pop-up error above will not go away every time I restart the game, even when I erase the new code that I put in the program.

This is the new code I put:

Code:
...

action player_code()
{
   ...

   player = me;

   ...
	
   my.shadow = 1;
	
   vec_fill(move_vec, 0); // always reset a vector to zero when creating
	
   ...
	
   my.JUMP_FORCE = 13;
   var gravity_var = 0;
   var gravity_force = 2;
   var jumplck = 0;
   var space_lck = 0;
   my.FEET_HEIGHT = -my.min_z+1; // ORIGINAL
   
   my.eflags |= FAT | NARROW; // set both flags to prevent automatic recalculation on
	                            //      scale changes.
   my.emask |= ENABLE_SHOOT;

   ...
	 
   // set FLAG2 to make the guard detectable by c_scan, 
   // and store the guard pointer in its own CREATOR skill 
   // so that the detecting entity knows its enemy	
   set(my,FLAG2);  
   my.CREATOR = me;
	 
   set(my, POLYGON);
  
   camera.tilt = -5;

   ...
	
   wait(1);

   while (1)
   {
      VECTOR vMin,vMax; // NEW CODE
      vec_set(vMin,my.x); // NEW CODE
      vec_set(vMax,my.x); // NEW CODE
      vec_add(vMin,my.min_x); // NEW CODE
      vec_add(vMax,my.max_x); // NEW CODE
		
      if(region_check("water",vMin,vMax)) // NEW CODE
      {
         beep(); // NEW CODE
      }

      ...

      wait(1);
   }
}

...



Does anyone have an idea why I might be getting this error?

Last edited by Ruben; 07/02/15 03:22.