I'm trying to get a UI to appear when the FPS Player walks into the bounds of an AI Sensor attached to a model (Sinbad seems to work fine, but Jaiqua and Ninja have this error).
The error I'm getting is:
- Code: Select all
- ERROR::RAYCASTING failed to find ray
 LUA ERROR: Entity ID [ -1 ] was not found or it is invalid?
This error happens *most* of the time, but not always??
The code I'm using is:
- Code: Select all
- objJ = 0
 bSensorJ = false;
 function onInit ( objID )
 objJ = objID;
 sensor.enableVisibilityCheck ( objJ, 1 );
 anim.setEnabled ( objJ, "Walk", 1);
 anim.setLooped ( objJ, "Walk", 1 );
 anim.playAnimation ( objJ, "Walk", 0, 0);
 end
 function onSensorContact_Stay ( targetID, distance )
 if ( not bSensorJ ) then
 local sTgt = entity.getTagFromID ( targetID );
 if ( sTgt == "Player" ) then
 local isVisible = sensor.isTargetVisible ( objJ );
 if ( isVisible == 1 ) then
 if ( distance < 5 ) then
 bSensorJ = true;
 local tmpTalk = tonumber ( sky.getVar ( "talking" ) );
 if ( tmpTalk == 0 ) then
 entity.lookatObject ( objJ, targetID, 1, 0, 0, 1 );
 gui.show ( "Chat_HUD", "textCell9" );
 gui.setText ( "Chat_HUD", "lbl_talk_C", "Press E to talk" );
 sky.setVar ( "talking", 1 );
 sky.setVar ( "talkingto", objJ );
 end
 end
 end
 end
 end
 end
which is almost identical for Sinbad, Jaiqua & Ninja.
Any help would be greatly appreciated.
Regards
Shando
 
				





 
  That'll teach me to copy and paste!!!!
 That'll teach me to copy and paste!!!! copy and paste and make some days very difficult
 copy and paste and make some days very difficult