Directs a character to keep a specific distance from a specific position in the region or adjacent regions.

Syntax

void llFleeFrom( vector position, float distance, list options );

Parameters

vector position
position in region coordinates from which to flee.
float distance
Distance in meters to flee from position.
list options (instructions)
No options available at this time.

Caveats

Examples

vector last_touched_pos;
key last_touched_key;

default
{
    state_entry()
    {
        llCreateCharacter([CHARACTER_DESIRED_SPEED, 50.0]);
    }

    touch_start(integer total_number)
    {
	last_touched_key = llDetectedKey(0);
	last_touched_pos = llDetectedPos(0);
	llFleeFrom(last_touched_pos, 10, []);
	llSetTimerEvent(0.2);
    }
	
    timer()
    {
	vector last_touched_pos_now = llList2Vector(llGetObjectDetails(last_touched_key, [OBJECT_POS]), 0);
	if ( llVecDist(last_touched_pos, last_touched_pos_now) > 1 )
	{
	    last_touched_pos = last_touched_pos_now;
	    llFleeFrom(last_touched_pos, 10, []);
	}
    }
}

Notes

The position vector can be set outside the current region by using extended range region coordinates: e.g., to avoid the SE corner of the region to the East of the current one, you could

llFleeFrom(<0.0, 512.0, 0.0>, 20.0, []);

See also

Events

Functions

Deep notes

History

Date of Release 31/07/2012