Difference between revisions of "LlEvade"

From Second Life Wiki
Jump to navigation Jump to search
m (makes no sense for this one.)
m
Line 15: Line 15:
examples=
examples=
<lsl>
<lsl>
vector start_position;
default
default
{
{
    on_rez(integer start_param)
    {
        llResetScript();
    }
     state_entry()
     state_entry()
     {
     {
        llDeleteCharacter();
         llCreateCharacter([CHARACTER_MAX_SPEED, 25, CHARACTER_DESIRED_SPEED, 15.0]);
         llCreateCharacter([CHARACTER_MAX_SPEED, 25, CHARACTER_DESIRED_SPEED, 15.0]);
         //MAX_SPEED is @ 20 by default
         llWanderWithin(start_position, <10.0, 10.0, 2.0>, []])
 
        start_position = llGetPos();
    }
    touch_start(integer num_detected)
    {
        llEvade(llDetectedKey(0), []);
        llSetTimerEvent(20.0);
     }
     }


     touch_start(integer total_number)
     timer()
     {
     {
         llEvade(llDetectedKey(0), []);
    //  do not keep running away...
         llSetTimerEvent(0.0);
 
        llWanderWithin(start_position, <10.0, 10.0, 2.0>, []])
     }
     }
}
}
</lsl> |
</lsl>|
also_functions=
also_functions=
* [[llCreateCharacter]]
* [[llCreateCharacter]]

Revision as of 13:04, 4 December 2012

Summary

Function: llEvade( key target, list options );

Characters will (roughly) try to hide from their pursuers if there is a good hiding spot along their fleeing path. Hiding means no direct line of sight from the head of the character (center of the top of its physics bounding box) to the head of its pursuer and no direct path between the two on the navmesh.

• key target group, avatar or object UUID to evade
• list options No options currently available

Caveats

  • Must use llCreateCharacter or script will not compile.
  • If the target is an object, it must be unlinked or be the root prim of a linkset.

Examples

<lsl> vector start_position;

default {

   on_rez(integer start_param)
   {
       llResetScript();
   }
   state_entry()
   {
       llDeleteCharacter();
       llCreateCharacter([CHARACTER_MAX_SPEED, 25, CHARACTER_DESIRED_SPEED, 15.0]);
       llWanderWithin(start_position, <10.0, 10.0, 2.0>, []])
       start_position = llGetPos();
   }

   touch_start(integer num_detected)
   {
       llEvade(llDetectedKey(0), []);
       llSetTimerEvent(20.0);
   }
   timer()
   {
   //  do not keep running away...
       llSetTimerEvent(0.0);
       llWanderWithin(start_position, <10.0, 10.0, 2.0>, []])
   }

}

</lsl>

Deep Notes

Signature

function void llEvade( key target, list options );